certbot_knot_hooks/remote-server-authenticator...

11 lines
486 B
Bash
Executable File

#!/bin/bash
set -x
export CERTBOT_DOMAIN=${1}
export CERTBOT_VALIDATION=${2}
DOMAIN=$(expr match "$CERTBOT_DOMAIN" '.*\.\(.*\..*\)')
CHALLENGE_DOMAIN="_acme-challenge.${CERTBOT_DOMAIN}"
[[ -z ${DOMAIN} ]] && export DOMAIN=${CERTBOT_DOMAIN}
sed -e "s DOMAIN_NAME ${DOMAIN} g" -e "s SUBDOMAIN ${CERTBOT_DOMAIN} g" -e "s VALIDATION_STRING ${CERTBOT_VALIDATION} g" ddns_update > /tmp/certbot_ddns_update
knsupdate /tmp/certbot_ddns_update
[[ ${?} == 0 ]] && rm -f /tmp/certbot_ddns_update