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

(PUP-7559) Pass correct mode when lookup SELinux default context #8570

Merged
merged 2 commits into from Apr 22, 2021

Conversation

joshcooper
Copy link
Contributor

See #8537 for details. This supersedes that PR and targets 6.x.

Note

set_selinux_default_context(@path)
is unchanged because in that case we've already written the file prior to retrieving its selinux context.

@joshcooper
Copy link
Contributor Author

These are new failures due to Facter 4.1 and should be fixed in #8567.

tobias-urdin and others added 2 commits April 14, 2021 16:27
Originally when the file did not exist we simply passed the
mode as zero causing the file type bits not to be set which
means matchpatchcon(3) won't lookup the type based on the
correct type.

This changes so that we set the file type bits in the mode_t
passed down to the SELinux libraries based on the resource
ensure set to present, file, directory or link on the File
resource.

This fixes [1] and can be observed for SELinux file contexts
that modifies files in top directory but only for symlinks for
example this [2] httpd file context change.

The patch is backward compatible and does not break the API
for the methods in the Puppet::Util::SELinux module.

[1] https://tickets.puppetlabs.com/browse/PUP-7559
[2] fedora-selinux/selinux-policy-contrib@43318bf
Puppet uses symbols to represent the desired ensure parameter, so just use
that. Also eliminated the `when` block for `absent`.
@joshcooper joshcooper added the blocked PRs blocked on work external to the PR itself label Apr 14, 2021
@tobias-urdin
Copy link
Contributor

Thanks @joshcooper - much cleaner with symbols as well. Does the retargeting mean this will only get into 6.x or into 7.x as well?

@joshcooper
Copy link
Contributor Author

@tobias-urdin ah sorry, I should have mentioned, we automatically merge from 6.x to main (7.x) so this will be released in both streams.

@joshcooper
Copy link
Contributor Author

jenkins please test this on redhat8-64a

@joshcooper joshcooper removed the blocked PRs blocked on work external to the PR itself label Apr 15, 2021
Copy link
Contributor

@GabrielNagy GabrielNagy left a comment

Choose a reason for hiding this comment

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

Looks good! Tested this on a VM with selinux enabled and confirmed applying the original manifest from the ticket is idempotent with this fix.

Thanks again @tobias-urdin and sorry for the long turnaround on this.

@GabrielNagy GabrielNagy merged commit e1982d6 into puppetlabs:6.x Apr 22, 2021
@joshcooper joshcooper deleted the selinux_7559 branch April 22, 2021 22:59
@tobias-urdin
Copy link
Contributor

Thanks for the help guys! Nice to have a 4 year old bug out of the way 🎉

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.

None yet

3 participants