diff --git a/authenticator.py b/authenticator.py index b1bb30d..0fad8b7 100755 --- a/authenticator.py +++ b/authenticator.py @@ -17,6 +17,9 @@ def setup_logger(): # seup logging logger = logging.getLogger("certbot_dns_corenetworks") logging.basicConfig(level=logging.INFO) + # silence logging from requests module + logging.getLogger('requests').setLevel(logging.CRITICAL) + # create console handler ch = logging.StreamHandler() ch.setLevel(logging.INFO) @@ -88,8 +91,11 @@ def set_record(token, host, zone, logger): try: custom_cache_extract = tldextract.TLDExtract( cache_file=os.path.join(os.path.expanduser("~"), "tld_set")) - domain = custom_cache_extract(os.environ['CERTBOT_DOMAIN']) - certbot_domain = "_acme-challenge.%s" % (domain.subdomain) + subdomain = custom_cache_extract(os.environ['CERTBOT_DOMAIN']).subdomain + if subdomain: + certbot_domain = "_acme-challenge.%s" % (subdomain) + else: + certbot_domain = "_acme-challenge" certbot_validation = os.environ['CERTBOT_VALIDATION'] except KeyError, e: logger.error("Environment Variable %s not set" % (e))