Ensure network configuration file has proper permissions 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 reset, system may have no networking enabled after reboot. -- / Alexander Bokovoy
From 2df08449eec5c64f64b20232842f6432b8b64f8f Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy <aboko...@redhat.com> Date: Wed, 10 Aug 2011 14:54:32 +0300 Subject: [PATCH] Ensure network configuration file has proper permissions 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 reseted, system may have no networking enabled after reboot. --- ipa-client/ipa-install/ipa-client-install | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install index e3b9dfbab5975aade08ee36e98fc9a048df76784..5f94b1f94f0574c366dcd1073eda7b19f7d89402 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) new_config.write(new_line) new_config.flush() + # 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 -- 1.7.6
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel