diff --git a/README.md b/README.md index c47ccbb..23c5da1 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,13 @@ ## example usage ``` -certbot certonly --dry-run --manual --preferred-challenges=dns --manual-auth-hook ./certbot-dns-auth.sh -d example.com +certbot certonly --dry-run --manual --preferred-challenges=dns --manual-auth-hook [path to this repositry]/certbot-dns-auth.py -d example.com +``` + +A file `conf.cfg` with inwx settings must e exist like: +``` +[live] +url = https://api.domrobot.com/xmlrpc/ +username = [USERNAME] +password = [PASSWORD] ``` diff --git a/certbot-dns-auth.py b/certbot-dns-auth.py new file mode 100755 index 0000000..3ca61a1 --- /dev/null +++ b/certbot-dns-auth.py @@ -0,0 +1,37 @@ +#!/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 + + +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 _acme-challenge." + d + " " + v; + os.system(cmd) +# end main + + +if __name__ == '__main__': + main() +# end if \ No newline at end of file diff --git a/certbot-dns-auth.sh b/certbot-dns-auth.sh deleted file mode 100755 index d919891..0000000 --- a/certbot-dns-auth.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -python update-record.py -r TXT _acme-challenge.${CERTBOT_DOMAIN} $CERTBOT_VALIDATION