Skip to content
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

rootless: require subids to be present #1097

Closed

Conversation

giuseppe
Copy link
Member

Most images won't work without multiple ids/gids. Error out
immediately if there are no multiple ids available.

The error code when the user is not present in /etc/sub{g,u}ids looks
like:

$ bin/podman run --rm -ti alpine echo hello
ERRO[0000] No subuid ranges found for user "gscrivano"

Closes: #1087

Signed-off-by: Giuseppe Scrivano [email protected]

Most images won't work without multiple ids/gids.  Error out
immediately if there are no multiple ids available.

The error code when the user is not present in /etc/sub{g,u}id looks
like:

$ bin/podman run --rm -ti alpine echo hello
ERRO[0000] No subuid ranges found for user "gscrivano"

Closes: containers#1087

Signed-off-by: Giuseppe Scrivano <[email protected]>
@giuseppe giuseppe force-pushed the fix-multiple-uids-gids-rootless branch from 8bddbcf to 6bfa834 Compare July 16, 2018 08:15
@@ -104,6 +104,9 @@ func BecomeRootInUserNS() (bool, int, error) {
var uids, gids []idtools.IDMap
username := os.Getenv("USER")
mappings, err := idtools.NewIDMappings(username, username)
if err != nil && os.Getenv("PODMAN_ALLOW_SINGLE_ID_MAPPING_IN_USERNS") == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would be nice if the env var was documented (if you mean to support it, if not, feel free to ignore this comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah no, this is a hack just to make the CI happy with a single user. We will need to test the multiple uids/gids feature probably not as part of the integration tests

Copy link
Contributor

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rhatdan
Copy link
Member

rhatdan commented Jul 16, 2018

If podman knows that it is running as non root, can it look for the current UID of the user in /etc/subuid and /etc/subgid, and report the problem if they don't exist.

grep dwalsh /etc/subuid || echo "This will not work"

@mheon
Copy link
Member

mheon commented Jul 16, 2018

LGTM

@giuseppe
Copy link
Member Author

If podman knows that it is running as non root, can it look for the current UID of the user in /etc/subuid and /etc/subgid, and report the problem if they don't exist.

grep dwalsh /etc/subuid || echo "This will not work"

yes, this is what we currently do, before we re-exec into the user namespace we retrieve the subuids/subgids for the user. Before we didn't raise an error to accomodate the CI, but this PR changes it to be an error (something like "ERRO[0000] No subuid ranges found for user "gscrivano"), the env variable that allows a single user to be mapped inside the container is used and should be used only by the CI.

@rhatdan
Copy link
Member

rhatdan commented Jul 16, 2018

Ok thanks for the explanation.
@rh-atomic-bot r+

@rh-atomic-bot
Copy link
Collaborator

📌 Commit 6bfa834 has been approved by rhatdan

@rh-atomic-bot
Copy link
Collaborator

⚡ Test exempted: pull fully rebased and already tested.

@giuseppe giuseppe deleted the fix-multiple-uids-gids-rootless branch February 26, 2019 10:30
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants