This commit is contained in:
2023-11-15 14:33:51 -06:00
parent 68c7e5c5ef
commit 2ab3901144
2 changed files with 9 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
VERS='4.14.11-11142023'
VERS='4.14.13-11152023'
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update '
CERT_DAEMON='/snap/bin/certbot'
@@ -111,6 +111,8 @@ NM_LOGFILE=${NM_LOGFOLDER}/logfile
[ "${NM_RENOTIFY_TIMEOUT}" == "" ] && NM_RENOTIFY_TIMEOUT=3600
NM_WANDNS='wdns.scity.us'
NM_LANDNS='ldns.scity.us'
TSI=$(/sbin/ip link | grep tailscale0) && [ ${#TSI} != 0 ] && RUN_NODE_TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) || RUN_NODE_TSIP=
[ "$(ip route | awk '/default/ { print $5 }')" == "link" ] && RNIP=$(ip addr show $(ip route | awk '/1 dev eth0/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) ||

View File

@@ -517,7 +517,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]} @wdns.scity.us +time=2`; echo -e "${idsCL[Cyan]}${OLDIP}"
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]}Current WAN IP : "; NEWIP=`dig +short myip.opendns.com @resolver1.opendns.com +time=2`; echo -e "${idsCL[LightGreen]}${NEWIP}"
echo
@@ -532,12 +532,12 @@ 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}@wdns.scity.us/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
if [ "$(curl -m 3 -sL "https://${NM_DYNUSER}df:${NM_DYNPASS}@${NM_WANDNS}/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
for host in ${DYNDNS_HOSTS[@]}; do
/usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@wdns.scity.us/nic/update?hostname=${host}&myip=${NEWIP}" > /dev/null 2>&1
/usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@${NM_WANDNS}/nic/update?hostname=${host}&myip=${NEWIP}" > /dev/null 2>&1
done
[ "${LOCATION,,}" == "mainsite" ] && /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@ldns.scity.us/nic/update?hostname=sc1.scity.us&myip=${NEWIP}" > /dev/null 2>&1
[ "${LOCATION,,}" == "offsite" ] && /usr/bin/curl -s "https://${NM_DYNUSER}:${NM_DYNPASS}@ldns.scity.us/nic/update?hostname=wan.offsite.scity.us&myip=${NEWIP}" > /dev/null 2>&1
[ "${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
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
else
echo -e "\n\n${idsCL[LightRed]}INVALID DYNDNS username and/or password (NM_DYNUSER=${NM_DYNUSER}) (NM_DYNPASS=${NM_DYNPASS})\n"
@@ -564,7 +564,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}@wdns.scity.us/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
if [ "$(curl -m 3 -sL "https://${NM_DYNUSER}df:${NM_DYNPASS}@${NM_WANDNS}/domain/${domain}" | grep "HTTP 403 Error")" == "" ]; then
echo -e "${idsCL[Green]}Pass${idsCL[Default]}"
else
echo -e "${idsCL[LightRed]}Fail${idsCL[Default]}"