Compare commits
No commits in common. "master" and "0.9.1" have entirely different histories.
9 changed files with 27 additions and 83 deletions
2
.idea/namesilo-letsencrypt.iml
generated
2
.idea/namesilo-letsencrypt.iml
generated
|
@ -7,7 +7,7 @@
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
25
CHANGELOG.md
25
CHANGELOG.md
|
@ -1,25 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
## [0.9.2](https://github.com/ethauvin/namesilo-letsencrypt/tree/0.9.2) (2020-05-28)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/namesilo-letsencrypt/compare/0.9.1...0.9.2)
|
|
||||||
|
|
||||||
**Closed issues:**
|
|
||||||
|
|
||||||
- Do not support multiple \_acme-challenge records [\#1](https://github.com/ethauvin/namesilo-letsencrypt/issues/1)
|
|
||||||
|
|
||||||
**Merged pull requests:**
|
|
||||||
|
|
||||||
- make python3.4 compatible. add subdomains support [\#2](https://github.com/ethauvin/namesilo-letsencrypt/pull/2) ([Junker](https://github.com/Junker))
|
|
||||||
|
|
||||||
## [0.9.1](https://github.com/ethauvin/namesilo-letsencrypt/tree/0.9.1) (2020-03-15)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/namesilo-letsencrypt/compare/0.9.0...0.9.1)
|
|
||||||
|
|
||||||
## [0.9.0](https://github.com/ethauvin/namesilo-letsencrypt/tree/0.9.0) (2019-04-30)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/namesilo-letsencrypt/compare/8a91146faebd196b223f7653e470428130f26246...0.9.0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
|
15
README.md
15
README.md
|
@ -1,7 +1,7 @@
|
||||||
# NameSilo Let's Encrypt
|
# NameSilo Let's Encrypt
|
||||||
|
|
||||||
[](https://opensource.org/licenses/BSD-3-Clause)
|
[](http://opensource.org/licenses/BSD-3-Clause)
|
||||||
[](https://www.python.org/)
|
[](https://www.python.org/)
|
||||||
|
|
||||||
Python scripts (hook) to automate obtaining [Let's Encrypt](https://letsencrypt.org/) certificates,
|
Python scripts (hook) to automate obtaining [Let's Encrypt](https://letsencrypt.org/) certificates,
|
||||||
using [Certbot](https://certbot.eff.org/) DNS-01 challenge validation for domains DNS hosted on
|
using [Certbot](https://certbot.eff.org/) DNS-01 challenge validation for domains DNS hosted on
|
||||||
|
@ -9,21 +9,22 @@ using [Certbot](https://certbot.eff.org/) DNS-01 challenge validation for domain
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
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:
|
The scripts use the [untangle](https://untangle.readthedocs.io/en/latest/) library, if not already installed on your system:
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install tldextract untangle
|
pip install untangle
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Add your [NameSilo API key](https://www.namesilo.com/account/api-manager)
|
Add your [NameSilo API key](https://www.namesilo.com/account_api.php)
|
||||||
to the top of the `config.py` file:
|
to the top of the `config.py` file:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# 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"
|
apikey = "YOUR_API_KEY"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -42,4 +43,4 @@ certbot certonly --manual --email you@example.com \
|
||||||
-d *.example.com -d example.com
|
-d *.example.com -d example.com
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
Please note that NameSilo DNS propagation takes up to **15 minutes**. The scripts will wait **25 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.
|
||||||
|
|
23
authenticator.py
Executable file → Normal file
23
authenticator.py
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3.8
|
||||||
|
|
||||||
# authenticator.py
|
# authenticator.py
|
||||||
#
|
#
|
||||||
|
@ -37,7 +37,6 @@ import tempfile
|
||||||
import time
|
import time
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
import tldextract
|
|
||||||
import untangle
|
import untangle
|
||||||
|
|
||||||
from config import apikey, wait
|
from config import apikey, wait
|
||||||
|
@ -46,32 +45,28 @@ from config import apikey, wait
|
||||||
def sleep(minutes):
|
def sleep(minutes):
|
||||||
if minutes < 16:
|
if minutes < 16:
|
||||||
minutes = 16
|
minutes = 16
|
||||||
|
print("Waiting", minutes, "minutes for DNS changes to complete...")
|
||||||
time.sleep(minutes * 60)
|
time.sleep(minutes * 60)
|
||||||
|
|
||||||
|
|
||||||
domain = os.environ['CERTBOT_DOMAIN']
|
domain = os.environ['CERTBOT_DOMAIN']
|
||||||
validation = os.environ['CERTBOT_VALIDATION']
|
validation = os.environ['CERTBOT_VALIDATION']
|
||||||
tmpdir = os.path.join(tempfile.gettempdir(), "CERTBOT_" + domain)
|
tmpdir = os.path.join(tempfile.gettempdir(), f"CERTBOT_{domain}")
|
||||||
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)
|
url = f"https://www.namesilo.com/api/dnsAddRecord?\
|
||||||
nsdomain = tld.domain + "." + tld.suffix
|
version=1&type=xml&key={apikey}&domain={domain}&rrtype=TXT\
|
||||||
if tld.subdomain:
|
&rrhost=_acme-challenge&rrvalue={validation}&rrttl=3600"
|
||||||
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"
|
|
||||||
|
|
||||||
req = urllib.request.Request(
|
req = urllib.request.Request(
|
||||||
url,
|
url,
|
||||||
data=None,
|
data=None,
|
||||||
headers={
|
headers={
|
||||||
'User-Agent': ('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) '
|
'User-Agent': ('Mozilla/5.0 (X11; CrOS x86_64 11647.154.0) '
|
||||||
'Gecko/20100101 Firefox/74.0')
|
'AppleWebKit/537.36 (KHTML, like Gecko) '
|
||||||
|
'Chrome/73.0.3683.114 Safari/537.36')
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
17
cleanup.py
Executable file → Normal file
17
cleanup.py
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3.8
|
||||||
|
|
||||||
# cleanup.py
|
# cleanup.py
|
||||||
#
|
#
|
||||||
|
@ -36,22 +36,18 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
import tldextract
|
|
||||||
import untangle
|
import untangle
|
||||||
|
|
||||||
from config import apikey
|
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(), f"CERTBOT_{domain}")
|
||||||
|
|
||||||
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)
|
url = f"https://www.namesilo.com/api/dnsDeleteRecord\
|
||||||
nsdomain = tld.domain + "." + tld.suffix
|
?version=1&type=xml&key={apikey}&domain={domain}&rrid="
|
||||||
|
|
||||||
url = "https://www.namesilo.com/api/dnsDeleteRecord\
|
|
||||||
?version=1&type=xml&key=" + apikey + "&domain=" + nsdomain + "&rrid="
|
|
||||||
|
|
||||||
|
|
||||||
def getrequest(record_id):
|
def getrequest(record_id):
|
||||||
|
@ -59,8 +55,9 @@ def getrequest(record_id):
|
||||||
url + record_id,
|
url + record_id,
|
||||||
data=None,
|
data=None,
|
||||||
headers={
|
headers={
|
||||||
'User-Agent': ('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) '
|
'User-Agent': ('Mozilla/5.0 (X11; CrOS x86_64 11647.154.0) '
|
||||||
'Gecko/20100101 Firefox/74.0')
|
'AppleWebKit/537.36 (KHTML, like Gecko) '
|
||||||
|
'Chrome/73.0.3683.114 Safari/537.36')
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# 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"
|
apikey = "YOUR_API_KEY"
|
||||||
# Minutes to wait for DNS changes to complete.
|
# Minutes to wait for DNS changes to complete.
|
||||||
wait = 25
|
wait = 20
|
||||||
|
|
24
release.sh
24
release.sh
|
@ -1,24 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
RELEASE=release
|
|
||||||
|
|
||||||
if [ $# != 1 ];
|
|
||||||
then
|
|
||||||
echo "Usage: $(basename "$0") <version>"
|
|
||||||
exit 2
|
|
||||||
else
|
|
||||||
if ! [ -d "$RELEASE" ]
|
|
||||||
then
|
|
||||||
mkdir "$RELEASE"
|
|
||||||
fi
|
|
||||||
PROJECT=$(basename "$(pwd)")
|
|
||||||
DIR="${PROJECT}-${1}"
|
|
||||||
mkdir "$DIR"
|
|
||||||
cp ./*.py ./*.md ./*.txt "$DIR"
|
|
||||||
dos2unix "$DIR"/*.*
|
|
||||||
touch "$DIR" "$DIR"/*.*
|
|
||||||
tar -czvf "${RELEASE}/${DIR}.tar.gz" "$DIR"
|
|
||||||
zip --to-crlf -r "${RELEASE}/${DIR}.zip" "$DIR"
|
|
||||||
touch "$RELEASE"/*.*
|
|
||||||
rm -rf "${DIR}"
|
|
||||||
fi
|
|
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue