pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone
Blob Blame History Raw
From 620dced81e4ef95522fcaf50c0b3e060f911754f Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jcholast@redhat.com>
Date: Tue, 16 Aug 2016 17:34:06 +0200
Subject: [PATCH] server install: do not prompt for cert file PIN repeatedly

Prompt for PIN only once in interactive mode.

This fixes ipa-server-install, ipa-server-certinstall and
ipa-replica-prepare prompting over and over when the PIN is empty.

https://fedorahosted.org/freeipa/ticket/6032

Reviewed-By: Pavel Vomacka <pvomacka@redhat.com>
---
 ipaserver/install/ipa_replica_prepare.py    | 6 +++---
 ipaserver/install/ipa_server_certinstall.py | 3 ++-
 ipaserver/install/server/install.py         | 6 +++---
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ipaserver/install/ipa_replica_prepare.py b/ipaserver/install/ipa_replica_prepare.py
index fdd32f0c8437a0d8c3947d57089662ea09bb2304..80813086c6a7212bdb6ef9d54202b28808b80076 100644
--- a/ipaserver/install/ipa_replica_prepare.py
+++ b/ipaserver/install/ipa_replica_prepare.py
@@ -303,7 +303,7 @@ class ReplicaPrepare(admintool.AdminTool):
             if options.http_pin is None:
                 options.http_pin = installutils.read_password(
                     "Enter Apache Server private key unlock",
-                    confirm=False, validate=False)
+                    confirm=False, validate=False, retry=False)
                 if options.http_pin is None:
                     raise admintool.ScriptError(
                         "Apache Server private key unlock password required")
@@ -317,7 +317,7 @@ class ReplicaPrepare(admintool.AdminTool):
             if options.dirsrv_pin is None:
                 options.dirsrv_pin = installutils.read_password(
                     "Enter Directory Server private key unlock",
-                    confirm=False, validate=False)
+                    confirm=False, validate=False, retry=False)
                 if options.dirsrv_pin is None:
                     raise admintool.ScriptError(
                         "Directory Server private key unlock password required")
@@ -331,7 +331,7 @@ class ReplicaPrepare(admintool.AdminTool):
             if options.pkinit_pin is None:
                 options.pkinit_pin = installutils.read_password(
                     "Enter Kerberos KDC private key unlock",
-                    confirm=False, validate=False)
+                    confirm=False, validate=False, retry=False)
                 if options.pkinit_pin is None:
                     raise admintool.ScriptError(
                         "Kerberos KDC private key unlock password required")
diff --git a/ipaserver/install/ipa_server_certinstall.py b/ipaserver/install/ipa_server_certinstall.py
index 5ab47303add479c7c492c251b0cf6646de681a4b..0a8fb214a232e60a89b6c06940b928f97c007b93 100644
--- a/ipaserver/install/ipa_server_certinstall.py
+++ b/ipaserver/install/ipa_server_certinstall.py
@@ -92,7 +92,8 @@ class ServerCertInstall(admintool.AdminTool):
 
         if self.options.pin is None:
             self.options.pin = installutils.read_password(
-                "Enter private key unlock", confirm=False, validate=False)
+                "Enter private key unlock",
+                confirm=False, validate=False, retry=False)
             if self.options.pin is None:
                 raise admintool.ScriptError(
                     "Private key unlock password required")
diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index 86b8402750b503ea7dacd1f4c59c82d9bd4082e6..b33b0243d4d909a561b59d93f0014c390146b333 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -488,7 +488,7 @@ def install_check(installer):
         if options.http_pin is None:
             options.http_pin = installutils.read_password(
                 "Enter Apache Server private key unlock",
-                confirm=False, validate=False)
+                confirm=False, validate=False, retry=False)
             if options.http_pin is None:
                 sys.exit(
                     "Apache Server private key unlock password required")
@@ -504,7 +504,7 @@ def install_check(installer):
         if options.dirsrv_pin is None:
             options.dirsrv_pin = read_password(
                 "Enter Directory Server private key unlock",
-                confirm=False, validate=False)
+                confirm=False, validate=False, retry=False)
             if options.dirsrv_pin is None:
                 sys.exit(
                     "Directory Server private key unlock password required")
@@ -520,7 +520,7 @@ def install_check(installer):
         if options.pkinit_pin is None:
             options.pkinit_pin = read_password(
                 "Enter Kerberos KDC private key unlock",
-                confirm=False, validate=False)
+                confirm=False, validate=False, retry=False)
             if options.pkinit_pin is None:
                 sys.exit(
                     "Kerberos KDC private key unlock password required")
-- 
2.9.3