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
Conversation
These are new failures due to Facter 4.1 and should be fixed in #8567. |
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`.
0f8b214
to
f62b162
Compare
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? |
@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. |
jenkins please test this on redhat8-64a |
There was a problem hiding this 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.
Thanks for the help guys! Nice to have a 4 year old bug out of the way 🎉 |
See #8537 for details. This supersedes that PR and targets 6.x.
Note
puppet/lib/puppet/util/filetype.rb
Line 131 in 67ad21b