certbot_knot_hooks/remote-server-cleanup.sh

10 lines
419 B
Bash
Executable File

#!/bin/bash
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" > /tmp/cerbot_ddns_cleanup
knsupdate /tmp/certbot_ddns_cleanup
[[ ${?} == 0 ]] && rm -f /tmp/certbot_ddns_cleanup