mirror of
https://github.com/moepman/acertmgr.git
synced 2024-12-28 18:21:51 +01:00
logging: Add real counterparts of IDNA-mapped domains in brackets
This commit is contained in:
parent
460b0119ac
commit
6f0ccfdc91
@ -15,7 +15,7 @@ import sys
|
|||||||
from acertmgr import configuration, tools
|
from acertmgr import configuration, tools
|
||||||
from acertmgr.authority import authority
|
from acertmgr.authority import authority
|
||||||
from acertmgr.modes import challenge_handler
|
from acertmgr.modes import challenge_handler
|
||||||
from acertmgr.tools import log
|
from acertmgr.tools import log, LOG_REPLACEMENTS
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pwd
|
import pwd
|
||||||
@ -139,6 +139,9 @@ def cert_revoke(cert, configs, fallback_authority, reason=None):
|
|||||||
def main():
|
def main():
|
||||||
# load config
|
# load config
|
||||||
runtimeconfig, domainconfigs = configuration.load()
|
runtimeconfig, domainconfigs = configuration.load()
|
||||||
|
# register idna-mapped domains as LOG_REPLACEMENTS for better readability of log output
|
||||||
|
LOG_REPLACEMENTS.update({k: "{} [{}]".format(k, v) for k, v in domainconfigs['domainlist_idna_mapped']})
|
||||||
|
# Start processing
|
||||||
if runtimeconfig.get('mode') == 'revoke':
|
if runtimeconfig.get('mode') == 'revoke':
|
||||||
# Mode: revoke certificate
|
# Mode: revoke certificate
|
||||||
log("Revoking {}".format(runtimeconfig['revoke']))
|
log("Revoking {}".format(runtimeconfig['revoke']))
|
||||||
|
@ -38,6 +38,8 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from urllib2 import urlopen, Request # Python 2
|
from urllib2 import urlopen, Request # Python 2
|
||||||
|
|
||||||
|
LOG_REPLACEMENTS = {}
|
||||||
|
|
||||||
|
|
||||||
class InvalidCertificateError(Exception):
|
class InvalidCertificateError(Exception):
|
||||||
pass
|
pass
|
||||||
@ -59,6 +61,9 @@ def log(msg, exc=None, error=False, warning=False):
|
|||||||
prefix = ""
|
prefix = ""
|
||||||
|
|
||||||
output = prefix + msg
|
output = prefix + msg
|
||||||
|
for k, v in LOG_REPLACEMENTS.items():
|
||||||
|
output = output.replace(k, v)
|
||||||
|
|
||||||
if exc:
|
if exc:
|
||||||
_, exc_value, _ = sys.exc_info()
|
_, exc_value, _ = sys.exc_info()
|
||||||
if not getattr(exc, '__traceback__', None) and exc == exc_value:
|
if not getattr(exc, '__traceback__', None) and exc == exc_value:
|
||||||
|
Loading…
Reference in New Issue
Block a user