Browse Source

Added liste support

jigen 5 years ago
parent
commit
a705746d29
1 changed files with 15 additions and 2 deletions
  1. 15 2
      OTcerts.py

+ 15 - 2
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))