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

gpg: Check is_selinux_enabled() before trying to label #313

Merged

Conversation

cgwalters
Copy link
Contributor

The default for container execution is that /sys/fs/selinux is not mounted, and the libselinux library function is_selinux_enabled should be used to dynamically check if the system should attempt to perform SELinux labeling.

This is how it's done by rpm, ostree, and systemd for example.

But this code unconditionally tries to label if it finds a policy, which breaks in an obscure corner case
when executed inside a container when we're not using overlayfs for the backend.

The default for container execution is that `/sys/fs/selinux`
is not mounted, and the libselinux library function
`is_selinux_enabled` should be used to dynamically check
if the system should attempt to perform SELinux labeling.

This is how it's done by rpm, ostree, and systemd for example.

But this code unconditionally tries to label if it finds
a policy, which breaks in an obscure corner case
when executed inside a container when we're not using
overlayfs for the backend.
@cgwalters
Copy link
Contributor Author

Corresponding libdnf PR rpm-software-management/libdnf#1665

@ppisar ppisar self-assigned this Jul 11, 2024
Copy link
Contributor

@ppisar ppisar left a comment

Choose a reason for hiding this comment

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

Good.

@ppisar ppisar merged commit cdfdbb6 into rpm-software-management:master Jul 11, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants