-
Notifications
You must be signed in to change notification settings - Fork 851
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
Introduce privileged-mode #9017
base: master
Are you sure you want to change the base?
Conversation
8e132bc
to
3ff81c9
Compare
Thanks for the PR! Will review it soon (hopefully) |
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.
There's some confusing operator UX with this PR. You mention this adds a --privileged-mode
flag, but it actually adds two flags: --containerd-privileged-mode
and --baggageclaim-privileged-mode
.
I can see that the value passed into --containerd-privileged-mode
gets passed into baggageclaim. Could we consolidate to only exposing the --containerd-privileged-mode
flag instead? It also means less flags to add to the chart and bosh deployment. This feature only makes sense for the containerd runtime, correct?
It is only usable with containerd at the moment anyway; it would take further investigation (and possibly different options) for different backends, so limiting it to containerd makes sense.
The argument is used as a way to let the baggageclaim runner know the privileged mode. Perhaps the best solution is to pass that as a Go argument to BaggageClaimCommand.Runner instead of making it part of the structure - that would then eliminate the need for making it part of the command structure, and hence a flag. If other backends start supporting a similar mode in the future, potentially the logic could then be extended to make baggageclaim do the right thing for all of them. |
The privileged-mode setting lets admins decide what level of privilege tasks running as privileged should have. This gives the ability to lock down privileged access to a level that isn't equivalent to full root on the host. There are three proposed levels: full, the status quo. This has multiple vectors to take over the host, including by loading modules into the kernel. fuse-only, enough to work with containers using tools like buildah and podman if they are configured appropriately. As long as the Concourse worker is run in a user namespace on an up-to-date Linux kernel, this shouldn't be enough access to escape the container. ignore - privileged tasks have the same access as normal tasks. To get podman and buildah working, a few more syscalls need to be allowed through seccomp. A few harmless ones have been added to the general allow list, while others related to mounting and unsharing are only added for fuse-only mode. Signed-off-by: Andrew Miller <[email protected]>
Signed-off-by: Andrew Miller <[email protected]>
3ff81c9
to
317b539
Compare
I have now updated the PR to not use the extra argument in the baggageclaim command structure, and instead just pass it using Go arguments @taylorsilva. |
317b539
to
c91138c
Compare
argument. Signed-off-by: Andrew Miller <[email protected]>
c91138c
to
012b4c4
Compare
The privileged-mode setting lets admins decide what level of privilege tasks running as privileged should have. This gives the ability to lock down privileged access to a level that isn't equivalent to full root on the host.
There are three proposed levels:
full, the status quo. This has multiple vectors to take over the host, including by loading modules into the kernel.
fuse-only, enough to work with containers using tools like buildah and podman if they are configured appropriately. As long as the Concourse worker is run in a user namespace on an up-to-date Linux kernel, this shouldn't be enough access to escape the container. ignore - privileged tasks have the same access as normal tasks.
To get podman and buildah working, a few more syscalls need to be allowed through seccomp. A few harmless ones have been added to the general allow list, while others related to mounting and unsharing are only added for fuse-only mode.
Changes proposed by this PR
Notes to reviewer
This pipeline is helpful for manual testing:
Release Note
--privileged-mode
option to the worker, which acceptsfull
(default, previous behaviour),fuse-only
(privileged: true tasks can use tools like buildah and podman, but can't escape if user namespaces are used to run the worker),ignore
(privileged: true tasks have no extra access compared to privileged: false tasks)