Skip to content

Commit

Permalink
Use falcoctl 0.0.4+ tests for space/dash psp names
Browse files Browse the repository at this point in the history
Use falcoctl, which properly handles psp names containing
spaces/dashes. Also add tests that verify that the resulting rules are
valid.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
  • Loading branch information
mstemm committed Oct 24, 2019
1 parent 5c61276 commit b18050d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/falco_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def setUp(self):
self.falcodir = self.params.get('falcodir', '/', default=build_dir)

self.psp_conv_path = os.path.join(build_dir, "falcoctl")
self.psp_conv_url = "https://github.com/falcosecurity/falcoctl/releases/download/v0.0.3/falcoctl-0.0.3-linux-amd64"
self.psp_conv_url = "https://github.com/falcosecurity/falcoctl/releases/download/v0.0.4/falcoctl-0.0.4-linux-amd64"

self.stdout_is = self.params.get('stdout_is', '*', default='')
self.stderr_is = self.params.get('stderr_is', '*', default='')
Expand Down
22 changes: 21 additions & 1 deletion test/falco_tests_psp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -643,4 +643,24 @@ trace_files: !mux
rules_file: []
conf_file: confs/psp.yaml
psp_file: psps/allowed_proc_mount_types.yaml
trace_file: trace_files/psp/proc_mount_type_default.json
trace_file: trace_files/psp/proc_mount_type_default.json

psp_name_with_dashes:
detect: True
detect_level: WARNING
detect_counts:
- "PSP no_privileged Violation (privileged) System Activity": 1
rules_file: []
conf_file: confs/psp.yaml
psp_file: psps/privileged_name_with_dashes.yaml
trace_file: trace_files/psp/privileged.scap

psp_name_with_spaces:
detect: True
detect_level: WARNING
detect_counts:
- "PSP no_privileged Violation (privileged) System Activity": 1
rules_file: []
conf_file: confs/psp.yaml
psp_file: psps/privileged_name_with_spaces.yaml
trace_file: trace_files/psp/privileged.scap
8 changes: 8 additions & 0 deletions test/psps/privileged_name_with_dashes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
annotations:
falco-rules-psp-images: "[nginx]"
name: no-privileged
spec:
privileged: false
8 changes: 8 additions & 0 deletions test/psps/privileged_name_with_spaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
annotations:
falco-rules-psp-images: "[nginx]"
name: no privileged
spec:
privileged: false

0 comments on commit b18050d

Please sign in to comment.