Skip to content

Commit cf46b9d

Browse files
committed
Add option to specify remote NameServer to query.
This helps in the case that the NameServer on the system running lp-ddns uses a local NameServer and resolves to local IP for the domain in question. Signed-off-by: Marc Grondin <[email protected]>
1 parent 36c9167 commit cf46b9d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lp-ddns/etc/lp-dyndns/settings.conf

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
# RECORDID="235890
33
# PASSWORD="verystrongpassword"
44
# DOMAIN="sub.domain.tld"
5-
5+
# NAMESERVER="NameServerToQuery"
66

77

88

99
RECORDID=""
1010
PASSWORD=""
1111
DOMAIN=""
12+
NAMESERVER="" #Blank for system NameServer

lp-ddns/usr/local/bin/lp-ddns

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ set -e
1414

1515
IP="$(curl --connect-timeout 10 -s ipv4.is || curl --connect-timeout 10 -s ipv4.is)"
1616
#IP="$(curl --config /etc/lp-dyndns/curlrc)"
17-
CURRENTIP="$(dig ${DOMAIN} +short)"
17+
if [ "${NAMESERVER}" = "" ];
18+
then
19+
CURRENTIP="$(dig ${DOMAIN} +short)"
20+
else
21+
CURRENTIP="$(dig @${NAMESERVER} ${DOMAIN} +short)"
22+
fi
1823
APIURL="https://freedns.linux.pizza/api/v1/remote/updatepw?record=${RECORDID}&password=${PASSWORD}&content=${IP}"
1924
# Making stuff fancy
2025
NC='\033[0m'

0 commit comments

Comments
 (0)