From a705746d29bd62c457fadd51adf8dfa8cc62e35f Mon Sep 17 00:00:00 2001 From: jigen Date: Tue, 12 Jun 2018 12:37:20 +0200 Subject: [PATCH] Added liste support --- OTcerts.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/OTcerts.py b/OTcerts.py index c04e89e..310cc89 100644 --- a/OTcerts.py +++ b/OTcerts.py @@ -192,11 +192,15 @@ if __name__ == '__main__': ot_conn=connect_db(dict(config['ot_db'])) dns_conn=connect_db(dict(config['dns_db'])) + if dryrun: + print("DRYRUN, nessuna operazione verra' eseguita realmente") + + # Caso speciale per le webmail if args.webmail: logging.info('Asking certificates for webmail') 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 len(d.strip())>0] if acme_request(config, vhost_name, acme_test='HTTP-01', dryrun=dryrun, domains_list=webmails_list): link_cert(config, vhost_name, vhost_name, dryrun=dryrun) else: @@ -224,6 +228,15 @@ if __name__ == '__main__': for subdomain in domain_feat['subdomains']: if acme_request(config, subdomain, acme_test='HTTP-01', dryrun=dryrun): link_cert(config, subdomain, subdomain, dryrun=dryrun) - ot_conn.close() dns_conn.close() + + # Genero il certificato per l'interfaccia di mailman + if args.liste: + logging.info('Asking certificates for liste.indivia.net') + vhost_name = config['mailman']['vhost'].strip() + liste_list = ["liste.{}".format(d.strip()) for d in config['mailman']['domains'].split(',') if len(d.strip())>0] + if acme_request(config, vhost_name, acme_test='HTTP-01', dryrun=dryrun, domains_list=liste_list): + link_cert(config, vhost_name, vhost_name, dryrun=dryrun) + else: + logger.error('Error asking certificate for {}'.format(vhost_name))