1
0
Fork 0

Experimental certbot DNS-01 challenge

This commit is contained in:
Luca Beltrame 2019-01-22 23:03:52 +01:00
parent cfa95b82f4
commit 3a05dd0256
Signed by: einar
GPG key ID: 8DF631FD021DB0C5
2 changed files with 75 additions and 0 deletions

36
certbot_cleanup.py Normal file
View 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()

View 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()