diff --git a/README.md b/README.md index d93e2ba..d24deae 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,10 @@ using [Certbot](https://certbot.eff.org/) DNS-01 challenge validation for domain ## Setup -The scripts use the [untangle](https://untangle.readthedocs.io/en/latest/) and tldextract libraries, if not already installed on your system: +The scripts use the [tldextract](https://github.com/john-kurkowski/tldextract) and [untangle](https://untangle.readthedocs.io/en/latest/) libraries, if not already installed on your system: ``` -pip install untangle - -pip install tldextract +pip install tldextract untangle ``` Download the [latest release](https://github.com/ethauvin/namesilo-letsencrypt/releases) archive and expand it in the desired directory. @@ -46,4 +44,3 @@ certbot certonly --manual --email you@example.com \ Please note that NameSilo DNS propagation takes up to **15 minutes**. The scripts will wait **20 minutes** before completing, just to be safe. -q diff --git a/authenticator.py b/authenticator.py index 8098b0c..742ff9e 100755 --- a/authenticator.py +++ b/authenticator.py @@ -52,29 +52,28 @@ def sleep(minutes): domain = os.environ['CERTBOT_DOMAIN'] validation = os.environ['CERTBOT_VALIDATION'] -tmpdir = os.path.join(tempfile.gettempdir(), "CERTBOT_"+domain) +tmpdir = os.path.join(tempfile.gettempdir(), "CERTBOT_" + domain) rrhost = "_acme-challenge" if "NAMESILO_API" in os.environ: apikey = os.environ['NAMESILO_API'] - tld = tldextract.extract(domain) -nsdomain = tld.domain+"."+tld.suffix +nsdomain = tld.domain + "." + tld.suffix if tld.subdomain: - rrhost += "."+tld.subdomain + rrhost += "." + tld.subdomain url = "https://www.namesilo.com/api/dnsAddRecord?\ -version=1&type=xml&key="+apikey+"&domain="+nsdomain+"&rrtype=TXT\ -&rrhost="+rrhost+"&rrvalue="+validation+"&rrttl=3600" +version=1&type=xml&key=" + apikey + "&domain=" + nsdomain + "&rrtype=TXT\ +&rrhost=" + rrhost + "&rrvalue=" + validation + "&rrttl=3600" req = urllib.request.Request( url, data=None, headers={ - 'User-Agent': ('Mozilla/5.0 (X11; CrOS x86_64 11647.154.0) ' + 'User-Agent': ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' 'AppleWebKit/537.36 (KHTML, like Gecko) ' - 'Chrome/73.0.3683.114 Safari/537.36') + 'Chrome/80.0.3987.163 Safari/537.36') } ) diff --git a/cleanup.py b/cleanup.py index e95a369..28a8e4a 100755 --- a/cleanup.py +++ b/cleanup.py @@ -42,17 +42,17 @@ import untangle from config import apikey domain = os.environ['CERTBOT_DOMAIN'] -tmpdir = os.path.join(tempfile.gettempdir(), "CERTBOT_"+domain) - +tmpdir = os.path.join(tempfile.gettempdir(), "CERTBOT_" + domain) if "NAMESILO_API" in os.environ: apikey = os.environ['NAMESILO_API'] tld = tldextract.extract(domain) -nsdomain = tld.domain+"."+tld.suffix +nsdomain = tld.domain + "." + tld.suffix url = "https://www.namesilo.com/api/dnsDeleteRecord\ -?version=1&type=xml&key="+apikey+"&domain="+nsdomain+"&rrid=" +?version=1&type=xml&key=" + apikey + "&domain=" + nsdomain + "&rrid=" + def getrequest(record_id): return urllib.request.Request(