-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to read rules files from directories (#348)
* Add ability to read rules files from directories When the argument to -r <path> or an entry in falco.yaml's rules_file list is a directory, read all files in the directory and add them to the rules file list. The files in the directory are sorted alphabetically before being added to the list. The installed falco adds directories /etc/falco/rules.available and /etc/falco/rules.d and moves /etc/falco/application_rules.yaml to /etc/falco/rules.available. /etc/falco/rules.d is empty, but the idea is that admins can symlink to /etc/falco/rules.available for applications they want to enable. This will make it easier to add application-specific rulesets that admins can opt-in to. * Unit test for reading rules from directory Copy the rules/trace file from the test multiple_rules to a new test rules_directory. The rules files are in rules/rules_dir/{000,001}*.yaml, and the test uses a rules_file argument of rules_dir. Ensure that the same events are detected.
- Loading branch information
Showing
9 changed files
with
132 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/etc/falco/falco.yaml | ||
/etc/falco/falco_rules.yaml | ||
/etc/falco/application_rules.yaml | ||
/etc/falco/rules.available/application_rules.yaml | ||
/etc/falco/falco_rules.local.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- list: cat_binaries | ||
items: [cat] | ||
|
||
- list: cat_capable_binaries | ||
items: [cat_binaries] | ||
|
||
- macro: is_cat | ||
condition: proc.name in (cat_capable_binaries) | ||
|
||
- rule: open_from_cat | ||
desc: A process named cat does an open | ||
condition: evt.type=open and is_cat | ||
output: "An open was seen (command=%proc.cmdline)" | ||
priority: WARNING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This ruleset depends on the is_cat macro defined in single_rule.yaml | ||
|
||
- rule: exec_from_cat | ||
desc: A process named cat does execve | ||
condition: evt.type=execve and is_cat | ||
output: "An exec was seen (command=%proc.cmdline)" | ||
priority: ERROR | ||
|
||
- rule: access_from_cat | ||
desc: A process named cat does an access | ||
condition: evt.type=access and is_cat | ||
output: "An access was seen (command=%proc.cmdline)" | ||
priority: INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters