-
Notifications
You must be signed in to change notification settings - Fork 99
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
Check if required capabilities are available #1067
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1067 +/- ##
==========================================
- Coverage 81.90% 81.85% -0.06%
==========================================
Files 139 140 +1
Lines 11329 11407 +78
==========================================
+ Hits 9279 9337 +58
- Misses 1534 1547 +13
- Partials 516 523 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
da9e717
to
ed1cf1a
Compare
1c55041
to
85011b5
Compare
85011b5
to
a52bad6
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.
Thanks for the PR! The code looks good (I have few minor suggestions) but I have some questions:
-
I'd say that the required capabilities for Network metrics are lower than the capabilities for Application metrics (at least when using the Traffic Control Network probes). We should allow users to specify the minimum capabilities to their specific use case.
-
I observed that some environments (e.g. virtual machine with Kind) require also the CAP_SYS_ADMIN capabilities. Don't know why and how to check it programmatically. I guess it's fine if we don't demand CAP_SYS_ADMIN but Beyla fails later.
cecfc2e
to
d5b24aa
Compare
0e5843a
to
973b307
Compare
Check whether the required capabilities are available upon starting up, and bail early with a friendly message otherwise.
973b307
to
fc144e0
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! Good job.
I left some minor comments but you can just ignore them, or address them but you don't need to wait for a reapproval.
f66bfb4
to
efd9f08
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.
Left a comment with suggested copy change.
This patch checks if the required Linux capabilities for beyla are present, based on the present configuration (e.g. NetO11y does not require all of the listed capabilities below).
These are:
CAP_BPF
CAP_PERFMON
CAP_DAC_READ_SEARCH
CAP_SYS_RESOURCE
CAP_CHECKPOINT_RESTORE
CAP_SYS_PTRACE
CAP_NET_RAW
(see here for more info)
It also introduces a new config option called
enforce_sys_caps
, defaulted totrue
. When that option is set to true, Beyla will not continue starting up if the required capabilities are not present and print the list of missing capabilities. Otherwise, startup will continue and the missing capabilities will be listed as a warning (allowing for easy backwards compatibility).In addition to the capabilities listed above, Beyla startup will now check for the presence of
CAP_SYS_ADMIN
. This capability is required when mounting the bpf filesystem and for the context propagation functionality(*). When this capability isn't present, Beyla will error gracefully in the former case, whereas it will disable the context propagation probes and resume starting up on the latter.(*)
kernel_probe_write_user()
, which is used to inject context data, requires this capability.Resolves: #246