mirror of
https://github.com/moepman/acertmgr.git
synced 2024-12-29 09:21:51 +01:00
configuration: remove redundant 'domains' parameter, just use domainlist
This commit is contained in:
parent
fa3fc196f3
commit
7e4c350a4f
@ -10,7 +10,6 @@ import grp
|
||||
import io
|
||||
import os
|
||||
import pwd
|
||||
import re
|
||||
import stat
|
||||
import subprocess
|
||||
|
||||
@ -22,7 +21,7 @@ from acertmgr.modes import challenge_handler
|
||||
# @brief fetch new certificate from letsencrypt
|
||||
# @param settings the domain's configuration options
|
||||
def cert_get(settings):
|
||||
print("Getting certificate for '%s'." % settings['domains'])
|
||||
print("Getting certificate for %s" % settings['domainlist'])
|
||||
|
||||
acme = authority(settings['authority'])
|
||||
acme.register_account()
|
||||
@ -143,9 +142,9 @@ def main():
|
||||
cert = None
|
||||
if os.path.isfile(config['cert_file']):
|
||||
cert = tools.read_pem_file(config['cert_file'])
|
||||
if not cert or not tools.is_cert_valid(cert, config['ttl_days']) or \
|
||||
('force_renew' in runtimeconfig and re.search(r'(^| ){}( |$)'.format(
|
||||
re.escape(runtimeconfig['force_renew'])), config['domains'])):
|
||||
if not cert or not tools.is_cert_valid(cert, config['ttl_days']) or (
|
||||
'force_renew' in runtimeconfig and
|
||||
all(d in config['domainlist'] for d in runtimeconfig['force_renew'])):
|
||||
cert_get(config)
|
||||
if str(config.get('cert_revoke_superseded')).lower() == 'true' and cert:
|
||||
superseded.add(cert)
|
||||
|
@ -86,15 +86,14 @@ def parse_config_entry(entry, globalconfig, runtimeconfig):
|
||||
config = dict()
|
||||
|
||||
# Basic domain information
|
||||
config['domains'], localconfig = entry
|
||||
config['domainlist'] = config['domains'].split(' ')
|
||||
config['id'] = hashlib.md5(config['domains'].encode('utf-8')).hexdigest()
|
||||
domains, localconfig = entry
|
||||
config['domainlist'] = domains.split(' ')
|
||||
config['id'] = hashlib.md5(domains.encode('utf-8')).hexdigest()
|
||||
|
||||
# Convert unicode to IDNA domains
|
||||
config['domaintranslation'] = idna_convert(config['domainlist'])
|
||||
if len(config['domaintranslation']) > 0:
|
||||
config['domainlist'] = config['domaintranslation'].values()
|
||||
config['domains'] = ' '.join(config['domainlist'])
|
||||
|
||||
# Action config defaults
|
||||
config['defaults'] = globalconfig.get('defaults', {})
|
||||
@ -255,9 +254,9 @@ def load():
|
||||
if args.force_renew:
|
||||
domaintranslation = idna_convert(args.force_renew.split(' '))
|
||||
if len(domaintranslation) > 0:
|
||||
runtimeconfig['force_renew'] = ' '.join(domaintranslation.values())
|
||||
runtimeconfig['force_renew'] = domaintranslation.values()
|
||||
else:
|
||||
runtimeconfig['force_renew'] = args.force_renew
|
||||
runtimeconfig['force_renew'] = args.force_renew.split(' ')
|
||||
|
||||
# - revoke
|
||||
if args.revoke:
|
||||
|
Loading…
Reference in New Issue
Block a user