-
Notifications
You must be signed in to change notification settings - Fork 450
feat: extend string data filtering to LSM related events #4590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: extend string data filtering to LSM related events #4590
Conversation
d9b223e
to
4b175f1
Compare
cacfb19
to
da57dc6
Compare
1ebaa4e
to
d79bf0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Put some words.
8e812f8
to
28517c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Put some doubts.
28517c5
to
650b6b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the PR would benefit from integrating the kernel filtering setting into the event definition. On the rest I trust @geyslan's review.
@@ -61,6 +72,35 @@ func NewDataFilter() *DataFilter { | |||
} | |||
} | |||
|
|||
// list of events and field names allowed to have in-kernel filter | |||
var allowedKernelField = map[events.ID]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this fit in the event definition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @NDStrahilevitz ...I've created this just to have a simple way to enable data filtering for events that have string filters in this phase. The next phase (phase 3) will implement filtering for other types of events. So, the idea is to remove this temporary table and use the event definition as you mentioned. However, to reach this step, I'll need to design a solution to accommodate all types of string filters.
- Allow any field name in the in-kernel string filter. - Currently, only one string-type field name is supported. - Future support for multiple field names is planned. - Start with LSM related events.
- Only for LSM related events.
650b6b9
to
cdc67a6
Compare
- Add external scripts to be triggered in order to test data filter related to events that uses LSM.
- Since we have added integration tests and the default Go test timeout is 10 minutes, we need to increase it otherwise it get panic.
cdc67a6
to
1591fd0
Compare
1. Explain what the PR does
1591fd0 chore: install deps
3eae8ff fix: increase timeout for go test
8e8ec5f test: external triggers for integration
6e2f4f1 feat(ebpf): extend string data filtering for LSM events
5a22b36 feat: allow different field names
3eae8ff fix: increase timeout for go test
8e8ec5f test: external triggers for integration
6e2f4f1 feat(ebpf): extend string data filtering for LSM events
5a22b36 feat: allow different field names
2. Explain how to test it
3. Other comments
This PR focuses only on LSM hooks and the related tests. Some tests were added to the integration test suite with external C program triggers.
part of #4432
pathname
5
pathname
1
(already present)pathname
3
path
6
map_name
9
pathname
4
file_name
7
pathname
4
linkpath
3
pathname
2
(already present)pathname
5
old_path
3
name
9
pathname
8
pathname
5
comm: event: data: trace event security_file_open set in multiple policies using multiple filter types
comm: event: data: trace event security_mmap_file using multiple filter types
event: data: trace event security_inode_symlink, security_inode_rename and security_inode_unlink using data filter
event: data: trace event security_kernel_read_file and security_kernel_post_read_file using data filter
comm: event: data: trace event shared_object_loaded, security_file_mprotect and security_bprm_check using data filter
event: data: trace event security_sb_mount using data filter
event: data: trace event security_inode_mknod using data filter
event: data: trace event security_path_notify using data filter
event: data: trace event security_bpf_prog and security_bpf_map using data filter