[IMP] Add retry
This commit is contained in:
@@ -81,7 +81,7 @@ def check_directories(path):
|
|||||||
directories_list = ['certs','config','crl','newcerts','private','csr','crl','p12']
|
directories_list = ['certs','config','crl','newcerts','private','csr','crl','p12']
|
||||||
|
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
print(f'Create { root_path } directory')
|
print(f'Create { path } directory')
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
|
|
||||||
for directory in directories_list:
|
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')
|
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:
|
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(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...")
|
input("Press Enter to continue...")
|
||||||
else:
|
else:
|
||||||
print('Error on generating Root CA private key')
|
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:
|
else:
|
||||||
print('Root CA private key and certificate already exist. Skip.')
|
print('Root CA private key and certificate already exist. Skip.')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user