-
Notifications
You must be signed in to change notification settings - Fork 237
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
[merged] Don't call capset() unless we need to #122
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fedora runs rpm-ostree (which uses bwrap) in systemd-nspawn (in mock via `--new-chroot`). nspawn by default installs a seccomp policy that denies `capset()`. This started failing with bubblewrap-0.1.4: https://pagure.io/releng/issue/6550 The process currently runs as *real* uid 0, outside of a user namespace. (It's honestly a bit nonsensical for nspawn to give a process `CAP_SYS_ADMIN` outside of a userns, but use seccomp to deny `capset()`, but let's leave that aside for now.) Due to the way this code was structured, we set `is_privileged = TRUE` simply because we have uid 0, even in the Fedora case where we *aren't* privileged. Fix this so we only set is_privileged if `uid != euid`, hence we won't try to gain/drop any capabilities, which fixes compatibility with what nspawn is doing. In theory of course we *could* drop privileges in a userns scenario, but we'd only be dropping privs in our userns...eh.
☀️ Test successful - status-redhatci |
rh-atomic-bot
changed the title
Don't call capset() unless we need to
[merged] Don't call capset() unless we need to
Dec 1, 2016
cgwalters
added a commit
to cgwalters/bubblewrap
that referenced
this pull request
Dec 5, 2016
containers#122 introduced a regression for the case of rpm-ostree running bubblewrap on CentOS 7. Previously the `is_privileged` variable captured whether or not our uid was 0, now it captures whether we're setuid. This bit of code enabled `--unshare-user` automatically if we're not privileged, but we suddenly started doing that for running as real uid 0 (CAP_SYS_ADMIN), which we don't want, since on CentOS/RHEL 7 today userns isn't even available to root without a module parameter and reboot. So, let's just do this only if not setuid *and* we're not uid 0 (really we should check "have CAP_SYS_ADMIN" but eh).
rh-atomic-bot
pushed a commit
that referenced
this pull request
Dec 5, 2016
#122 introduced a regression for the case of rpm-ostree running bubblewrap on CentOS 7. Previously the `is_privileged` variable captured whether or not our uid was 0, now it captures whether we're setuid. This bit of code enabled `--unshare-user` automatically if we're not privileged, but we suddenly started doing that for running as real uid 0 (CAP_SYS_ADMIN), which we don't want, since on CentOS/RHEL 7 today userns isn't even available to root without a module parameter and reboot. So, let's just do this only if not setuid *and* we're not uid 0 (really we should check "have CAP_SYS_ADMIN" but eh). Closes: #123 Approved by: alexlarsson
This was referenced Jun 30, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fedora runs rpm-ostree (which uses bwrap) in systemd-nspawn (in mock via
--new-chroot
). nspawn by default installs a seccomp policy thatdenies
capset()
.This started failing with bubblewrap-0.1.4:
https://pagure.io/releng/issue/6550
The process currently runs as real uid 0, outside of a user namespace.
(It's honestly a bit nonsensical for nspawn to give a process
CAP_SYS_ADMIN
outside of a userns, but use seccomp to deny
capset()
, but let's leavethat aside for now.)
Due to the way this code was structured, we set
is_privileged = TRUE
simply because we have uid 0, even in the Fedora case where we aren't
privileged.
Fix this so we only set is_privileged if
uid != euid
, hence wewon't try to gain/drop any capabilities, which fixes compatibility
with what nspawn is doing.
In theory of course we could drop privileges in a userns scenario,
but we'd only be dropping privs in our userns...eh.