[IMP] Use other lib to remove dirs

This commit is contained in:
2024-05-07 17:37:57 +02:00
parent 7e00e9dbbf
commit 2606866215
+9 -8
View File
@@ -6,6 +6,7 @@ import os
import configparser
import sys
from colorama import Fore, Style
import shutil
config = configparser.ConfigParser()
config.read('samba-pki-tools.ini')
@@ -119,6 +120,14 @@ def check_directories(path,verbose=False):
def create_openssl_config(force=False,verbose=False):
if force:
Printing.error("Do you realy want to remove ALL you PKI ? This will destroy ALL YOUR CERTIFICATES AND PRIVATE KEY")
Printing.error("After that, you MUST REGENERATE YOUR PKI with NEW certificates and private key for ALL YOUR DOMAIN CONTROLLERS AND USERS")
destroy = input('If you are realy sure, please enter : "I want to remove all my PKI" .')
if destroy == 'I want to remove all my PKI':
Printing.information('OK, too late ! Destroying your PKI !')
shutil.rmtree(TisPKI.pki_dir(), ignore_errors=True)
Printing.information('Check Root CA OpenSSL Config')
if config.get('general','pki_dir'):
@@ -127,14 +136,6 @@ def create_openssl_config(force=False,verbose=False):
Printing.error('No pki_dir set in samba-pki-tools.ini')
sys.exit(1)
if force:
Printing.error("Do you realy want to remove ALL you PKI ? This will destroy ALL YOUR CERTIFICATES AND PRIVATE KEY")
Printing.error("After that, you MUST REGENERATE YOUR PKI with NEW certificates and private key for ALL YOUR DOMAIN CONTROLLERS AND USERS")
destroy = input('If you are realy sure, please enter : "I want to remove all my PKI"')
if destroy == 'I want to remove all my PKI':
Printing.information('OK, too late ! Destroying your PKI !')
os.removedirs(TisPKI.pki_dir())
root_ca_config = os.path.join(TisPKI.pki_dir(),'config','openssl_root_ca.ini')
if not os.path.isfile(root_ca_config):