mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
sysrestore: copy files instead of moving them to avoind SELinux issues
Copying files restores SELinux context. https://fedorahosted.org/freeipa/ticket/4923 Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
f1f3ef478d
commit
9f70128353
@ -186,7 +186,9 @@ class FileStore:
|
||||
if new_path is not None:
|
||||
path = new_path
|
||||
|
||||
shutil.move(backup_path, path)
|
||||
shutil.copy(backup_path, path) # SELinux needs copy
|
||||
os.remove(backup_path)
|
||||
|
||||
os.chown(path, int(uid), int(gid))
|
||||
os.chmod(path, int(mode))
|
||||
|
||||
@ -217,7 +219,9 @@ class FileStore:
|
||||
root_logger.debug(" -> Not restoring - '%s' doesn't exist", backup_path)
|
||||
continue
|
||||
|
||||
shutil.move(backup_path, path)
|
||||
shutil.copy(backup_path, path) # SELinux needs copy
|
||||
os.remove(backup_path)
|
||||
|
||||
os.chown(path, int(uid), int(gid))
|
||||
os.chmod(path, int(mode))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user