libpriv: Rebuild policy during postprocessing#1754
libpriv: Rebuild policy during postprocessing#1754jlebon wants to merge 4 commits intocoreos:masterfrom
Conversation
It's possible for some postprocessing scripts to affect the final SELinux policy. This is the case for the new `/etc/default/useradd` edit we now do (coreos#1726), but it could've been the case beforehand too with user scripts modifying e.g. booleans (though ideally all these modifications would be part of RPMs). Do a final `semodule -nB` during postprocessing so that the final policy we commit is "up to date". Otherwise, users may only see changes take effect if they layer packages that trigger a rebuild. The motivation for this is specifically for `/etc/default/useradd`. There is magic in `selinux-policy` that parses the file and generates templated rules from the value of `HOME`. For more info, see: https://bugzilla.redhat.com/show_bug.cgi?id=1669982 https://src.fedoraproject.org/rpms/selinux-policy/pull-request/14
rfairley
left a comment
There was a problem hiding this comment.
LGTM - works on my end doing a compose.
|
Note: holding on merging this, awaiting confirmation in https://src.fedoraproject.org/rpms/selinux-policy/pull-request/14 |
|
So...sorry about delaying on this. Again my primary concern here is making sure we're not breaking anything in the version combination matrix. For example we believe this shouldn't cause any harm for e.g. RHEL7 systems with older selinux policy? |
|
For RHCOS & CAHC, we're shipping the latest rpm-ostree there, so it should also be affected by the |
Manually patch `file_contexts.subs_dist` so that `/home` is equivalent to `/var/home`. This is required now that the generated homedirs rules use `/var/home`. Otherwise, `matchpathcon` for example will return wrong results. This patch also includes the *removal* of `/var/home -> /home` so that we're not dependent on this selinux-policy patch making it at the same time as downstream: https://src.fedoraproject.org/rpms/selinux-policy/pull-request/14 (See the conversation there for more information.)
ae048c4 to
3a06cdc
Compare
|
OK, so testing this on the latest RHCOS. Because the compose wasn't done with v2019.1, it didn't have #1726 yet. So I started off with manually modifying this: I then triggered a policy regen by layering a pkg that does Removing the One thing I don't quite understand yet is that the |
|
https://src.fedoraproject.org/rpms/selinux-policy/pull-request/14 was merged! Let's get this one in and do a release? |
|
⚡ Test exempted: merge already tested. |
Manually patch `file_contexts.subs_dist` so that `/home` is equivalent to `/var/home`. This is required now that the generated homedirs rules use `/var/home`. Otherwise, `matchpathcon` for example will return wrong results. This patch also includes the *removal* of `/var/home -> /home` so that we're not dependent on this selinux-policy patch making it at the same time as downstream: https://src.fedoraproject.org/rpms/selinux-policy/pull-request/14 (See the conversation there for more information.) Closes: #1754 Approved by: cgwalters
Let's get the SELinux fix out (coreos#1754).
It's possible for some postprocessing scripts to affect the final
SELinux policy. This is the case for the new
/etc/default/useraddeditwe now do (#1726), but it could've been the case beforehand too with
user scripts modifying e.g. booleans (though ideally all these
modifications would be part of RPMs).
Do a final
semodule -nBduring postprocessing so that the final policywe commit is "up to date". Otherwise, users may only see changes take
effect if they layer packages that trigger a rebuild.
The motivation for this is specifically for
/etc/default/useradd.There is magic in
selinux-policythat parses the file and generatestemplated rules from the value of
HOME.For more info, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1669982
https://src.fedoraproject.org/rpms/selinux-policy/pull-request/14