diff options
| author | Jan Cholasta <jcholast@redhat.com> | 2017-03-08 14:24:15 +0000 |
|---|---|---|
| committer | Martin Babinsky <mbabinsk@redhat.com> | 2017-03-22 14:58:18 +0100 |
| commit | e263cb46cba604421d5ed2e1dbf5dd1d66ce0221 (patch) | |
| tree | bfd770dc5dbdc62a7388145aaf85aca9ac8b63b0 /ipapython | |
| parent | bbd18cf10f2e67e5205a3a3bee883272e89c0042 (diff) | |
| download | freeipa-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.py | 13 |
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 |
