This commit is contained in:
Erik C. Thauvin 2020-04-14 12:02:01 -07:00
parent e0fc2e71fa
commit 94caed2d98
3 changed files with 13 additions and 17 deletions

View file

@ -9,12 +9,10 @@ using [Certbot](https://certbot.eff.org/) DNS-01 challenge validation for domain
## Setup ## 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 untangle
pip install tldextract
``` ```
Download the [latest release](https://github.com/ethauvin/namesilo-letsencrypt/releases) archive and expand it in the desired directory. 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 \
</pre> </pre>
Please note that NameSilo DNS propagation takes up to **15 minutes**. The scripts will wait **20 minutes** before completing, just to be safe. Please note that NameSilo DNS propagation takes up to **15 minutes**. The scripts will wait **20 minutes** before completing, just to be safe.
q

View file

@ -58,7 +58,6 @@ rrhost = "_acme-challenge"
if "NAMESILO_API" in os.environ: if "NAMESILO_API" in os.environ:
apikey = os.environ['NAMESILO_API'] apikey = os.environ['NAMESILO_API']
tld = tldextract.extract(domain) tld = tldextract.extract(domain)
nsdomain = tld.domain + "." + tld.suffix nsdomain = tld.domain + "." + tld.suffix
if tld.subdomain: if tld.subdomain:
@ -72,9 +71,9 @@ req = urllib.request.Request(
url, url,
data=None, data=None,
headers={ 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) ' 'AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/73.0.3683.114 Safari/537.36') 'Chrome/80.0.3987.163 Safari/537.36')
} }
) )

View file

@ -44,7 +44,6 @@ from config import apikey
domain = os.environ['CERTBOT_DOMAIN'] 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: if "NAMESILO_API" in os.environ:
apikey = os.environ['NAMESILO_API'] apikey = os.environ['NAMESILO_API']
@ -54,6 +53,7 @@ nsdomain = tld.domain+"."+tld.suffix
url = "https://www.namesilo.com/api/dnsDeleteRecord\ 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): def getrequest(record_id):
return urllib.request.Request( return urllib.request.Request(
url + record_id, url + record_id,