path: root/ipa-client/ipa-install/ipa-client-install
diff options
authorAlexander Bokovoy <>2011-08-10 15:15:01 +0300
committerMartin Kosek <>2011-08-10 16:32:05 +0200
commite6d061224ee226bb263f56f3bce4db96934ce49a (patch)
treea1e7e1c34d17db39dd96643f1f663b6769bbbdd7 /ipa-client/ipa-install/ipa-client-install
parent503470916c296db419e2cbeb096fc2b4173574ba (diff)
Ensure network configuration file has proper permissionsgssapi-delegate
As network configuration file is created as temporary file, it has stricter permissions than we need for the target system configuration file. Ensure permissions are properly reset before installing file. If permissions are not re-set, system may have no networking enabled after reboot.
Diffstat (limited to 'ipa-client/ipa-install/ipa-client-install')
1 files changed, 10 insertions, 0 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index e3b9dfb..1caf9c1 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -23,6 +23,7 @@ try:
import sys
import os
+ import stat
import time
import socket
import logging
@@ -564,6 +565,9 @@ $)''', re.VERBOSE)
statestore.backup_state('network', 'hostname', value)
+ # Make sure the resulting file is readable by others before installing it
+ os.fchmod(new_config.fileno(), stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
+ os.fchown(new_config.fileno(), 0, 0)
# At this point new_config is closed but not removed due to 'delete=False' above
# Now, install the temporary file as configuration and ensure old version is available as .orig
@@ -574,6 +578,12 @@ $)''', re.VERBOSE)
except CalledProcessError, e:
print >>sys.stderr, "Failed to set this machine hostname to %s (%s)." % (hostname, str(e))
+ # For SE Linux environments it is important to reset SE labels to the expected ones
+ try:
+['/sbin/restorecon', network_filename])
+ except CalledProcessError, e:
+ print >>sys.stderr, "Failed to set permissions for %s (%s)." % (network_filename, str(e))
def configure_sssd_conf(fstore, cli_realm, cli_domain, cli_server, options):
sssdconfig = SSSDConfig.SSSDConfig()