nfsn-dns-certbot-auth
9067dadd
 #!/bin/sh
 set -euC
 
 # This is a naive guess. A better implementation would use e.g. the Public
 # Suffix List.
 re='\(\(.*\)\.\)\?\([^.]\+\.[^.]\+\)'
 domain="$(echo "$CERTBOT_DOMAIN" | sed -n "s/$re/\3/p")"
 name="$(echo "$CERTBOT_DOMAIN" | sed -n "s/$re/\2/p")"
 
 name="_acme-challenge${name:+".$name"}"
 data="$CERTBOT_VALIDATION"
 
 dir="$(cd "$(dirname "$0")" ; pwd)"
 
 "$dir/nfsn-send" "POST" "/dns/$domain/addRR" \
     "name" "$name" \
     "type" "TXT" \
     "data" "$data"
 
 sleep "${NFSN_DNS_CERTBOT_AUTH_SLEEP:-"30"}"