Compare commits
14 commits
Author | SHA1 | Date | |
---|---|---|---|
08f7f8d87b | |||
9f5f0c5642 | |||
b5e27de90d | |||
03f68df7ec | |||
2f5be01ec9 | |||
94caed2d98 | |||
e0fc2e71fa | |||
|
d680a58068 | ||
|
1867401b35 | ||
474ada35e8 | |||
c0aaaefd11 | |||
97c2f0581f | |||
94aa40f848 | |||
6f97aa0f97 |
15 changed files with 169 additions and 93 deletions
52
.gitignore
vendored
52
.gitignore
vendored
|
@ -1,33 +1,14 @@
|
||||||
__pycache__
|
.vscode/*
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!gradle-wrapper.jar
|
|
||||||
|
__pycache__
|
||||||
.classpath
|
.classpath
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.gradle
|
.gradle
|
||||||
.history
|
.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
|
.kobalt
|
||||||
.mtj.tmp/
|
.mtj.tmp/
|
||||||
.mvn/timing.properties
|
.mvn/timing.properties
|
||||||
|
@ -36,20 +17,39 @@ __pycache__
|
||||||
.project
|
.project
|
||||||
.scannerwork
|
.scannerwork
|
||||||
.settings
|
.settings
|
||||||
.vscode/*
|
|
||||||
*.class
|
*.class
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
*.ctxt
|
*.ctxt
|
||||||
*.ear
|
|
||||||
*.iws
|
*.iws
|
||||||
*.jar
|
|
||||||
*.log
|
*.log
|
||||||
*.nar
|
*.nar
|
||||||
*.rar
|
*.rar
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.war
|
|
||||||
*.zip
|
*.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
|
atlassian-ide-plugin.xml
|
||||||
bin/
|
bin/
|
||||||
build/
|
build/
|
||||||
|
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
2
.idea/copyright/Erik_s_Copyright_Notice.xml
generated
2
.idea/copyright/Erik_s_Copyright_Notice.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
<option name="notice" value="&#36;file.fileName Copyright (c) &#36;today.year, Erik C. Thauvin (erik@thauvin.net) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of this project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 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 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 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." />
|
<option name="notice" value="&#36;file.fileName Copyright (c) 2019-&#36;today.year, Erik C. Thauvin (erik@thauvin.net) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of this project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 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 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 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." />
|
||||||
<option name="myName" value="Erik's Copyright Notice" />
|
<option name="myName" value="Erik's Copyright Notice" />
|
||||||
</copyright>
|
</copyright>
|
||||||
</component>
|
</component>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
@ -3,5 +3,5 @@
|
||||||
<component name="JavaScriptSettings">
|
<component name="JavaScriptSettings">
|
||||||
<option name="languageLevel" value="ES6" />
|
<option name="languageLevel" value="ES6" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (namesilo-letsencrypt)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
6
.idea/namesilo-letsencrypt.iml
generated
6
.idea/namesilo-letsencrypt.iml
generated
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="Flask">
|
||||||
|
<option name="enabled" value="false" />
|
||||||
|
</component>
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
@ -7,7 +10,4 @@
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestRunnerService">
|
|
||||||
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
|
|
||||||
</component>
|
|
||||||
</module>
|
</module>
|
25
CHANGELOG.md
Normal file
25
CHANGELOG.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# 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)*
|
12
LICENSE.md
12
LICENSE.md
|
@ -1,12 +0,0 @@
|
||||||
### Copyright © 2019, [Erik C. Thauvin](mailto:erik@thauvin.net)
|
|
||||||
#### All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of this project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
*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 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 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.*
|
|
27
LICENSE.txt
Normal file
27
LICENSE.txt
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Copyright (c) 2019-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
used to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
|
||||||
|
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 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 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.
|
31
README.md
31
README.md
|
@ -1,7 +1,7 @@
|
||||||
# NameSilo Let's Encrypt
|
# NameSilo Let's Encrypt
|
||||||
|
|
||||||
[](http://opensource.org/licenses/BSD-3-Clause)
|
[](https://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,19 +9,21 @@ 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/) library, 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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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.php)
|
Add your [NameSilo API key](https://www.namesilo.com/account/api-manager)
|
||||||
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.php
|
# Get your API Key from: https://www.namesilo.com/account/api-manager
|
||||||
apikey = "YOUR_API_KEY"
|
apikey = "YOUR_API_KEY"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -29,7 +31,7 @@ Alternatively, the API key can be set in the `NAMESILO_API` environment variable
|
||||||
|
|
||||||
## Using with Certbot
|
## Using with Certbot
|
||||||
|
|
||||||
To issue a new certificate using the hook scripts, try something like:
|
To issue or renew a certificate using the hook scripts, try something like:
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
certbot certonly --manual --email you@example.com \
|
certbot certonly --manual --email you@example.com \
|
||||||
|
@ -40,17 +42,4 @@ certbot certonly --manual --email you@example.com \
|
||||||
-d *.example.com -d example.com
|
-d *.example.com -d example.com
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
Or to renew an existing certificate:
|
Please note that NameSilo DNS propagation takes up to **15 minutes**. The scripts will wait **25 minutes** before completing, just to be safe.
|
||||||
|
|
||||||
<pre>
|
|
||||||
certbot renew --manual --email you@example.com \
|
|
||||||
--agree-tos --manual-public-ip-logging-ok \
|
|
||||||
--preferred-challenges=dns \
|
|
||||||
--manual-auth-hook <em>/path/to/authenticator.py</em> \
|
|
||||||
--manual-cleanup-hook <em>/path/to/cleanup.py</em> \
|
|
||||||
-d *.example.com -d example.com
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
Please note that NameSilo DNS propagation takes up to **15 minutes**,
|
|
||||||
so the scripts will wait 16 minutes before completing.
|
|
||||||
|
|
||||||
|
|
41
authenticator.py
Normal file → Executable file
41
authenticator.py
Normal file → Executable file
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python3.7
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# authenticator.py
|
# authenticator.py
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019, Erik C. Thauvin (erik@thauvin.net)
|
# Copyright (c) 2019-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
# ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -37,28 +37,41 @@ import tempfile
|
||||||
import time
|
import time
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
|
import tldextract
|
||||||
import untangle
|
import untangle
|
||||||
|
|
||||||
from config import apikey
|
from config import apikey, wait
|
||||||
|
|
||||||
|
|
||||||
|
def sleep(minutes):
|
||||||
|
if minutes < 16:
|
||||||
|
minutes = 16
|
||||||
|
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(), f"CERTBOT_{domain}")
|
tmpdir = os.path.join(tempfile.gettempdir(), "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']
|
||||||
|
|
||||||
url = f"https://www.namesilo.com/api/dnsAddRecord?\
|
tld = tldextract.extract(domain)
|
||||||
version=1&type=xml&key={apikey}&domain={domain}&rrtype=TXT\
|
nsdomain = tld.domain + "." + tld.suffix
|
||||||
&rrhost=_acme-challenge&rrvalue={validation}&rrttl=3600"
|
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"
|
||||||
|
|
||||||
req = urllib.request.Request(
|
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; rv:74.0) '
|
||||||
'AppleWebKit/537.36 (KHTML, like Gecko) '
|
'Gecko/20100101 Firefox/74.0')
|
||||||
'Chrome/73.0.3683.114 Safari/537.36')
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -79,5 +92,5 @@ else:
|
||||||
xml.namesilo.reply.code.cdata), file=sys.stderr)
|
xml.namesilo.reply.code.cdata), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Sleep 16 minutes
|
# Sleep X minutes
|
||||||
time.sleep(960)
|
sleep(wait)
|
||||||
|
|
23
cleanup.py
Normal file → Executable file
23
cleanup.py
Normal file → Executable file
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python3.7
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# cleanup.py
|
# cleanup.py
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019, Erik C. Thauvin (erik@thauvin.net)
|
# Copyright (c) 2019-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -28,26 +28,30 @@
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
# ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
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(), f"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']
|
||||||
|
|
||||||
url = f"https://www.namesilo.com/api/dnsDeleteRecord\
|
tld = tldextract.extract(domain)
|
||||||
?version=1&type=xml&key={apikey}&domain={domain}&rrid="
|
nsdomain = tld.domain + "." + tld.suffix
|
||||||
|
|
||||||
|
url = "https://www.namesilo.com/api/dnsDeleteRecord\
|
||||||
|
?version=1&type=xml&key=" + apikey + "&domain=" + nsdomain + "&rrid="
|
||||||
|
|
||||||
|
|
||||||
def getrequest(record_id):
|
def getrequest(record_id):
|
||||||
|
@ -55,9 +59,8 @@ def getrequest(record_id):
|
||||||
url + record_id,
|
url + record_id,
|
||||||
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; rv:74.0) '
|
||||||
'AppleWebKit/537.36 (KHTML, like Gecko) '
|
'Gecko/20100101 Firefox/74.0')
|
||||||
'Chrome/73.0.3683.114 Safari/537.36')
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
# Get your API Key from: https://www.namesilo.com/account_api.php
|
# Get your API Key from: https://www.namesilo.com/account/api-manager
|
||||||
apikey = "YOUR_API_KEY"
|
apikey = "YOUR_API_KEY"
|
||||||
|
# Minutes to wait for DNS changes to complete.
|
||||||
|
wait = 25
|
||||||
|
|
24
release.sh
Executable file
24
release.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/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
|
BIN
release/namesilo-letsencrypt-0.9.2.tar.gz
Normal file
BIN
release/namesilo-letsencrypt-0.9.2.tar.gz
Normal file
Binary file not shown.
BIN
release/namesilo-letsencrypt-0.9.2.zip
Normal file
BIN
release/namesilo-letsencrypt-0.9.2.zip
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue