-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Don't mount /dev/ inside privileged containers running systemd #15895
Don't mount /dev/ inside privileged containers running systemd #15895
Conversation
Please repush your PR. I added [NO NEW TESTS NEEDED] |
78d0925
to
af24c04
Compare
I have removed that and added a bats test, because my initial fix was actually broken (it got late yesterday…). |
67db995
to
cefd583
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.
Please squash your commits - no need for separate code + test commits. And please update your commit message to reflect the new state of the code. A few test suggestions inline.
Thank you, and thanks for contributing!
According to https://systemd.io/CONTAINER_INTERFACE/, systemd will try take control over /dev/ttyN if exported, which can cause conflicts with the host's tty in privileged containers. Thus we will not expose these to privileged containers in systemd mode, as this is a bad idea according to systemd's maintainers. Additionally, this commit adds a bats regression test to check that no /dev/ttyN are present in a privileged container in systemd mode This fixes containers#15878 Signed-off-by: Dan Čermák <[email protected]>
cefd583
to
5a2405a
Compare
@edsantiago Thanks for the review, I've squashed the commits and applied your suggested changes. |
|
||
if [[ $TTYs = "" ]]; then | ||
die "Did not find any /dev/ttyN devices on local host" | ||
else |
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.
It's a little bit confusing to use else
after die
, since by definition die
terminates execution... but not worth re-pushing for, especially given our flaky CI today. I'll fix it in one of my periodic cleanup PRs.
LGTM, but I'll let other more systemd-savvy team members give final approval. Thanks again!
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dcermak, edsantiago, mheon, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Followup to containers#15895: - add a normal-case test, to ensure that --privileged without systemd continues to pass through /dev/ttyN devices - explain why we die() if host has no ttyN devices - I find grep -vx slightly easier to read than sed backslash-slash - run cleanup with '-t 0', to shave ten seconds from CI run Signed-off-by: Ed Santiago <[email protected]>
According to https://systemd.io/CONTAINER_INTERFACE/, systemd will try take control over /dev/tty if exported, which can cause conflicts with the host's tty in privileged containers. Thus we will not expose these to privileged containers in systemd mode, as this is a bad idea according to systemd's maintainers.
This fixes #15878
Does this PR introduce a user-facing change?