diff --git a/.gitignore b/.gitignore
index f007981..636e7ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,33 @@
-.vscode/*
+__pycache__
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/settings.json
!.vscode/tasks.json
-
-__pycache__
+!gradle-wrapper.jar
.classpath
.DS_Store
.gradle
.history
+.idea_modules/
+.idea/**/contentModel.xml
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/dataSources/
+.idea/**/dbnavigator.xml
+.idea/**/dictionaries
+.idea/**/dynamic.xml
+.idea/**/gradle.xml
+.idea/**/libraries
+.idea/**/mongoSettings.xml
+.idea/**/shelf
+.idea/**/sqlDataSources.xml
+.idea/**/tasks.xml
+.idea/**/uiDesigner.xml
+.idea/**/usage.statistics.xml
+.idea/**/workspace.xml
+.idea/caches/build_file_checksums.ser
+.idea/httpRequests
+.idea/replstate.xml
.kobalt
.mtj.tmp/
.mvn/timing.properties
@@ -17,39 +36,20 @@ __pycache__
.project
.scannerwork
.settings
+.vscode/*
*.class
*.code-workspace
*.ctxt
+*.ear
*.iws
+*.jar
*.log
*.nar
*.rar
*.sublime-*
*.tar.gz
+*.war
*.zip
-/**/.idea_modules/
-/**/.idea/**/caches/build_file_checksums.ser
-/**/.idea/**/contentModel.xml
-/**/.idea/**/dataSources.ids
-/**/.idea/**/dataSources.local.xml
-/**/.idea/**/dataSources/
-/**/.idea/**/dbnavigator.xml
-/**/.idea/**/dictionaries
-/**/.idea/**/dynamic.xml
-/**/.idea/**/gradle.xml
-/**/.idea/**/httpRequests
-/**/.idea/**/libraries
-/**/.idea/**/mongoSettings.xml
-/**/.idea/**/replstate.xml
-/**/.idea/**/shelf
-/**/.idea/**/shelf/
-/**/.idea/**/sqlDataSources.xml
-/**/.idea/**/tasks.xml
-/**/.idea/**/uiDesigner.xml
-/**/.idea/**/usage.statistics.xml
-/**/.idea/**/workspace.xml
-/**/.idea/$CACHE_FILE$
-/**/.idea/$PRODUCT_WORKSPACE_FILE$
atlassian-ide-plugin.xml
bin/
build/
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
deleted file mode 100644
index a55e7a1..0000000
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
certbot certonly --manual --email you@example.com \ @@ -42,4 +40,17 @@ certbot certonly --manual --email you@example.com \ -d *.example.com -d example.com-Please note that NameSilo DNS propagation takes up to **15 minutes**. The scripts will wait **25 minutes** before completing, just to be safe. +Or to renew an existing certificate: + +
+certbot renew --manual --email you@example.com \ +--agree-tos --manual-public-ip-logging-ok \ +--preferred-challenges=dns \ +--manual-auth-hook /path/to/authenticator.py \ +--manual-cleanup-hook /path/to/cleanup.py \ +-d *.example.com -d example.com ++ +Please note that NameSilo DNS propagation takes up to **15 minutes**, +so the scripts will wait 16 minutes before completing. + diff --git a/authenticator.py b/authenticator.py old mode 100755 new mode 100644 index 510aa1f..30d88e6 --- a/authenticator.py +++ b/authenticator.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3.7 # authenticator.py # -# Copyright (c) 2019-2020, Erik C. Thauvin (erik@thauvin.net) +# Copyright (c) 2019, Erik C. Thauvin (erik@thauvin.net) # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -22,14 +22,14 @@ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. +# ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. import os import sys @@ -37,41 +37,28 @@ import tempfile import time import urllib.request -import tldextract import untangle -from config import apikey, wait - - -def sleep(minutes): - if minutes < 16: - minutes = 16 - time.sleep(minutes * 60) - +from config import apikey domain = os.environ['CERTBOT_DOMAIN'] validation = os.environ['CERTBOT_VALIDATION'] -tmpdir = os.path.join(tempfile.gettempdir(), "CERTBOT_" + domain) -rrhost = "_acme-challenge" +tmpdir = os.path.join(tempfile.gettempdir(), f"CERTBOT_{domain}") if "NAMESILO_API" in os.environ: apikey = os.environ['NAMESILO_API'] -tld = tldextract.extract(domain) -nsdomain = tld.domain + "." + tld.suffix -if 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" +url = f"https://www.namesilo.com/api/dnsAddRecord?\ +version=1&type=xml&key={apikey}&domain={domain}&rrtype=TXT\ +&rrhost=_acme-challenge&rrvalue={validation}&rrttl=3600" req = urllib.request.Request( url, data=None, headers={ - 'User-Agent': ('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) ' - 'Gecko/20100101 Firefox/74.0') + 'User-Agent': ('Mozilla/5.0 (X11; CrOS x86_64 11647.154.0) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) ' + 'Chrome/73.0.3683.114 Safari/537.36') } ) @@ -92,5 +79,5 @@ else: xml.namesilo.reply.code.cdata), file=sys.stderr) sys.exit(1) -# Sleep X minutes -sleep(wait) +# Sleep 16 minutes +time.sleep(960) diff --git a/cleanup.py b/cleanup.py old mode 100755 new mode 100644 index c15d05c..27d38c4 --- a/cleanup.py +++ b/cleanup.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3.7 # cleanup.py # -# Copyright (c) 2019-2020, Erik C. Thauvin (erik@thauvin.net) +# Copyright (c) 2019, Erik C. Thauvin (erik@thauvin.net) # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -22,36 +22,32 @@ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. +# ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. import os import sys import tempfile import urllib.request -import tldextract 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(), f"CERTBOT_{domain}") if "NAMESILO_API" in os.environ: apikey = os.environ['NAMESILO_API'] -tld = tldextract.extract(domain) -nsdomain = tld.domain + "." + tld.suffix - -url = "https://www.namesilo.com/api/dnsDeleteRecord\ -?version=1&type=xml&key=" + apikey + "&domain=" + nsdomain + "&rrid=" +url = f"https://www.namesilo.com/api/dnsDeleteRecord\ +?version=1&type=xml&key={apikey}&domain={domain}&rrid=" def getrequest(record_id): @@ -59,8 +55,9 @@ def getrequest(record_id): url + record_id, data=None, headers={ - 'User-Agent': ('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) ' - 'Gecko/20100101 Firefox/74.0') + 'User-Agent': ('Mozilla/5.0 (X11; CrOS x86_64 11647.154.0) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) ' + 'Chrome/73.0.3683.114 Safari/537.36') } ) diff --git a/config.py b/config.py index 0bcd226..b30c1c3 100644 --- a/config.py +++ b/config.py @@ -1,4 +1,2 @@ -# Get your API Key from: https://www.namesilo.com/account/api-manager +# Get your API Key from: https://www.namesilo.com/account_api.php apikey = "YOUR_API_KEY" -# Minutes to wait for DNS changes to complete. -wait = 25 diff --git a/release.sh b/release.sh deleted file mode 100755 index 6689a1b..0000000 --- a/release.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -RELEASE=release - -if [ $# != 1 ]; -then - echo "Usage: $(basename "$0")