-
Notifications
You must be signed in to change notification settings - Fork 362
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
policylibrary: consolidate privileges raising operations into privileges-raise.yaml single policy #1957
Conversation
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
2769e72
to
819c515
Compare
3b77982
to
3fff5d2
Compare
3fff5d2
to
a3aad8e
Compare
a3aad8e
to
0f74264
Compare
pkg/sensors/tracing/generickprobe.go
Outdated
@@ -1561,6 +1561,62 @@ func handleMsgGenericKprobe(m *api.MsgGenericKprobe, gk *genericKprobe, r *bytes | |||
} | |||
arg.Label = a.label | |||
unix.Args = append(unix.Args, arg) | |||
case gt.GenericKernelCap: | |||
var output uint64 | |||
var arg api.MsgGenericKprobeArgKernelCapType |
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.
the push 64-bit arg is a bit redundant it would be nice if we could extract that somehow to a helper. But I think the typing is a bit awkward in golang/here for that to work.
needs a rebase but otherwise lgtm. |
case kernel_cap_ty: | ||
case cap_inh_ty: | ||
case cap_prm_ty: | ||
case cap_eff_ty: |
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.
Why do we need a different type from the bpf side, can we just treat it as u64?
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.
But how we will be able to remap it into userspace to one of these?
"kernel_cap_arg": "00ff..."
"cap_effective_arg:" "00ff..."
so you pretty print which caps we are talking about effective, permitted etc
If there is a better solution I will convert to it
This adds 'privileges-raise' tracing policy that will include most operations that will raise privileges. We could rename privileges-setuid-root.yaml and add on top of it, but it seems there are users that started to reference and use that one, so let's be nice add new one to not break their links, also things are still in example directory. We definitly need a better plan in the future like how to organize tracing policies into directories and how to name the files. Signed-off-by: Djalal Harouni <[email protected]>
Signed-off-by: Djalal Harouni <[email protected]>
kernel_cap_t: default type in kernel for uint64 caps cap_inheritable: for inheritable capabilities cap_permitted: for permitted set cap_effective: for the current effective set. Signed-off-by: Djalal Harouni <[email protected]>
Internally kernel handles capabilities as uint64 in kernel_cap_t, so let's add the corresponding capabilities types in order to use them in calls like security_capset. The aim is to print the arguments in hex. Signed-off-by: Djalal Harouni <[email protected]>
Support kernel_cap_t uint64 capabilities. Usually these are the ones passed to capset() to security_capset(). Signed-off-by: Djalal Harouni <[email protected]>
Signed-off-by: Djalal Harouni <[email protected]>
Produced event: ... "function_name": "security_capset", "args": [ { "process_credentials_arg": { { "cap_effective_arg": "000001ffffffffff" }, { "cap_inheritable_arg": "0000000000000000" }, { "cap_permitted_arg": "000001ffffffffff" } ], "return": { "int_arg": 0 }, "action": "KPROBE_ACTION_POST", "policy_name": "privileges-raise", "return_action": "KPROBE_ACTION_POST", "message": "Process changed its capabilities using capset system call" Signed-off-by: Djalal Harouni <[email protected]>
Signed-off-by: Djalal Harouni <[email protected]>
0f74264
to
6b6b309
Compare
ci failure about validate crd is tracked here: #2063. The version is updated so merging. |
This adds kernel capability types (uint64) and consolidates some operations into single privileges-raise.yaml Tracing Policy.
Produced kprobe event:
For further details, please see patches. Doc use case will follow later.