Description of problem: I see restorecon dislikes context of /etc/multipath* dir/files. Version-Release number of selected component (if applicable): device-mapper-multipath-0.4.9-56.el6_3.1.x86_64 How reproducible: always Steps to Reproduce: 1. # restorecon -vRn /etc/multipath* restorecon reset /etc/multipath/wwids context system_u:object_r:root_t:s0->system_u:object_r:etc_t:s0 restorecon reset /etc/multipath/bindings context system_u:object_r:root_t:s0->system_u:object_r:etc_t:s0 restorecon reset /etc/multipath.conf context system_u:object_r:root_t:s0->system_u:object_r:etc_t:s0 Actual results: Files do not have correct context. Expected results: restorecon should not complain about them. Additional info: I have not noted this issue before although I have done same testing in the past so this might be an regression? Or, maybe this is triggered by some update? Maybe something else changed? I have not checked too much, but `mv ...` commands in rpm scripts are suspicious: # rpm -q --scripts device-mapper-multipath postinstall scriptlet (using /bin/sh): /sbin/chkconfig --add multipathd if [ "$1" -gt "1" -a ! -e /etc/multipath/bindings -a \ -f /var/lib/multipath/bindings ]; then mv /var/lib/multipath/bindings /etc/multipath/bindings ln -s /etc/multipath/bindings /var/lib/multipath/bindings fi preuninstall scriptlet (using /bin/sh): if [ "$1" = 0 ]; then /sbin/service multipathd stop /dev/null 2>&1 /sbin/chkconfig --del multipathd fi postuninstall scriptlet (using /bin/sh): if [ "$1" -ge "1" ]; then /sbin/service multipathd condrestart >/dev/null 2>&1 || : fi
Those moves were done to allow people to safely upgrade and downgrade a device-mapper-multipath package during the switch from using /var/lib/multipath/bindings to /etc/multipath/bindings. However, I'm not sure there was ever a RHEL6 release that used /var/lib/multipath/bindings, so they may be completely useless. I'll check.
I doubt that the spec file scripts have anything to do with this. I installed the package without those files already existing, and when multipathd created them, the bindings wasn't created with the right context. The odd thing is that the wwids file was, and multipathd creates them both, and it uses the exact same function to do it. # ls -Z /etc/multipath -rw-------. root root unconfined_u:object_r:lvm_metadata_t:s0 bindings -rw-------. root root unconfined_u:object_r:etc_t:s0 wwids I assume that there is an selinux policy reason why they were created differently, but I can't see it. # grep multipath `rpm -q -l selinux-policy-targeted-3.7.19-139.el6.noarch` /etc/selinux/targeted/contexts/files/file_contexts:/var/lib/multipath(/.*)? system_u:object_r:lvm_var_lib_t:s0 /etc/selinux/targeted/contexts/files/file_contexts:/var/cache/multipathd(/.*)? system_u:object_r:lvm_metadata_t:s0 /etc/selinux/targeted/contexts/files/file_contexts:/sbin/multipathd -- system_u:object_r:lvm_exec_t:s0 /etc/selinux/targeted/contexts/files/file_contexts:/sbin/multipath\.static -- system_u:object_r:lvm_exec_t:s0 /etc/selinux/targeted/contexts/files/file_contexts:/var/run/multipathd\.sock -s system_u:object_r:lvm_var_run_t:s0 punting over to selinux to see if they know the reason for this. Feel free to reassign this back to device-mapper-multipath if the problem is there.
Ok, there is more issues. The problem is we have filetrans_pattern(lvm_t, lvm_etc_t, lvm_metadata_t, file) files_etc_filetrans(lvm_t, lvm_metadata_t, file) which is a reason why /etc/multipath/bindings was created with lvm_metadata_t in the second case. So if it can be created this way and also by init script in the /etc/multipath then we need to have one labeling and run "restorecon" in the postinstall scriptlet. Or add a label for the /etc/multipath directory.
If no other domain uses /etc/multipath, we should probably label the directory as lvm_metadata_t.
Only device-mapper-multipath uses /etc/multipath
Ok, could you test it with # chcon -R -t lvm_metadata_t /etc/multipath
Are you just wondering if multipath works o.k. with those contexts? Running the command # chcon -R -t lvm_metadata_t /etc/multipath successfully resets the files. [root@ask-08 ~]# ls -Z /etc/multipath -rw-------. root root system_u:object_r:lvm_metadata_t:s0 bindings -rw-------. root root unconfined_u:object_r:lvm_metadata_t:s0 wwids And multipath works fine with these contexts and selinux set to Enforcing.
Thanks for testing. I added it to Fedora to see if it works.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-0314.html