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