mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-09-03 20:52:56 -05:00
do not overwrite files with local users/groups when restoring authconfig
the patch fixes regression in ipa-restore caused by overwriting /etc/passwd, /etc/shadow and fiends during restore of authconfig configuration files. These files are now excluded from authconfig backup dir. https://fedorahosted.org/freeipa/ticket/5328 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
committed by
Martin Basti
parent
7ab52384be
commit
14977b5d84
@@ -19,7 +19,9 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipapython import ipautil
|
||||
import os
|
||||
|
||||
FILES_TO_NOT_BACKUP = ['passwd', 'group', 'shadow', 'gshadow']
|
||||
|
||||
class RedHatAuthConfig(object):
|
||||
"""
|
||||
@@ -88,5 +90,15 @@ class RedHatAuthConfig(object):
|
||||
def backup(self, path):
|
||||
ipautil.run(["/usr/sbin/authconfig", "--savebackup", path])
|
||||
|
||||
# do not backup these files since we don't want to mess with
|
||||
# users/groups during restore. Authconfig doesn't seem to mind about
|
||||
# having them deleted from backup dir
|
||||
files_to_remove = [os.path.join(path, f) for f in FILES_TO_NOT_BACKUP]
|
||||
for filename in files_to_remove:
|
||||
try:
|
||||
os.remove(filename)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def restore(self, path):
|
||||
ipautil.run(["/usr/sbin/authconfig", "--restorebackup", path])
|
||||
|
||||
Reference in New Issue
Block a user