This commit is contained in:
2023-11-23 19:05:58 -06:00
parent 0f212a7150
commit 80e136c657
3 changed files with 26 additions and 7 deletions

View File

@@ -408,6 +408,7 @@ ADD_LOGROTATE_CRONTAB(){
}
UPDATE_DYNDNS(){
[ "${NM_DYNHOST}" != "" ] && PDNS_SERVER=${NM_DYNHOST} || PDNS_SERVER=${NM_WANDNS}
TESTMODE=0; FORCE=0;
while [ $# -gt 0 ]; do
case "${1}" in
@@ -437,7 +438,7 @@ UPDATE_DYNDNS(){
cw_spc=10
echo -e "Checking for DYNDNS update at '${idsCL[Green]}${LOCATION^^}${idsCL[Default]}'"
echo
echo -en "${idsCL[White]}Previous WAN IP : "; OLDIP=`dig +short ${DYNDNS_HOSTS[0]} @${NM_WANDNS} +time=2`; echo -e "${idsCL[Cyan]}${OLDIP}"
echo -en "${idsCL[White]}Previous WAN IP : "; OLDIP=`dig +short ${DYNDNS_HOSTS[0]} @${PDNS_SERVER} +time=2`; echo -e "${idsCL[Cyan]}${OLDIP}"
echo -en "${idsCL[White]}Current WAN IP : "; NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com +time=2`; echo -e "${idsCL[LightGreen]}${NEWIP}"
echo
@@ -452,9 +453,9 @@ UPDATE_DYNDNS(){
echo -en "${idsCL[Green]}'${idsCL[LightCyan]}${LOCATION^^}${idsCL[Green]}' WAN IP has changed, updating all pre-defined 'A' records ... "
fi
if [ "${NM_DYNUSER}" != "" ] && [ "${NM_DYNPASS}" != "" ]; then
if [ "$(curl -m 3 -sL "https://${NM_DYNUSER}df:${NM_DYNPASS}@${NM_WANDNS}/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
if [ "$(curl -m 3 -sL "https://${NM_DYNUSER}df:${NM_DYNPASS}@${PDNS_SERVER}/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
for host in ${DYNDNS_HOSTS[@]}; do
/usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@${NM_WANDNS}/nic/update?hostname=${host}&myip=${NEWIP}" > /dev/null 2>&1
/usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@${PDNS_SERVER}/nic/update?hostname=${host}&myip=${NEWIP}" > /dev/null 2>&1
done
[ "${LOCATION,,}" == "mainsite" ] && /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@${NM_LANDNS}/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1
[ "${LOCATION,,}" == "offsite" ] && /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@${NM_LANDNS}/nic/update?hostname=wan.offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1
@@ -484,7 +485,7 @@ UPDATE_DYNDNS(){
fi
if [ ${TESTMODE} -eq 1 ]; then
echo -en "\nDYNDNS Credential Test: "
if [ "$(curl -m 3 -sL "https://${NM_DYNUSER}df:${NM_DYNPASS}@${NM_WANDNS}/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
if [ "$(curl -m 3 -sL "https://${NM_DYNUSER}df:${NM_DYNPASS}@${PDNS_SERVER}/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
echo -e "${idsCL[Green]}Pass${idsCL[Default]}"
else
echo -e "${idsCL[LightRed]}Fail${idsCL[Default]}"