Browse Source

Interface to `nsupdate -l`

Configurationless operation when `nsupdate -l` works
pull/945/head
Marcel Waldvogel 8 years ago
parent
commit
5d263126ec
  1. 36
      dnsapi/dns_nsupdate_l.sh

36
dnsapi/dns_nsupdate_l.sh

@ -0,0 +1,36 @@
#!/usr/bin/env sh
######## Public functions #####################
#Usage: dns_nsupdate_l_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_nsupdate_l_add() {
fulldomain=$1
txtvalue=$2
_info "adding ${fulldomain}. 60 in txt \"${txtvalue}\""
nsupdate -l <<EOF
update add ${fulldomain}. 60 in txt "${txtvalue}"
send
EOF
if [ $? -ne 0 ]; then
_err "error updating domain"
return 1
fi
return 0
}
#Usage: dns_nsupdate_l_rm _acme-challenge.www.domain.com
dns_nsupdate_l_rm() {
fulldomain=$1
_info "removing ${fulldomain}. txt"
nsupdate -l <<EOF
update delete ${fulldomain}. txt
send
EOF
if [ $? -ne 0 ]; then
_err "error updating domain"
return 1
fi
return 0
}
Loading…
Cancel
Save