From 2895e8dec53b0e09f7d5a02bf77399a63ee91a2a Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Tue, 15 Dec 2020 13:24:57 -0600 Subject: new file: DO_NOT_LOOSE_ME new file: godaddy_add_txt.py new file: godaddy_del_txt.py new file: push.sh new file: renew_certificate.sh --- godaddy_add_txt.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 godaddy_add_txt.py (limited to 'godaddy_add_txt.py') diff --git a/godaddy_add_txt.py b/godaddy_add_txt.py new file mode 100755 index 0000000..4733bb1 --- /dev/null +++ b/godaddy_add_txt.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +import requests +import json +from os import environ +from time import sleep + +if not 'CERTBOT_DOMAIN' in environ: + print("Environment variable CERTBOT_DOMAIN is not set.\nMake sure you're running this script as a certbot hook.") + exit(1) + +if not 'CERTBOT_VALIDATION' in environ: + print("Environment variable CERTBOT_VALIDATION is not set.\nMake sure you're running this script as a certbot hook.") + exit(1) + +domain = environ['CERTBOT_DOMAIN'] +validation = environ['CERTBOT_VALIDATION'] + +key = 'e4NBykPszU4u_AQSkww3bDD4mBYUn4jERAL' +secret = 'Wg9Pr9Du82cPU3FP6H6CNr' + +s = requests.session() +s.headers.update({ + 'Authorization' : "sso-key {}:{}".format(key, secret) + }) + +data = {"name": "_acme-challenge", + "data": validation, + "ttl": 600, + "type": "TXT"} + +r = s.patch("https://api.godaddy.com/v1/domains/{}/records".format(domain), json = [data]) + +sleep(20) -- cgit v1.2.3