diff --git a/certbot-dns-clean.py b/certbot-dns-clean.py new file mode 100755 index 0000000..b456ee6 --- /dev/null +++ b/certbot-dns-clean.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Created on Thu May 31 17:23:20 2018 + +@author: Pascal Gollor (https://gitbucket.pgollor.de) +""" + + +import os, sys, time + + +def main(): + d = os.environ.get('CERTBOT_DOMAIN') + if (not d): + sys.exit('CERTBOT_DOMAIN not set!') + # end if + + v = os.environ.get('CERTBOT_VALIDATION') + if (not v): + sys.exit('CERTBOT_VALIDATION not set!') + # end if + + # check domain + if (d.count('.') > 1): + sys.exit('Subdomains not supported!') + # end if + + dirName = os.path.dirname(os.path.abspath(sys.argv[0])) + cmd = dirName + "/update-record.py -c " + dirName + "/conf.cfg" + " -r TXT --delete _acme-challenge." + d; + os.system(cmd) + + # sleep to make sure the change has time to propagate over to DNS + time.sleep(25) +# end main + + +if __name__ == '__main__': + main() +# end if