Skip to content

Support label_users in buildah #6161

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
merged 1 commit into from
May 6, 2025

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented May 6, 2025

Fixes: #6160

label_users tells buildah and podman to maintain the user and role from the SELinux label, the default is to change the user and role to system_u:system_r.

With this change we end up with an unconfined_u user running the container as unconfined_u:unconfined_r.

I don't believe our CI/CD system can test this, because it runs with system_u:system_r by default.

What type of PR is this?

/kind api-change
/kind bug
/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake
/kind other

What this PR does / why we need it:

How to verify it

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

buildah build now supports label_users from containers.conf

Fixes: containers#6160

label_users tells buildah and podman to maintain the user and role
from the SELinux label, the default is to change the user and role to
system_u:system_r.

With this change we end up with an unconfined_u user running the
container as unconfined_u:unconfined_r.

I don't believe our CI/CD system can test this, because it runs with
system_u:system_r by default.

Signed-off-by: Daniel J Walsh <[email protected]>
@rhatdan rhatdan added the No New Tests Allow PR to proceed without adding regression tests label May 6, 2025
@openshift-ci openshift-ci bot added the approved label May 6, 2025
@rhatdan
Copy link
Member Author

rhatdan commented May 6, 2025

Code was taken from podman, might want to eventually move to common.

Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@rhatdan
Copy link
Member Author

rhatdan commented May 6, 2025

@nalind @flouthoc PTAL

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM, missing release notes.

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented May 6, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, giuseppe, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhatdan rhatdan added the lgtm label May 6, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit cd2bb61 into containers:main May 6, 2025
32 of 37 checks passed
}
con, err := selinux.NewContext(label)
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

This really should have been wrapped with more context somewhere in the call stack - the only error this can return just says "invalid label".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm No New Tests Allow PR to proceed without adding regression tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

containers.label_users is ignored by podman build
4 participants