Adding command line flags for operations

This commit is contained in:
jigen 2018-06-10 23:15:57 +02:00
parent c690e7d649
commit 02f9f2d3f7

View file

@ -41,6 +41,14 @@ def init_prog(argv):
required=False,
default=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()
try:
config = configparser.ConfigParser()
@ -185,6 +193,8 @@ if __name__ == '__main__':
dns_conn=connect_db(dict(config['dns_db']))
# 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(',')]
if acme_request(config, vhost_name, acme_test='HTTP-01', dryrun=dryrun, domains_list=webmails_list):
@ -192,6 +202,8 @@ if __name__ == '__main__':
else:
logger.error('Error asking certificate for {}'.format(vhost_name))
if args.hosting:
logging.info('Asking certificates for hosted web domains')
# Subdomains da escludere
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)