Skip to content

Commit

Permalink
Support specifying local ip address (and optional port) in nsupdate
Browse files Browse the repository at this point in the history
FIXES #801
  • Loading branch information
tlhackque committed Mar 19, 2024
1 parent 518d0f1 commit d1a833b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dns_scripts/dns_add_nsupdate
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ token="$2"
# DNS_NSUPDATE_GETKEY - command to execute if access to the key file requires
# some special action: mounting a disk, decrypting a file..
# Called with the operation 'add' and action 'open" / 'close'

# DNS_NSUPDATE_LOCALIP - IP source address for update (TSIG is preferred) Can be address<space>port.

if [ -n "${DNS_NSUPDATE_KEYFILE}" ]; then
if [ -n "${DNS_NSUPDATE_KEY_HOOK}" ] && ! ${DNS_NSUPDATE_KEY_HOOK} 'add' 'open' "${fulldomain}" ; then
Expand All @@ -26,6 +26,7 @@ if [ -n "${DNS_SERVER}" ]; then
cmd+="server ${DNS_SERVER}\n"
fi

[ -n "$DNS_NSUPDATE_LOCALIP" ] && cmd+="local ${DNS_NSUPDATE_LOCALIP}\n"
cmd+="update add ${DNS_ZONE:-"_acme-challenge.${fulldomain}."} 300 in TXT \"${token}\"\n"
cmd+="\n" # blank line is a "send" command to nsupdate

Expand Down
2 changes: 2 additions & 0 deletions dns_scripts/dns_del_nsupdate
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ token="$2"
# some special action: dismounting a disk, encrypting a
# file... Called with the operation 'del' and action
# 'open" / 'close'
# DNS_NSUPDATE_LOCALIP - IP source address for update (TSIG is preferred) Can be address<space>port.

if [ -n "${DNS_NSUPDATE_KEYFILE}" ]; then
if [ -n "${DNS_NSUPDATE_KEY_HOOK}" ] && ! "${DNS_NSUPDATE_KEY_HOOK}" 'del' 'open' "${fulldomain}" ; then
Expand All @@ -26,6 +27,7 @@ if [ -n "${DNS_SERVER}" ]; then
cmd+="server ${DNS_SERVER}\n"
fi

[ -n "$DNS_NSUPDATE_LOCALIP" ] && cmd+="local ${DNS_NSUPDATE_LOCALIP}\n"
cmd+="update delete ${DNS_ZONE:-"_acme-challenge.${fulldomain}."} 300 in TXT \"${token}\"\n"
cmd+="\n" # blank line is a "send" command to nsupdate

Expand Down

0 comments on commit d1a833b

Please sign in to comment.