@@ -15,15 +15,14 @@ if [[ $? != 1 ]]; then
15
15
exit 1
16
16
fi
17
17
18
- if [[ " $OUT " != " status code 405 " ]]; then
18
+ if [[ " $OUT " != " Access is denied Not enough privileges to complete the action " ]]; then
19
19
echo " Unexpected output from set_secure_system_falco_rules.py: $OUT "
20
20
exit 1
21
21
fi
22
22
set -e
23
23
24
- # There's a known system falco rules file. Get it and compare it to the expected file
24
+ # Get the system falco rules file. Don't validate it, just verify that it can be fetched.
25
25
$SCRIPTDIR /../examples/get_secure_system_falco_rules.py $PYTHON_SDC_TEST_API_TOKEN > /tmp/falco_rules.yaml
26
- diff /tmp/falco_rules.yaml $SCRIPTDIR /sample-falco-rules.yaml
27
26
28
27
NOW=$( date)
29
28
cat << EOF > /tmp/test_apis_user_rules.yaml
50
49
# be 1, corresponding to the system falco rule.
51
50
$SCRIPTDIR /../examples/create_default_policies.py $PYTHON_SDC_TEST_API_TOKEN
52
51
OUT=` $SCRIPTDIR /../examples/list_policies.py $PYTHON_SDC_TEST_API_TOKEN `
53
- if [[ $OUT != * " \" name\" : \" My Rule \" " * ]]; then
52
+ if [[ $OUT != * " \" name\" : \" Write below binary dir \" " * ]]; then
54
53
echo " Unexpected output after creating default policies"
55
54
exit 1
56
55
fi
57
56
58
57
# Get that policy, change the name, and create a new duplicate policy.
59
- OUT=` $SCRIPTDIR /../examples/get_policy.py $PYTHON_SDC_TEST_API_TOKEN " My Rule " `
58
+ OUT=` $SCRIPTDIR /../examples/get_policy.py $PYTHON_SDC_TEST_API_TOKEN " Write below binary dir " `
60
59
MY_POLICY=$OUT
61
- if [[ $OUT != * " \" name\" : \" My Rule \" " * ]]; then
62
- echo " Could not fetch policy with name \" My Rule \" "
60
+ if [[ $OUT != * " \" name\" : \" Write below binary dir \" " * ]]; then
61
+ echo " Could not fetch policy with name \" Write below binary dir \" "
63
62
exit 1
64
63
fi
65
64
66
- NEW_POLICY=` echo $MY_POLICY | sed -e " s/My Rule /Copy Of My Rule /g" | sed -e ' s/"id": [0-9]*,//' | sed -e ' s/"version": [0-9]*/"version": null/' `
65
+ NEW_POLICY=` echo $MY_POLICY | sed -e " s/Write below binary dir /Copy Of Write below binary dir /g" | sed -e ' s/"id": [0-9]*,//' | sed -e ' s/"version": [0-9]*/"version": null/' `
67
66
OUT=` echo $NEW_POLICY | $SCRIPTDIR /../examples/add_policy.py $PYTHON_SDC_TEST_API_TOKEN `
68
- if [[ $OUT != * " \" name\" : \" Copy Of My Rule \" " * ]]; then
67
+ if [[ $OUT != * " \" name\" : \" Copy Of Write below binary dir \" " * ]]; then
69
68
echo " Could not create new policy"
70
69
exit 1
71
70
fi
72
71
73
72
# Change the description of the new policy and update it.
74
- MODIFIED_POLICY=` echo $MY_POLICY | sed -e " s/My Description /My New Description/g" `
73
+ MODIFIED_POLICY=` echo $MY_POLICY | sed -e " s/an attempt to write to any file below a set of binary directories /My New Description/g" `
75
74
OUT=` echo $MODIFIED_POLICY | $SCRIPTDIR /../examples/update_policy.py $PYTHON_SDC_TEST_API_TOKEN `
76
75
if [[ $OUT != * " \" description\" : \" My New Description\" " * ]]; then
77
- echo " Could not update policy \" Copy Of My Rule \" "
76
+ echo " Could not update policy \" Copy Of Write below binary dir \" "
78
77
exit 1
79
78
fi
80
79
81
80
# Delete the new policy.
82
- OUT=` $SCRIPTDIR /../examples/delete_policy.py --name " Copy Of My Rule " $PYTHON_SDC_TEST_API_TOKEN `
83
- if [[ $OUT != * " \" name\" : \" Copy Of My Rule \" " * ]]; then
84
- echo " Could not delete policy \" Copy Of My Rule \" "
81
+ OUT=` $SCRIPTDIR /../examples/delete_policy.py --name " Copy Of Write below binary dir " $PYTHON_SDC_TEST_API_TOKEN `
82
+ if [[ $OUT != * " \" name\" : \" Copy Of Write below binary dir \" " * ]]; then
83
+ echo " Could not delete policy \" Copy Of Write below binary dir \" "
85
84
exit 1
86
85
fi
87
86
88
87
OUT=` $SCRIPTDIR /../examples/list_policies.py $PYTHON_SDC_TEST_API_TOKEN `
89
- if [[ $OUT = * " \" name\" : \" Copy Of My Rule \" " * ]]; then
90
- echo " After deleting policy Copy Of My Rule , policy was still present?"
88
+ if [[ $OUT = * " \" name\" : \" Copy Of Write below binary dir \" " * ]]; then
89
+ echo " After deleting policy Copy Of Write below binary dir , policy was still present?"
91
90
exit 1
92
91
fi
93
92
94
93
# Make a copy again, but this time delete by id
95
- NEW_POLICY=` echo $MY_POLICY | sed -e " s/My Rule /Another Copy Of My Rule /g" | sed -e ' s/"id": [0-9]*,//' | sed -e ' s/"version": [0-9]*/"version": null/' `
94
+ NEW_POLICY=` echo $MY_POLICY | sed -e " s/Write below binary dir /Another Copy Of Write below binary dir /g" | sed -e ' s/"id": [0-9]*,//' | sed -e ' s/"version": [0-9]*/"version": null/' `
96
95
OUT=` echo $NEW_POLICY | $SCRIPTDIR /../examples/add_policy.py $PYTHON_SDC_TEST_API_TOKEN `
97
- if [[ $OUT != * " \" name\" : \" Another Copy Of My Rule \" " * ]]; then
96
+ if [[ $OUT != * " \" name\" : \" Another Copy Of Write below binary dir \" " * ]]; then
98
97
echo " Could not create new policy"
99
98
exit 1
100
99
fi
101
100
102
101
ID=` echo $OUT | grep -E -o ' "id": [^,]+,' | awk ' {print $2}' | awk -F, ' {print $1}' `
103
102
104
103
OUT=` $SCRIPTDIR /../examples/delete_policy.py --id $ID $PYTHON_SDC_TEST_API_TOKEN `
105
- if [[ $OUT != * " \" name\" : \" Another Copy Of My Rule \" " * ]]; then
106
- echo " Could not delete policy \" Copy Of My Rule \" "
104
+ if [[ $OUT != * " \" name\" : \" Another Copy Of Write below binary dir \" " * ]]; then
105
+ echo " Could not delete policy \" Copy Of Write below binary dir \" "
107
106
exit 1
108
107
fi
109
108
110
109
OUT=` $SCRIPTDIR /../examples/list_policies.py $PYTHON_SDC_TEST_API_TOKEN `
111
- if [[ $OUT = * " \" name\" : \" Another Copy Of My Rule \" " * ]]; then
112
- echo " After deleting policy Another Copy Of My Rule , policy was still present?"
110
+ if [[ $OUT = * " \" name\" : \" Another Copy Of Write below binary dir \" " * ]]; then
111
+ echo " After deleting policy Another Copy Of Write below binary dir , policy was still present?"
113
112
exit 1
114
113
fi
115
114
@@ -120,7 +119,7 @@ FOUND=0
120
119
121
120
for i in $( seq 10) ; do
122
121
sleep 10
123
- touch /tmp /some-file.txt
122
+ sudo touch /bin /some-file.txt
124
123
125
124
EVTS=` $SCRIPTDIR /../examples/get_secure_policy_events.py $PYTHON_SDC_TEST_API_TOKEN 60`
126
125
0 commit comments