[IMP] Add force option to regenerate PKI and security to protect this option

This commit is contained in:
2024-05-07 17:29:08 +02:00
parent 4827e3e5a0
commit 7e00e9dbbf
2 changed files with 22 additions and 6 deletions
+10 -3
View File
@@ -9,7 +9,7 @@
# Licence: <your licence>
#-------------------------------------------------------------------------------
from optparse import OptionParser
from optparse import OptionParser, OptionGroup
from common import *
@@ -19,12 +19,19 @@ def main():
parser.add_option('--initialize', dest="initialize", action="store_true", help="Create PKI")
parser.add_option('--create-intermediate', dest="create_intermediate", action="store_true", help="Create an intermediate CA")
parser.add_option('--create-dc-cert', dest="create_dc_cert", action="store_true", help="Create a certificat for a Domain Controler")
parser.add_option('-v', '--verbose', dest="verbose", action="store_true", help="Print all command")
dangerous_group = OptionGroup(parser,'Dangerous options', "Caution: use these options at your own risk.")
dangerous_group.add_option('-f', '--force', dest="force", action="store_true", help="Force reinitialize PKI. VERY DANGEROUS")
parser.add_option_group(dangerous_group)
debug_group = OptionGroup(parser, 'Debug options', 'Get more information to debug')
debug_group.add_option('-v', '--verbose', dest="verbose", action="store_true", help="Print all command")
parser.add_option_group(debug_group)
(options, args) = parser.parse_args()
if options.initialize:
create_openssl_config(verbose=options.verbose)
create_openssl_config(force=options.force,verbose=options.verbose)
if __name__ == '__main__':