Experimental certbot DNS-01 challenge
This commit is contained in:
parent
cfa95b82f4
commit
3a05dd0256
2 changed files with 75 additions and 0 deletions
36
certbot_cleanup.py
Normal file
36
certbot_cleanup.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
IWANTMYNAME_ENDPOINT = "https://iwantmyname.com/basicauth/ddns"
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
with open("/etc/letsencrypt/credentials") as handle:
|
||||||
|
user, password = handle.read().strip().split()
|
||||||
|
|
||||||
|
domain = os.environ["CERTBOT_DOMAIN"]
|
||||||
|
validation_token = os.environ["CERTBOT_VALIDATION"]
|
||||||
|
|
||||||
|
print("DEBUG", domain, validation_token)
|
||||||
|
|
||||||
|
if "*." in domain:
|
||||||
|
domain = domain.replace("*.", "")
|
||||||
|
|
||||||
|
subdomain = f"_acme-challenge.{domain}"
|
||||||
|
|
||||||
|
params = {
|
||||||
|
"hostname": subdomain,
|
||||||
|
"type": "txt",
|
||||||
|
"value": "delete"
|
||||||
|
}
|
||||||
|
|
||||||
|
req = requests.get(IWANTMYNAME_ENDPOINT, params=params,
|
||||||
|
auth=(user, password))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
39
certbot_dns_iwantmyname.py
Normal file
39
certbot_dns_iwantmyname.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
IWANTMYNAME_ENDPOINT = "https://iwantmyname.com/basicauth/ddns"
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
with open("/etc/letsencrypt/credentials") as handle:
|
||||||
|
user, password = handle.read().strip().split()
|
||||||
|
|
||||||
|
domain = os.environ["CERTBOT_DOMAIN"]
|
||||||
|
validation_token = os.environ["CERTBOT_VALIDATION"]
|
||||||
|
|
||||||
|
print("DEBUG", domain, validation_token)
|
||||||
|
|
||||||
|
if "*." in domain:
|
||||||
|
domain = domain.replace("*.", "")
|
||||||
|
|
||||||
|
subdomain = f"_acme-challenge.{domain}"
|
||||||
|
|
||||||
|
params = {
|
||||||
|
"hostname": subdomain,
|
||||||
|
"type": "txt",
|
||||||
|
"value": validation_token
|
||||||
|
}
|
||||||
|
|
||||||
|
req = requests.get(IWANTMYNAME_ENDPOINT, params=params,
|
||||||
|
auth=(user, password))
|
||||||
|
|
||||||
|
time.sleep(30)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Add table
Reference in a new issue