From 846d040d9431ba0be4e80be3a02f5e6753c2d595 Mon Sep 17 00:00:00 2001 From: Kevin Guerineau Date: Tue, 7 May 2024 16:25:39 +0200 Subject: [PATCH] [IMP] Add retry --- common.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common.py b/common.py index e3207c1..670d502 100644 --- a/common.py +++ b/common.py @@ -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.')