-
Notifications
You must be signed in to change notification settings - Fork 919
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
Unable to run in eBPF least-privileged mode on COS #1299
Comments
I see we are lacking some documentation on how to use the eBPF probe in the running section of the docs , thanks for calling that out @dinvlad I think that the best thing we can do here is to use docker run --privileged -v $HOME/.falco:/root/.falco --rm -i -t --pid=host -v /var/run/docker.sock:/var/run/docker.sock -e FALCO_BPF_PROBE="" falcosecurity/falco-no-driver:latest Please note that:
Let me explain why: Starting from the error you posted docker run -v $HOME/.falco:/root/.falco --rm -i -t --cap-add SYS_RESOURCE --cap-add SYS_PTRACE --pid=host -v /var/run/docker.sock:/var/run/docker.sock -e FALCO_BPF_PROBE="" falcosecurity/falco-no-driver:latest Output: 2020-07-03T09:16:15+0000: Falco initialized with configuration file /etc/falco/falco.yaml
2020-07-03T09:16:15+0000: Loading rules from file /etc/falco/falco_rules.yaml:
2020-07-03T09:16:15+0000: Loading rules from file /etc/falco/falco_rules.local.yaml:
2020-07-03T09:16:16+0000: Loading rules from file /etc/falco/k8s_audit_rules.yaml:
2020-07-03T09:16:16+0000: Unable to load the driver. Exiting.
2020-07-03T09:16:16+0000: Runtime error: can't create map: Errno 1. Exiting. Look! It went ahead, but still Falco can't start. This is because at this point we are here and we want todo static int bpf_map_create(enum bpf_map_type map_type,
int key_size, int value_size, int max_entries,
uint32_t map_flags)
{
union bpf_attr attr;
bzero(&attr, sizeof(attr));
attr.map_type = map_type;
attr.key_size = key_size;
attr.value_size = value_size;
attr.max_entries = max_entries;
attr.map_flags = map_flags;
return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
} This means that after some initialization YAY! We can go ahead and say, why don't we just add a capability to do bpf operations at this point? Something like This means that since we don't have the capability (yet) to for this kind of operations the only way to do them is being root. So, here is why we need Hope this helps! I did spent some time putting this together, if anyone is interested there's a very good opportunity to become a contributor by sending a PR to our website's running.md containing the explainations here. |
So the summary is that you need a kernel with CAP_BPF (and CAP_PERFMON) to make it work in the least-privileged mode. Thanks to @fntlnz for clarifying it and sending updates to the docs. /close |
@leodido: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@fntlnz I've finally tried the command
however this is what I see on
|
So looks like if we're
However, there are 2 general problems with it:
Do you think there're fixes/workarounds for these issues? I'd imagine (1) is just a matter of pre-building a kernel module for COS on your side, but (2) - is that a dead end? Thanks a lot for any help! |
OK, I missed the earlier option from the original post (hard to remember all of these nuances..), but here's the combination that worked in a "bare-bones" COS (without Google Life Sciences API):
So now, coming back to question 2 above, do you think it's possible:
|
I think we may have to just wait until Kernel 5.8+ for Container OS + support for passing capabilities and mounting Docker socket by Life Sciences API. Could you confirm this would then be the right command to use:
Particularly, would |
Describe the bug
When we attempt to run Falco in least-privileged mode on COS with
eBPF
enabled according to the official instructions (https://falco.org/docs/running/#docker-least-privileged), it fails.How to reproduce it
This step succeeds, with the build log as follows:
This step fails:
It error says something about
setrlimit
, but not sure what that means. And we're running on stock COS stable image, without any other modifications on the host.Expected behaviour
Falco is able to run.
Screenshots
Environment
From
docker run --rm -it falcosecurity/falco-no-driver falco --version
:{"machine":"x86_64","nodename":"xxxxxx","release":"4.19.112+","sysname":"Linux","version":"#1 SMP Sat Jun 13 11:04:33 PDT 2020"}
n1-standard-1
instance.Docker, as described in steps 1-2 above.
Additional context
The same works in
eBPF
privileged mode, however:Also, doing this without
eBPF
(privileged or not) hits another bug (#1239)The text was updated successfully, but these errors were encountered: