mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-13 06:24:29 +00:00
commit
240a8ffffa
@ -579,3 +579,23 @@ trace_files: !mux
|
|||||||
- open_11: 1
|
- open_11: 1
|
||||||
- open_12: 0
|
- open_12: 0
|
||||||
- open_13: 0
|
- open_13: 0
|
||||||
|
|
||||||
|
list_append_failure:
|
||||||
|
exit_status: 1
|
||||||
|
stderr_contains: "List my_list has 'append' key but no list by that name already exists. Exiting"
|
||||||
|
rules_file:
|
||||||
|
- rules/list_append_failure.yaml
|
||||||
|
trace_file: trace_files/cat_write.scap
|
||||||
|
|
||||||
|
list_append:
|
||||||
|
detect: True
|
||||||
|
detect_level: WARNING
|
||||||
|
rules_file:
|
||||||
|
- rules/list_append.yaml
|
||||||
|
trace_file: trace_files/cat_write.scap
|
||||||
|
|
||||||
|
list_append_false:
|
||||||
|
detect: False
|
||||||
|
rules_file:
|
||||||
|
- rules/list_append_false.yaml
|
||||||
|
trace_file: trace_files/cat_write.scap
|
||||||
|
12
test/rules/list_append.yaml
Normal file
12
test/rules/list_append.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
- list: my_list
|
||||||
|
items: [not-cat]
|
||||||
|
|
||||||
|
- list: my_list
|
||||||
|
append: true
|
||||||
|
items: [cat]
|
||||||
|
|
||||||
|
- rule: Open From Cat
|
||||||
|
desc: A process named cat does an open
|
||||||
|
condition: evt.type=open and proc.name in (my_list)
|
||||||
|
output: "An open was seen (command=%proc.cmdline)"
|
||||||
|
priority: WARNING
|
3
test/rules/list_append_failure.yaml
Normal file
3
test/rules/list_append_failure.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
- list: my_list
|
||||||
|
items: [not-cat]
|
||||||
|
append: true
|
12
test/rules/list_append_false.yaml
Normal file
12
test/rules/list_append_false.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
- list: my_list
|
||||||
|
items: [cat]
|
||||||
|
|
||||||
|
- list: my_list
|
||||||
|
append: false
|
||||||
|
items: [not-cat]
|
||||||
|
|
||||||
|
- rule: Open From Cat
|
||||||
|
desc: A process named cat does an open
|
||||||
|
condition: evt.type=open and proc.name in (my_list)
|
||||||
|
output: "An open was seen (command=%proc.cmdline)"
|
||||||
|
priority: WARNING
|
@ -222,7 +222,24 @@ function load_rules(rules_content, rules_mgr, verbose, all_events, extra, replac
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
state.lists_by_name[v['list']] = v
|
-- Possibly append to an existing list
|
||||||
|
append = false
|
||||||
|
|
||||||
|
if v['append'] then
|
||||||
|
append = v['append']
|
||||||
|
end
|
||||||
|
|
||||||
|
if append then
|
||||||
|
if state.lists_by_name[v['list']] == nil then
|
||||||
|
error ("List " ..v['list'].. " has 'append' key but no list by that name already exists")
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, elem in ipairs(v['items']) do
|
||||||
|
table.insert(state.lists_by_name[v['list']]['items'], elem)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
state.lists_by_name[v['list']] = v
|
||||||
|
end
|
||||||
|
|
||||||
elseif (v['rule']) then
|
elseif (v['rule']) then
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user