summaryrefslogtreecommitdiffstats
path: root/base/server/python/pki/server/deployment/pkiparser.py
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2016-03-30 17:23:06 +0200
committerEndi S. Dewata <edewata@redhat.com>2016-03-30 22:37:17 +0200
commit061bec70264c2c7a601ffe80846ef1fa5497c15c (patch)
tree5816472442408259e2b3409d212bba574ea98d11 /base/server/python/pki/server/deployment/pkiparser.py
parent58b78bd1602e3efeb33a73f8d07a6edaaee104ba (diff)
downloadpki-061bec70264c2c7a601ffe80846ef1fa5497c15c.tar.gz
pki-061bec70264c2c7a601ffe80846ef1fa5497c15c.tar.xz
pki-061bec70264c2c7a601ffe80846ef1fa5497c15c.zip
Fixed KRA install problem.
Currently when installing an additional subsystem to an existing instance the install tool always generates a new random password in the pki_pin property which would not work with the existing NSS database. The code has been modified to load the existing NSS database password from the instance if the instance already exists. The PKIInstance class has been modified to allow loading partially created instance to help the installation. https://fedorahosted.org/pki/ticket/2247
Diffstat (limited to 'base/server/python/pki/server/deployment/pkiparser.py')
-rw-r--r--base/server/python/pki/server/deployment/pkiparser.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/base/server/python/pki/server/deployment/pkiparser.py b/base/server/python/pki/server/deployment/pkiparser.py
index 273b5ac30..4d6e0185e 100644
--- a/base/server/python/pki/server/deployment/pkiparser.py
+++ b/base/server/python/pki/server/deployment/pkiparser.py
@@ -582,9 +582,21 @@ class PKIConfigParser:
pin_low = 100000000000
pin_high = 999999999999
- # use user-provided PIN if specified
- if 'pki_pin' not in self.mdict:
- # otherwise generate a random password
+ instance = pki.server.PKIInstance(self.mdict['pki_instance_name'])
+ instance.load()
+
+ internal_password = self.mdict['pki_self_signed_token']
+
+ # if instance already exists and has password, reuse the password
+ if internal_password in instance.passwords:
+ self.mdict['pki_pin'] = instance.passwords.get(internal_password)
+
+ # otherwise, use user-provided password if specified
+ elif 'pki_pin' in self.mdict:
+ pass
+
+ # otherwise, generate a random password
+ else:
self.mdict['pki_pin'] = \
random.randint(pin_low, pin_high)