[IMP] Use other lib to remove dirs
This commit is contained in:
@@ -6,6 +6,7 @@ import os
|
|||||||
import configparser
|
import configparser
|
||||||
import sys
|
import sys
|
||||||
from colorama import Fore, Style
|
from colorama import Fore, Style
|
||||||
|
import shutil
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('samba-pki-tools.ini')
|
config.read('samba-pki-tools.ini')
|
||||||
@@ -119,6 +120,14 @@ def check_directories(path,verbose=False):
|
|||||||
|
|
||||||
|
|
||||||
def create_openssl_config(force=False,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')
|
Printing.information('Check Root CA OpenSSL Config')
|
||||||
|
|
||||||
if config.get('general','pki_dir'):
|
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')
|
Printing.error('No pki_dir set in samba-pki-tools.ini')
|
||||||
sys.exit(1)
|
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')
|
root_ca_config = os.path.join(TisPKI.pki_dir(),'config','openssl_root_ca.ini')
|
||||||
|
|
||||||
if not os.path.isfile(root_ca_config):
|
if not os.path.isfile(root_ca_config):
|
||||||
|
|||||||
Reference in New Issue
Block a user