config/letsencrypt/dehydrated-nsupdate

25 lines
667 B
Bash
Executable File

#!/bin/sh
SCRIPT_TTL=30
if test "x$LE_SERVER" = x; then echo export LE_SERVER=ns.example.com; exit=1; fi
if test "x$LE_ZONE" = x; then echo export LE_ZONE=example.com; exit=1; fi
if test "x$LE_TSIGKEY" = x; then echo export LE_TSIGKEY=/path/to/key; exit=1; fi
if test "x$exit" = x1; then exit 1; fi
if test "x$1" = xdeploy_challenge; then
nsupdate -v -k "$LE_TSIGKEY" <<- NSUPDATE
server $LE_SERVER
zone $LE_ZONE
update add _acme-challenge.$2. $SCRIPT_TTL TXT $4
send
NSUPDATE
elif test "x$1" = xclean_challenge; then
nsupdate -v -k "$LE_TSIGKEY" <<- NSUPDATE
server $LE_SERVER
zone $LE_ZONE
update del _acme-challenge.$2. TXT
send
NSUPDATE
fi