[REF] Split in modules

This commit is contained in:
Kevin Guerineau
2024-05-10 16:47:51 +02:00
parent 3629011913
commit ce28001bae
6 changed files with 429 additions and 361 deletions
+9 -8
View File
@@ -13,6 +13,10 @@ from optparse import OptionParser, OptionGroup
from argparse import ArgumentParser
from common import *
from root_module import *
from intermediate_module import *
from dc_module import *
from user_module import *
def main():
@@ -20,20 +24,17 @@ def main():
parser = ArgumentParser(prog='Samba PKI Tools',
description='Manage PKI for Samba')
create_group = parser.add_argument_group('Create options')
create_group.add_argument('--initialize', dest="initialize", action="store_true", help="Create PKI")
create_group.add_argument('--full-initialize', dest="full_initialize", action="store_true", help="Create Root CA, intermediate CA and DC certificate. Use --name and --dc-name")
create_group.add_argument('--create-intermediate', dest="create_intermediate", action="store_true", help="Create an intermediate CA. Specify name with --name option.")
create_group.add_argument('--create-dc-cert', dest="create_dc_cert", action="store_true", help="Create a certificat for a Domain Controler")
root_group = parser.add_argument_group('Root CA options')
root_group.add_argument('--create-root', dest="initialize", action="store_true", help="Create PKI")
root_group.add_argument('--full-create', dest="full_initialize", action="store_true", help="Create Root CA, intermediate CA and DC certificate. Use --name and --dc-name")
root_group.add_argument('--root-crl', dest='root_crl', help='Regenerate CRL for root CA')
root_group.add_argument('--root-show-certs','--root-show-certificates', dest="root_certs", help='List all certificates issues of root CA')
intermediate_group = parser.add_argument_group('Intermediate CA options', 'Manage intermediate CA')
intermediate_group.add_argument('--create-intermediate', dest="create_intermediate", action="store_true", help="Create an intermediate CA. Specify name with --name option.")
intermediate_group.add_argument('--name', dest='intermediate_name', help='Specify what intermediate CA to manage')
intermediate_group.add_argument('--crl', dest='intermediate_crl', help='Regenerate CRL for intermediate CA')
intermediate_group.add_argument('--show-certs', '--show-certificates', dest='intermediate_list', help='List all certificates issues of intermediate CA')
intermediate_group.add_argument('--crl', dest='intermediate_crl', help='Regenerate CRL for intermediate CA. Specify name with --name option.')
intermediate_group.add_argument('--show-certs', '--show-certificates', dest='intermediate_list', help='List all certificates issues of intermediate CA. Specify name with --name option.')
dc_cert = parser.add_argument_group('Domain Controler options', 'Manage DC certificates')
dc_cert.add_argument('--dc-cert', dest="dc_cert", action="store_true", help="Create a DC certificate. Specify intermediate CA name with --name option. \