mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ca, kra install: validate DM password
Before proceeding with installation, validate DM password. If the provided DM password is invalid, abort the installation. Fixes https://pagure.io/freeipa/issue/6892 Signed-off-by: Tomas Krizek <tkrizek@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
parent
7a4a368c53
commit
1b1bace750
@ -117,17 +117,19 @@ def parse_options():
|
||||
|
||||
|
||||
def _get_dirman_password(password=None, unattended=False):
|
||||
# sys.exit() is used on purpose, because otherwise user is advised to
|
||||
# uninstall the component, even though it is not needed
|
||||
if not password:
|
||||
if unattended:
|
||||
sys.exit('Directory Manager password required')
|
||||
try:
|
||||
password = installutils.read_password(
|
||||
"Directory Manager (existing master)", confirm=False,
|
||||
validate=False)
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(0)
|
||||
if password is None:
|
||||
sys.exit("Directory Manager password required")
|
||||
password = installutils.read_password(
|
||||
"Directory Manager (existing master)", confirm=False,
|
||||
validate=False)
|
||||
try:
|
||||
installutils.validate_dm_password_ldap(password)
|
||||
except ValueError:
|
||||
sys.exit("Directory Manager password is invalid")
|
||||
|
||||
return password
|
||||
|
||||
|
||||
|
@ -137,6 +137,14 @@ class KRAInstaller(KRAInstall):
|
||||
def run(self):
|
||||
super(KRAInstaller, self).run()
|
||||
|
||||
# Verify DM password. This has to be called after ask_for_options(),
|
||||
# so it can't be placed in validate_options().
|
||||
try:
|
||||
installutils.validate_dm_password_ldap(self.options.password)
|
||||
except ValueError:
|
||||
raise admintool.ScriptError(
|
||||
"Directory Manager password is invalid")
|
||||
|
||||
if not cainstance.is_ca_installed_locally():
|
||||
raise RuntimeError("Dogtag CA is not installed. "
|
||||
"Please install the CA first")
|
||||
|
Loading…
Reference in New Issue
Block a user