|
|
590d18 |
From 54b62df055fda613aa985ccd971968123c0ad113 Mon Sep 17 00:00:00 2001
|
|
|
590d18 |
From: Martin Babinsky <mbabinsk@redhat.com>
|
|
|
590d18 |
Date: Fri, 25 Sep 2015 18:00:30 +0200
|
|
|
590d18 |
Subject: [PATCH] do not overwrite files with local users/groups when restoring
|
|
|
590d18 |
authconfig
|
|
|
590d18 |
|
|
|
590d18 |
the patch fixes regression in ipa-restore caused by overwriting /etc/passwd,
|
|
|
590d18 |
/etc/shadow and fiends during restore of authconfig configuration files. These
|
|
|
590d18 |
files are now excluded from authconfig backup dir.
|
|
|
590d18 |
|
|
|
590d18 |
https://fedorahosted.org/freeipa/ticket/5328
|
|
|
590d18 |
|
|
|
590d18 |
Reviewed-By: David Kupka <dkupka@redhat.com>
|
|
|
590d18 |
---
|
|
|
590d18 |
ipaplatform/redhat/authconfig.py | 12 ++++++++++++
|
|
|
590d18 |
1 file changed, 12 insertions(+)
|
|
|
590d18 |
|
|
|
590d18 |
diff --git a/ipaplatform/redhat/authconfig.py b/ipaplatform/redhat/authconfig.py
|
|
|
590d18 |
index edefee8b2b4922ad67cdbac158615ef32c776bb4..7b06d583d8f8dba3df589edf73ec20f7b80c20a4 100644
|
|
|
590d18 |
--- a/ipaplatform/redhat/authconfig.py
|
|
|
590d18 |
+++ b/ipaplatform/redhat/authconfig.py
|
|
|
590d18 |
@@ -19,7 +19,9 @@
|
|
|
590d18 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
590d18 |
|
|
|
590d18 |
from ipapython import ipautil
|
|
|
590d18 |
+import os
|
|
|
590d18 |
|
|
|
590d18 |
+FILES_TO_NOT_BACKUP = ['passwd', 'group', 'shadow', 'gshadow']
|
|
|
590d18 |
|
|
|
590d18 |
class RedHatAuthConfig(object):
|
|
|
590d18 |
"""
|
|
|
590d18 |
@@ -88,5 +90,15 @@ class RedHatAuthConfig(object):
|
|
|
590d18 |
def backup(self, path):
|
|
|
590d18 |
ipautil.run(["/usr/sbin/authconfig", "--savebackup", path])
|
|
|
590d18 |
|
|
|
590d18 |
+ # do not backup these files since we don't want to mess with
|
|
|
590d18 |
+ # users/groups during restore. Authconfig doesn't seem to mind about
|
|
|
590d18 |
+ # having them deleted from backup dir
|
|
|
590d18 |
+ files_to_remove = [os.path.join(path, f) for f in FILES_TO_NOT_BACKUP]
|
|
|
590d18 |
+ for filename in files_to_remove:
|
|
|
590d18 |
+ try:
|
|
|
590d18 |
+ os.remove(filename)
|
|
|
590d18 |
+ except OSError:
|
|
|
590d18 |
+ pass
|
|
|
590d18 |
+
|
|
|
590d18 |
def restore(self, path):
|
|
|
590d18 |
ipautil.run(["/usr/sbin/authconfig", "--restorebackup", path])
|
|
|
590d18 |
--
|
|
|
590d18 |
2.4.3
|
|
|
590d18 |
|