Adding command line flags for operations
This commit is contained in:
parent
c690e7d649
commit
02f9f2d3f7
1 changed files with 41 additions and 29 deletions
12
OTcerts.py
12
OTcerts.py
|
@ -41,6 +41,14 @@ def init_prog(argv):
|
||||||
required=False,
|
required=False,
|
||||||
default=default_conf_file,
|
default=default_conf_file,
|
||||||
help="Specifity config file (default: {})".format(default_conf_file))
|
help="Specifity config file (default: {})".format(default_conf_file))
|
||||||
|
parser.add_argument("--liste", default=False, action='store_true', required=False,
|
||||||
|
help="Richiedi i certificati per liste.indivia.net")
|
||||||
|
parser.add_argument("--hosting", default=False, action='store_true', required=False,
|
||||||
|
help="Richiedi i certificati per i siti in hosting")
|
||||||
|
parser.add_argument("--webmail", default=False, action='store_true', required=False,
|
||||||
|
help="Richiedi i certificati per le webmail")
|
||||||
|
parser.add_argument("--renew", default=False, action='store_true', required=False,
|
||||||
|
help="Invoca solamente il renew per i certificati gia' presenti")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
try:
|
try:
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
|
@ -185,6 +193,8 @@ if __name__ == '__main__':
|
||||||
dns_conn=connect_db(dict(config['dns_db']))
|
dns_conn=connect_db(dict(config['dns_db']))
|
||||||
|
|
||||||
# Caso speciale per le webmail
|
# Caso speciale per le webmail
|
||||||
|
if args.webmail:
|
||||||
|
logging.info('Asking certificates for webmail')
|
||||||
vhost_name = config['webmail']['vhost'].strip()
|
vhost_name = config['webmail']['vhost'].strip()
|
||||||
webmails_list = ["webmail.{}".format(d.strip()) for d in config['webmail']['domains'].split(',')]
|
webmails_list = ["webmail.{}".format(d.strip()) for d in config['webmail']['domains'].split(',')]
|
||||||
if acme_request(config, vhost_name, acme_test='HTTP-01', dryrun=dryrun, domains_list=webmails_list):
|
if acme_request(config, vhost_name, acme_test='HTTP-01', dryrun=dryrun, domains_list=webmails_list):
|
||||||
|
@ -192,6 +202,8 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
logger.error('Error asking certificate for {}'.format(vhost_name))
|
logger.error('Error asking certificate for {}'.format(vhost_name))
|
||||||
|
|
||||||
|
if args.hosting:
|
||||||
|
logging.info('Asking certificates for hosted web domains')
|
||||||
# Subdomains da escludere
|
# Subdomains da escludere
|
||||||
ex_subdomains = tuple([s.strip() for s in config['main']['special_subdomains'].split(',') if len(s.strip())>0])
|
ex_subdomains = tuple([s.strip() for s in config['main']['special_subdomains'].split(',') if len(s.strip())>0])
|
||||||
domains_dict = get_domain_list(config, ot_conn, dns_conn)
|
domains_dict = get_domain_list(config, ot_conn, dns_conn)
|
||||||
|
|
Loading…
Reference in a new issue