mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Backup/resore authentication control configuration
https://fedorahosted.org/freeipa/ticket/5071 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
parent
f160aa3d0a
commit
db88985c0d
@ -150,6 +150,21 @@ class BaseTaskNamespace(object):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def backup_auth_configuration(self, path):
|
||||||
|
"""
|
||||||
|
Create backup of access control configuration.
|
||||||
|
:param path: store the backup here. This will be passed to
|
||||||
|
restore_auth_configuration as well.
|
||||||
|
"""
|
||||||
|
return
|
||||||
|
|
||||||
|
def restore_auth_configuration(self, path):
|
||||||
|
"""
|
||||||
|
Restore backup of access control configuration.
|
||||||
|
:param path: restore the backup from here.
|
||||||
|
"""
|
||||||
|
return
|
||||||
|
|
||||||
def set_selinux_booleans(self, required_settings, backup_func=None):
|
def set_selinux_booleans(self, required_settings, backup_func=None):
|
||||||
"""Set the specified SELinux booleans
|
"""Set the specified SELinux booleans
|
||||||
|
|
||||||
|
@ -84,3 +84,9 @@ class RedHatAuthConfig(object):
|
|||||||
|
|
||||||
args = self.build_args()
|
args = self.build_args()
|
||||||
ipautil.run(["/usr/sbin/authconfig"] + args)
|
ipautil.run(["/usr/sbin/authconfig"] + args)
|
||||||
|
|
||||||
|
def backup(self, path):
|
||||||
|
ipautil.run(["/usr/sbin/authconfig", "--savebackup", path])
|
||||||
|
|
||||||
|
def restore(self, path):
|
||||||
|
ipautil.run(["/usr/sbin/authconfig", "--restorebackup", path])
|
||||||
|
@ -161,6 +161,14 @@ class RedHatTaskNamespace(BaseTaskNamespace):
|
|||||||
auth_config.add_option("nostart")
|
auth_config.add_option("nostart")
|
||||||
auth_config.execute()
|
auth_config.execute()
|
||||||
|
|
||||||
|
def backup_auth_configuration(self, path):
|
||||||
|
auth_config = RedHatAuthConfig()
|
||||||
|
auth_config.backup(path)
|
||||||
|
|
||||||
|
def restore_auth_configuration(self, path):
|
||||||
|
auth_config = RedHatAuthConfig()
|
||||||
|
auth_config.restore(path)
|
||||||
|
|
||||||
def reload_systemwide_ca_store(self):
|
def reload_systemwide_ca_store(self):
|
||||||
try:
|
try:
|
||||||
ipautil.run([paths.UPDATE_CA_TRUST])
|
ipautil.run([paths.UPDATE_CA_TRUST])
|
||||||
|
@ -41,6 +41,7 @@ from ipapython import ipaldap
|
|||||||
from ipalib.session import ISO8601_DATETIME_FMT
|
from ipalib.session import ISO8601_DATETIME_FMT
|
||||||
from ipalib.constants import CACERT
|
from ipalib.constants import CACERT
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import SafeConfigParser
|
||||||
|
from ipaplatform.tasks import tasks
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A test gpg can be generated like this:
|
A test gpg can be generated like this:
|
||||||
@ -302,6 +303,9 @@ class Backup(admintool.AdminTool):
|
|||||||
self.db2ldif(instance, 'userRoot', online=options.online)
|
self.db2ldif(instance, 'userRoot', online=options.online)
|
||||||
self.db2bak(instance, online=options.online)
|
self.db2bak(instance, online=options.online)
|
||||||
if not options.data_only:
|
if not options.data_only:
|
||||||
|
# create backup of auth configuration
|
||||||
|
auth_backup_path = os.path.join(paths.VAR_LIB_IPA, 'auth_backup')
|
||||||
|
tasks.backup_auth_configuration(auth_backup_path)
|
||||||
self.file_backup(options)
|
self.file_backup(options)
|
||||||
self.finalize_backup(options.data_only, options.gpg, options.gpg_keyring)
|
self.finalize_backup(options.data_only, options.gpg, options.gpg_keyring)
|
||||||
|
|
||||||
|
@ -386,6 +386,10 @@ class Restore(admintool.AdminTool):
|
|||||||
self.log.info('Starting Directory Server')
|
self.log.info('Starting Directory Server')
|
||||||
dirsrv.start(capture_output=False)
|
dirsrv.start(capture_output=False)
|
||||||
else:
|
else:
|
||||||
|
# restore access controll configuration
|
||||||
|
auth_backup_path = os.path.join(paths.VAR_LIB_IPA, 'auth_backup')
|
||||||
|
if os.path.exists(auth_backup_path):
|
||||||
|
tasks.restore_auth_configuration(auth_backup_path)
|
||||||
# explicitly enable then disable the pki tomcatd service to
|
# explicitly enable then disable the pki tomcatd service to
|
||||||
# re-register its instance. FIXME, this is really wierd.
|
# re-register its instance. FIXME, this is really wierd.
|
||||||
services.knownservices.pki_tomcatd.enable()
|
services.knownservices.pki_tomcatd.enable()
|
||||||
|
Loading…
Reference in New Issue
Block a user