summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2017-03-08 14:24:15 +0000
committerMartin Babinsky <mbabinsk@redhat.com>2017-03-22 14:58:18 +0100
commite263cb46cba604421d5ed2e1dbf5dd1d66ce0221 (patch)
treebfd770dc5dbdc62a7388145aaf85aca9ac8b63b0 /ipapython
parentbbd18cf10f2e67e5205a3a3bee883272e89c0042 (diff)
downloadfreeipa-e263cb46cba604421d5ed2e1dbf5dd1d66ce0221.tar.gz
freeipa-e263cb46cba604421d5ed2e1dbf5dd1d66ce0221.tar.xz
freeipa-e263cb46cba604421d5ed2e1dbf5dd1d66ce0221.zip
httpinstance: clean up /etc/httpd/alias on uninstall
Restore cert8.db, key3.db, pwdfile.txt and secmod.db in /etc/httpd/alias from backup on uninstall. Files modified by IPA are kept with .ipasave suffix. https://pagure.io/freeipa/issue/4639 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/certdb.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ipapython/certdb.py b/ipapython/certdb.py
index 6c89e7780..f1410e5ae 100644
--- a/ipapython/certdb.py
+++ b/ipapython/certdb.py
@@ -169,6 +169,19 @@ class NSSDatabase(object):
new_mode = filemode
os.chmod(path, new_mode)
+ def restore(self):
+ for filename in NSS_FILES:
+ path = os.path.join(self.secdir, filename)
+ backup_path = path + '.orig'
+ save_path = path + '.ipasave'
+ try:
+ if os.path.exists(path):
+ os.rename(path, save_path)
+ if os.path.exists(backup_path):
+ os.rename(backup_path, path)
+ except OSError as e:
+ root_logger.debug(e)
+
def list_certs(self):
"""Return nicknames and cert flags for all certs in the database