-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
BREAKING: Add selinux_fcontext and selinux_fcontext_equivalence types #177
Conversation
6b47f6b
to
4cf32eb
Compare
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.
- I agree with you that fcontext and fcontext_equivalence are dedicated things.
- I also would prefer to split out equivalence to a dedicated defined type and introduce a breaking change. We're not yet 1.0.0 and for 1.0.0 we should have something that will work for a longer time.
- EL6 support is needed (and IMHO even EL5, but maybe makes no difference)
lib/puppet/type/selinux_fcontext.rb
Outdated
isrequired | ||
end | ||
|
||
newproperty(:context) do |
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.
same as with the selinux_port type. context is the combination of user:role:type:range https://selinuxproject.org/page/BasicConcepts
prior art in naming the selinux parameters see the puppet file type: https://docs.puppet.com/puppet/latest/type.html#file
manifests/fcontext.pp
Outdated
Optional[String] $user = undef, | ||
Optional[String] $filemode = 'a', | ||
Boolean $equals = false, | ||
Boolean $restorecond = true, |
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.
If we are already changing things, restorcond
with d referes to the daemon. the utility is only called restorecon
. The parameter only runs restorcon
and does nothing with restorcond
.
defaultfor kernel: 'Linux' | ||
|
||
commands semanage: 'semanage' | ||
confine selinux: true |
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.
Leave a comment why selinux: true is used?
If we're really breaking APIs I might like to do away with the restorecon parameters in fcontext entirely and provide a separate helper define for restorecon execs. The API as it is is rather clunky. |
will fix tests tomorrow |
Am 16.01.2017 um 19:03 schrieb Jarkko Oranen:
will fix tests tomorrow
no need to hurry . discussed on IRC about pushing a 1.0.0 version with
the current master and then going to 2.0.0 with all these changes. so a
user has a clear indication that that something will break instead of
pushing 0.8.0 -> 1.0.0 and everything will break.
thanks alot for your effort!
|
1cf9d7c
to
d988150
Compare
Latest commit attempts to restore support for old semanage. The proper way would probably be to have a custom fact query the package version, but explicit checking for RedHat <7 will probably do for most cases. |
f2d70c8
to
996304c
Compare
I don't know how to stub facter properly. I have no idea if the cause for the errors is in the spec or in the provider :/ |
286e6c3
to
09225ba
Compare
I gave up on trying to get the RHEL6 specs to work, so currently the spec is actually wrong for RHEL5 and 6. It looks like the test harness just ignores facts for some reason, or maybe they are evaluated before Facter is mocked. Either way, I don't know how to fix it and my patience has been used up. The code itself works when I tested it, so as long as I write some acceptance tests it should be fine. |
Currently working on extending the acceptance tests. I also simplified the fcontext and equivalence defines and removed the built-in restorecon support. I may add restorecon back at some point. There's something weird going on with the file resource, as the files do not get created with the correct equivalences, and even though I set it up to run restorecon the contexts are still wrong until the second run... |
09225ba
to
88e249c
Compare
Acceptance test manifest passed on CentOS6 |
CentOS7 was fine too |
88e249c
to
510ab20
Compare
87bd168
to
27e2e7b
Compare
hm, now I wonder how to get the tests to pass considering the provider requires the selinux module which is not available. For the testing it is enough to mock the existence of the module, but the provider still does EDIT: hm, looks like I don't need to explicitly require the selinux module for it to work. I guess Puppet does that for me. |
2188e14
to
2464ee5
Compare
seems like the file_context.local is not present with a default install:
seen with centos-7-x64 (7.3), centos-6-64 (centos project upstream vagrant boxes) |
merged your change of yesterday, centos-6 now complains about file_contexts.subs:
|
with this patch it works for me:
|
156f921
to
13ed94c
Compare
I implemented a slightly different version of the same patch along with spec tests and rebased |
13ed94c
to
89172d1
Compare
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.
successfully ran acceptance tests on centos 6, centos 7, fedora 24 and fedora 25.
Add selinux_fcontext and selinux_fcontext_equivalence types
Add selinux_fcontext and selinux_fcontext_equivalence types
Based on my port type, here's a pull request for fcontexts, up for review and comments.
It seemed easier to separate the equivalences from the other kind of fcontext. It might make sense to separate the defines too (ie. selinux::fcontext and selinux::fcontext::equivalence) depending on how much of the API it is okay to break.
As of the creation of this pull request, this branch breaks support for systems with old semanage versions (ie. rhel6 and older) because the accepted syntax is different. It's probably possible to subclass the provider and override the affected methods.