With the help of @jlebon, I figured out that I had a modified SELinux policy on my host and it appears it was the source of these kinds of SELinux denials (as well as other denials I had seen).
You can see if you are in a similar situation by examining the config-diff
on your host to see if your policy has been modified. For example, mine looked like:
$ sudo ostree admin config-diff | grep policy
M selinux/targeted/active/policy.linked
M selinux/targeted/active/policy.kern
M selinux/targeted/policy/policy.31
A selinux/targeted/policy/policy.30
We first tried to backup the existing SELinux settings and then using rsync
to copy over the policy from the ostree
commit to /etc/selinux
:
$ sudo cp -al /etc/selinux{,.bak}
$ sudo rsync -rlv /usr/etc/selinux/ /etc/selinux/
But modifications were still shown after those operations; (the selinux.bak
entries are expected in this case):
$ sudo ostree admin config-diff | grep policy
M selinux/targeted/active/policy.linked
M selinux/targeted/active/policy.kern
A selinux/targeted/policy/policy.30
A selinux.bak/targeted/active/policy.linked
A selinux.bak/targeted/active/policy.kern
A selinux.bak/targeted/active/modules/100/policykit
A selinux.bak/targeted/active/modules/100/policykit/cil
A selinux.bak/targeted/active/modules/100/policykit/hll
A selinux.bak/targeted/active/modules/100/policykit/lang_ext
A selinux.bak/targeted/.policy.sha512
A selinux.bak/targeted/policy
A selinux.bak/targeted/policy/policy.30
A selinux.bak/targeted/policy/policy.31
The next option was the nuclear option which was to nuke the existing /etc/selinux
directory and copy it fresh.
!!! WARNING !!! this could have adverse effects on your host. I take no responsibility for any problems that arise after doing this !!! WARNING !!!
$ sudo rm -rf /etc/selinux
$ sudo cp -aT /usr/etc/selinux /etc/selinux
After doing that, the config-diff
showed that my settings were what was expected from the ostree
commit (again, in this case the selinux.bak
entries are expected):
$ sudo ostree admin config-diff | grep selinux
A selinux.bak
A selinux.bak/final
A selinux.bak/targeted
<snip>
I rebooted my host a few times, just to make sure the new SELinux policy was intact and I no longer saw any denials in the journal.