mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-31 14:20:04 +00:00
Use better way to skip falco events (#356)
* Use better way to skip falco events Use the new method falco_consider() to determine which events to skip. This centralizes the logic in a single function. All events will still be considered if falco was run with -A. This depends on https://github.com/draios/sysdig/pull/1105. * Add ability to specify -A flag in tests test attribute all_events corresponds to the -A flag. Add for some tests that would normally refer to skipped events.
This commit is contained in:
@@ -31,6 +31,7 @@ class FalcoTest(Test):
|
||||
|
||||
self.json_output = self.params.get('json_output', '*', default=False)
|
||||
self.json_include_output_property = self.params.get('json_include_output_property', '*', default=True)
|
||||
self.all_events = self.params.get('all_events', '*', default=False)
|
||||
self.priority = self.params.get('priority', '*', default='debug')
|
||||
self.rules_file = self.params.get('rules_file', '*', default=os.path.join(self.basedir, '../rules/falco_rules.yaml'))
|
||||
|
||||
@@ -365,6 +366,9 @@ class FalcoTest(Test):
|
||||
if self.run_duration:
|
||||
cmd += ' -M {}'.format(self.run_duration)
|
||||
|
||||
if self.all_events:
|
||||
cmd += ' -A'
|
||||
|
||||
self.falco_proc = process.SubProcess(cmd)
|
||||
|
||||
res = self.falco_proc.run(timeout=180, sig=9)
|
||||
|
@@ -128,6 +128,7 @@ trace_files: !mux
|
||||
- rules/single_rule.yaml
|
||||
- rules/double_rule.yaml
|
||||
trace_file: trace_files/cat_write.scap
|
||||
all_events: True
|
||||
|
||||
rules_directory:
|
||||
detect: True
|
||||
@@ -138,6 +139,7 @@ trace_files: !mux
|
||||
rules_file:
|
||||
- rules/rules_dir
|
||||
trace_file: trace_files/cat_write.scap
|
||||
all_events: True
|
||||
|
||||
multiple_rules_suppress_info:
|
||||
detect: True
|
||||
@@ -153,6 +155,7 @@ trace_files: !mux
|
||||
- rules/single_rule.yaml
|
||||
- rules/double_rule.yaml
|
||||
trace_file: trace_files/cat_write.scap
|
||||
all_events: True
|
||||
|
||||
multiple_rules_overriding:
|
||||
detect: False
|
||||
@@ -699,6 +702,7 @@ trace_files: !mux
|
||||
- detect_madvise: 2
|
||||
- detect_open: 2
|
||||
trace_file: trace_files/syscall.scap
|
||||
all_events: True
|
||||
|
||||
catchall_order:
|
||||
detect: True
|
||||
|
@@ -151,7 +151,8 @@ uint64_t do_inspect(falco_engine *engine,
|
||||
falco_outputs *outputs,
|
||||
sinsp* inspector,
|
||||
uint64_t duration_to_tot_ns,
|
||||
string &stats_filename)
|
||||
string &stats_filename,
|
||||
bool all_events)
|
||||
{
|
||||
uint64_t num_evts = 0;
|
||||
int32_t res;
|
||||
@@ -218,8 +219,7 @@ uint64_t do_inspect(falco_engine *engine,
|
||||
}
|
||||
}
|
||||
|
||||
if(!inspector->is_debug_enabled() &&
|
||||
ev->get_category() & EC_INTERNAL)
|
||||
if(!ev->falco_consider() && !all_events)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -761,7 +761,8 @@ int falco_init(int argc, char **argv)
|
||||
outputs,
|
||||
inspector,
|
||||
uint64_t(duration_to_tot*ONE_SECOND_IN_NS),
|
||||
stats_filename);
|
||||
stats_filename,
|
||||
all_events);
|
||||
|
||||
duration = ((double)clock()) / CLOCKS_PER_SEC - duration;
|
||||
|
||||
|
Reference in New Issue
Block a user