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 <myself@marcg.pizza>
This commit is contained in:
parent
36c916750d
commit
cf46b9d581
2 changed files with 8 additions and 2 deletions
|
|
@ -2,10 +2,11 @@
|
||||||
# RECORDID="235890
|
# RECORDID="235890
|
||||||
# PASSWORD="verystrongpassword"
|
# PASSWORD="verystrongpassword"
|
||||||
# DOMAIN="sub.domain.tld"
|
# DOMAIN="sub.domain.tld"
|
||||||
|
# NAMESERVER="NameServerToQuery"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RECORDID=""
|
RECORDID=""
|
||||||
PASSWORD=""
|
PASSWORD=""
|
||||||
DOMAIN=""
|
DOMAIN=""
|
||||||
|
NAMESERVER="" #Blank for system NameServer
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,12 @@ set -e
|
||||||
|
|
||||||
IP="$(curl --connect-timeout 10 -s ipv4.is || curl --connect-timeout 10 -s ipv4.is)"
|
IP="$(curl --connect-timeout 10 -s ipv4.is || curl --connect-timeout 10 -s ipv4.is)"
|
||||||
#IP="$(curl --config /etc/lp-dyndns/curlrc)"
|
#IP="$(curl --config /etc/lp-dyndns/curlrc)"
|
||||||
|
if [ "${NAMESERVER}" = "" ];
|
||||||
|
then
|
||||||
CURRENTIP="$(dig ${DOMAIN} +short)"
|
CURRENTIP="$(dig ${DOMAIN} +short)"
|
||||||
|
else
|
||||||
|
CURRENTIP="$(dig @${NAMESERVER} ${DOMAIN} +short)"
|
||||||
|
fi
|
||||||
APIURL="https://freedns.linux.pizza/api/v1/remote/updatepw?record=${RECORDID}&password=${PASSWORD}&content=${IP}"
|
APIURL="https://freedns.linux.pizza/api/v1/remote/updatepw?record=${RECORDID}&password=${PASSWORD}&content=${IP}"
|
||||||
# Making stuff fancy
|
# Making stuff fancy
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue