Nir Soffer has uploaded a new change for review.

Change subject: multipath: Fix multipath.conf selinux labels
......................................................................

multipath: Fix multipath.conf selinux labels

When configuring multipath.conf, we were leaving multipath.conf with
incorrect selinux label:

    # ls -z /etc/multipath.conf
    -rw-r--r--. root root unconfined_u:object_r:etc_t:s0 /etc/multipath.conf

Now we restore the default selinux context on the temporary file before
renaming, so the final selinux labels are:

    # ls -z /etc/multipath.conf
    -rw-r--r--. root root system_u:object_r:etc_t:s0 /etc/multipath.conf

Change-Id: Id0aebae46f30abf908a8f48c4f1f2257394fe616
Backport-To: 3.6?
Signed-off-by: Nir Soffer <[email protected]>
---
M lib/vdsm/tool/configurators/multipath.py
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/46398/1

diff --git a/lib/vdsm/tool/configurators/multipath.py 
b/lib/vdsm/tool/configurators/multipath.py
index 65b6521..b29d513 100644
--- a/lib/vdsm/tool/configurators/multipath.py
+++ b/lib/vdsm/tool/configurators/multipath.py
@@ -19,6 +19,7 @@
 
 from __future__ import absolute_import
 import os
+import selinux
 import shutil
 import sys
 import tempfile
@@ -120,6 +121,7 @@
         try:
             f.write(_CONF_DATA)
             f.flush()
+            selinux.restorecon(f.name)
             os.chmod(f.name, 0o644)
             os.rename(f.name, _CONF_FILE)
         except:


-- 
To view, visit https://gerrit.ovirt.org/46398
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0aebae46f30abf908a8f48c4f1f2257394fe616
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to