[IMP] Add retry

This commit is contained in:
2024-05-07 16:25:39 +02:00
parent 27b3e7e84d
commit 846d040d94
+5 -3
View File
@@ -81,7 +81,7 @@ def check_directories(path):
directories_list = ['certs','config','crl','newcerts','private','csr','crl','p12']
if not os.path.isdir(path):
print(f'Create { root_path } directory')
print(f'Create { path } directory')
os.makedirs(path)
for directory in directories_list:
@@ -138,12 +138,14 @@ def create_openssl_config():
gen_root_ca = subprocess.run(f'/usr/bin/openssl req -x509 -new -sha512 -config {root_ca_config} -days 3650 -extensions v3_ca -keyout {TisPKI.root_ca_keyfile()} -out {TisPKI.root_ca_certfile()}', shell=True, check=True, executable='/bin/bash')
if gen_root_ca.returncode == 0:
print(f'Root CA Certfile is stored in {TisPKI.root_ca_certfile()}')
print(subprocess.run(f'openssl x509 -in {TisPKI.root_ca_certfile()} -text', shell=True, check=True, executable='/bin/bash'))
print(f'Root CA Certfile is stored in {TisPKI.root_ca_certfile()}')
input("Press Enter to continue...")
else:
print('Error on generating Root CA private key')
sys.exit(1)
retry = input('If you want to retry, press Y')
if retry == "y" or retry == 'Y':
create_openssl_config()
else:
print('Root CA private key and certificate already exist. Skip.')