Merge pull request #1916 from chris5560/master
ddns-scripts: rollup to version 2.5.0-1
This commit is contained in:
commit
b261ef65cf
10 changed files with 1114 additions and 108 deletions
|
@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=ddns-scripts
|
PKG_NAME:=ddns-scripts
|
||||||
# Version == major.minor.patch
|
# Version == major.minor.patch
|
||||||
# increase on new functionality (minor) or patches (patch)
|
# increase on new functionality (minor) or patches (patch)
|
||||||
PKG_VERSION:=2.4.3
|
PKG_VERSION:=2.5.0
|
||||||
# Release == build
|
# Release == build
|
||||||
# increase on changes of services files or tld_names.dat
|
# increase on changes of services files or tld_names.dat
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#
|
#
|
||||||
# Please read ddns.sample
|
# Please read http://wiki.openwrt.org/doc/uci/ddns
|
||||||
# or http://wiki.openwrt.org/doc/uci/ddns
|
|
||||||
#
|
#
|
||||||
config ddns "global"
|
config ddns "global"
|
||||||
option date_format "%F %R"
|
option date_format "%F %R"
|
||||||
|
@ -12,6 +11,7 @@ config ddns "global"
|
||||||
|
|
||||||
config service "myddns_ipv4"
|
config service "myddns_ipv4"
|
||||||
option service_name "dyndns.com"
|
option service_name "dyndns.com"
|
||||||
|
option lookup_host "yourhost.example.com"
|
||||||
option domain "yourhost.example.com"
|
option domain "yourhost.example.com"
|
||||||
option username "your_username"
|
option username "your_username"
|
||||||
option password "your_password"
|
option password "your_password"
|
||||||
|
@ -21,6 +21,7 @@ config service "myddns_ipv4"
|
||||||
|
|
||||||
config service "myddns_ipv6"
|
config service "myddns_ipv6"
|
||||||
option update_url "http://[USERNAME]:[PASSWORD]@your.provider.net/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
option update_url "http://[USERNAME]:[PASSWORD]@your.provider.net/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
option lookup_host "yourhost.example.com"
|
||||||
option domain "yourhost.example.com"
|
option domain "yourhost.example.com"
|
||||||
option username "your_username"
|
option username "your_username"
|
||||||
option password "your_password"
|
option password "your_password"
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
# GLOBAL VARIABLES #
|
# GLOBAL VARIABLES #
|
||||||
|
VERSION="2.5.0-1"
|
||||||
SECTION_ID="" # hold config's section name
|
SECTION_ID="" # hold config's section name
|
||||||
VERBOSE_MODE=1 # default mode is log to console, but easily changed with parameter
|
VERBOSE_MODE=1 # default mode is log to console, but easily changed with parameter
|
||||||
|
|
||||||
|
@ -53,6 +54,9 @@ LOCAL_IP="" # holds the local IP read from the box
|
||||||
|
|
||||||
URL_USER="" # url encoded $username from config file
|
URL_USER="" # url encoded $username from config file
|
||||||
URL_PASS="" # url encoded $password from config file
|
URL_PASS="" # url encoded $password from config file
|
||||||
|
URL_PENC="" # url encoded $param_enc from config file
|
||||||
|
|
||||||
|
SRV_ANSWER="" # Answer given by service on success
|
||||||
|
|
||||||
ERR_LAST=0 # used to save $? return code of program and function calls
|
ERR_LAST=0 # used to save $? return code of program and function calls
|
||||||
ERR_UPDATE=0 # error counter on different local and registered ip
|
ERR_UPDATE=0 # error counter on different local and registered ip
|
||||||
|
@ -299,40 +303,38 @@ urlencode() {
|
||||||
# file /usr/lib/ddns/services_ipv6 for IPv6
|
# file /usr/lib/ddns/services_ipv6 for IPv6
|
||||||
# $1 Name of Variable to store url to
|
# $1 Name of Variable to store url to
|
||||||
# $2 Name of Variable to store script to
|
# $2 Name of Variable to store script to
|
||||||
|
# $3 Name of Variable to store service answer to
|
||||||
get_service_data() {
|
get_service_data() {
|
||||||
local __LINE __FILE __NAME __URL __SERVICES __DATA
|
[ $# -ne 3 ] && write_log 12 "Error calling 'get_service_data()' - wrong number of parameters"
|
||||||
local __SCRIPT=""
|
|
||||||
local __OLD_IFS=$IFS
|
|
||||||
local __NEWLINE_IFS='
|
|
||||||
' # __NEWLINE_IFS
|
|
||||||
[ $# -ne 2 ] && write_log 12 "Error calling 'get_service_data()' - wrong number of parameters"
|
|
||||||
|
|
||||||
__FILE="/usr/lib/ddns/services" # IPv4
|
__FILE="/usr/lib/ddns/services" # IPv4
|
||||||
[ $use_ipv6 -ne 0 ] && __FILE="/usr/lib/ddns/services_ipv6" # IPv6
|
[ $use_ipv6 -ne 0 ] && __FILE="/usr/lib/ddns/services_ipv6" # IPv6
|
||||||
|
|
||||||
# remove any lines not containing data, and then make sure fields are enclosed in double quotes
|
# workaround with variables; pipe create subshell with no give back of variable content
|
||||||
__SERVICES=$(cat $__FILE | grep "^[\t ]*[^#]" | \
|
mkfifo pipe_$$
|
||||||
awk ' gsub("\x27", "\"") { if ($1~/^[^\"]*$/) $1="\""$1"\"" }; { if ( $NF~/^[^\"]*$/) $NF="\""$NF"\"" }; { print $0 }')
|
# only grep without # or whitespace at linestart | remove "
|
||||||
|
# grep -v -E "(^#|^[[:space:]]*$)" $__FILE | sed -e s/\"//g > pipe_$$ &
|
||||||
|
sed '/^#/d/^[ \t]*$/ds/\"//g' $__FILE > pipe_$$ &
|
||||||
|
|
||||||
IFS=$__NEWLINE_IFS
|
while read __SERVICE __DATA __ANSWER; do
|
||||||
for __LINE in $__SERVICES; do
|
if [ "$__SERVICE" = "$service_name" ]; then
|
||||||
# grep out proper parts of data and use echo to remove quotes
|
# check if URL or SCRIPT is given
|
||||||
__NAME=$(echo $__LINE | grep -o "^[\t ]*\"[^\"]*\"" | xargs -r -n1 echo)
|
__URL=$(echo "$__DATA" | grep "^http")
|
||||||
__DATA=$(echo $__LINE | grep -o "\"[^\"]*\"[\t ]*$" | xargs -r -n1 echo)
|
[ -z "$__URL" ] && __SCRIPT="/usr/lib/ddns/$__DATA"
|
||||||
|
|
||||||
if [ "$__NAME" = "$service_name" ]; then
|
eval "$1=\"$__URL\""
|
||||||
break # found so leave for loop
|
eval "$2=\"$__SCRIPT\""
|
||||||
|
eval "$3=\"$__ANSWER\""
|
||||||
|
rm pipe_$$
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done < pipe_$$
|
||||||
IFS=$__OLD_IFS
|
rm pipe_$$
|
||||||
|
|
||||||
# check if URL or SCRIPT is given
|
eval "$1=\"\"" # no service match clear variables
|
||||||
__URL=$(echo "$__DATA" | grep "^http")
|
eval "$2=\"\""
|
||||||
[ -z "$__URL" ] && __SCRIPT="/usr/lib/ddns/$__DATA"
|
eval "$3=\"\""
|
||||||
|
return 1
|
||||||
eval "$1=\"$__URL\""
|
|
||||||
eval "$2=\"$__SCRIPT\""
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Calculate seconds from interval and unit
|
# Calculate seconds from interval and unit
|
||||||
|
@ -793,19 +795,19 @@ send_update() {
|
||||||
local __URL __ERR
|
local __URL __ERR
|
||||||
|
|
||||||
# do replaces in URL
|
# do replaces in URL
|
||||||
__URL=$(echo $update_url | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
__URL=$(echo $update_url | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
||||||
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
|
-e "s#\[PARAMENC\]#$URL_PENC#g" -e "s#\[PARAMOPT\]#$param_opt#g" \
|
||||||
|
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
|
||||||
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
|
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
|
||||||
|
|
||||||
do_transfer "$__URL" || return 1
|
do_transfer "$__URL" || return 1
|
||||||
|
|
||||||
write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)"
|
write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)"
|
||||||
|
|
||||||
return 0
|
[ -z "$SRV_ANSWER" ] && return 0 # not set then ignore
|
||||||
# TODO analyze providers answer
|
|
||||||
# "good" or "nochg" = dyndns.com compatible API
|
grep -i -E "$SRV_ANSWER" $DATFILE >/dev/null 2>&1
|
||||||
# grep -i -E "good|nochg" $DATFILE >/dev/null 2>&1
|
return $? # "0" if found
|
||||||
# return $? # "0" if found
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,13 +945,13 @@ get_registered_ip() {
|
||||||
fi
|
fi
|
||||||
[ $force_dnstcp -eq 1 ] && __PROG="$__PROG -T" # force TCP
|
[ $force_dnstcp -eq 1 ] && __PROG="$__PROG -T" # force TCP
|
||||||
|
|
||||||
__RUNPROG="$__PROG $domain $dns_server >$DATFILE 2>$ERRFILE"
|
__RUNPROG="$__PROG $lookup_host $dns_server >$DATFILE 2>$ERRFILE"
|
||||||
__PROG="BIND host"
|
__PROG="BIND host"
|
||||||
elif [ -x /usr/bin/nslookup ]; then # last use BusyBox nslookup
|
elif [ -x /usr/bin/nslookup ]; then # last use BusyBox nslookup
|
||||||
[ $force_ipversion -ne 0 -o $force_dnstcp -ne 0 ] && \
|
[ $force_ipversion -ne 0 -o $force_dnstcp -ne 0 ] && \
|
||||||
write_log 14 "Busybox nslookup - no support to 'force IP Version' or 'DNS over TCP'"
|
write_log 14 "Busybox nslookup - no support to 'force IP Version' or 'DNS over TCP'"
|
||||||
|
|
||||||
__RUNPROG="/usr/bin/nslookup $domain $dns_server >$DATFILE 2>$ERRFILE"
|
__RUNPROG="/usr/bin/nslookup $lookup_host $dns_server >$DATFILE 2>$ERRFILE"
|
||||||
__PROG="BusyBox nslookup"
|
__PROG="BusyBox nslookup"
|
||||||
else # there must be an error
|
else # there must be an error
|
||||||
write_log 12 "Error in 'get_registered_ip()' - no supported Name Server lookup software accessible"
|
write_log 12 "Error in 'get_registered_ip()' - no supported Name Server lookup software accessible"
|
||||||
|
@ -981,16 +983,16 @@ get_registered_ip() {
|
||||||
[ -n "$2" ] && return $__ERR # $2 is given -> no retry
|
[ -n "$2" ] && return $__ERR # $2 is given -> no retry
|
||||||
[ $VERBOSE_MODE -gt 1 ] && {
|
[ $VERBOSE_MODE -gt 1 ] && {
|
||||||
# VERBOSE_MODE > 1 then NO retry
|
# VERBOSE_MODE > 1 then NO retry
|
||||||
write_log 4 "Get registered/public IP for '$domain' failed - Verbose Mode: $VERBOSE_MODE - NO retry on error"
|
write_log 4 "Get registered/public IP for '$lookup_host' failed - Verbose Mode: $VERBOSE_MODE - NO retry on error"
|
||||||
return $__ERR
|
return $__ERR
|
||||||
}
|
}
|
||||||
|
|
||||||
__CNT=$(( $__CNT + 1 )) # increment error counter
|
__CNT=$(( $__CNT + 1 )) # increment error counter
|
||||||
# if error count > retry_count leave here
|
# if error count > retry_count leave here
|
||||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
|
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
|
||||||
write_log 14 "Get registered/public IP for '$domain' failed after $retry_count retries"
|
write_log 14 "Get registered/public IP for '$lookup_host' failed after $retry_count retries"
|
||||||
|
|
||||||
write_log 4 "Get registered/public IP for '$domain' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
|
write_log 4 "Get registered/public IP for '$lookup_host' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
|
||||||
sleep $RETRY_SECONDS &
|
sleep $RETRY_SECONDS &
|
||||||
PID_SLEEP=$!
|
PID_SLEEP=$!
|
||||||
wait $PID_SLEEP # enable trap-handler
|
wait $PID_SLEEP # enable trap-handler
|
||||||
|
|
|
@ -33,7 +33,7 @@ __RET=0
|
||||||
case "$1" in
|
case "$1" in
|
||||||
get_registered_ip)
|
get_registered_ip)
|
||||||
local IP
|
local IP
|
||||||
domain=$2 # Hostname/Domain
|
lookup_host=$2 # FQDN of host registered at DDNS
|
||||||
use_ipv6=${3:-"0"} # Use IPv6 - default IPv4
|
use_ipv6=${3:-"0"} # Use IPv6 - default IPv4
|
||||||
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
|
force_ipversion=${4:-"0"} # Force IP Version - default 0 - No
|
||||||
force_dnstcp=${5:-"0"} # Force TCP on DNS - default 0 - No
|
force_dnstcp=${5:-"0"} # Force TCP on DNS - default 0 - No
|
||||||
|
@ -99,4 +99,4 @@ esac
|
||||||
# remove out and err file
|
# remove out and err file
|
||||||
[ -f $DATFILE ] && rm -f $DATFILE
|
[ -f $DATFILE ] && rm -f $DATFILE
|
||||||
[ -f $ERRFILE ] && rm -f $ERRFILE
|
[ -f $ERRFILE ] && rm -f $ERRFILE
|
||||||
return $__RET
|
return $__RET
|
||||||
|
|
50
net/ddns-scripts/files/dynamic_dns_updater.sh
Normal file → Executable file
50
net/ddns-scripts/files/dynamic_dns_updater.sh
Normal file → Executable file
|
@ -22,9 +22,14 @@
|
||||||
# variables in big chars beginning with "__" are local defined inside functions only
|
# variables in big chars beginning with "__" are local defined inside functions only
|
||||||
# set -vx #script debugger
|
# set -vx #script debugger
|
||||||
|
|
||||||
|
. /usr/lib/ddns/dynamic_dns_functions.sh # global vars are also defined here
|
||||||
|
|
||||||
[ $# -lt 1 -o -n "${2//[0-3]/}" -o ${#2} -gt 1 ] && {
|
[ $# -lt 1 -o -n "${2//[0-3]/}" -o ${#2} -gt 1 ] && {
|
||||||
|
echo -e "\n ddns-scripts Version: $VERSION"
|
||||||
echo -e "\n USAGE:"
|
echo -e "\n USAGE:"
|
||||||
echo -e " $0 [SECTION] [VERBOSE_MODE]\n"
|
echo " $0 [OPTION]"
|
||||||
|
echo " [OPTION] '-V' or '--version' display version and exit"
|
||||||
|
echo -e "\n $0 [SECTION] [VERBOSE_MODE]\n"
|
||||||
echo " [SECTION] - service section as defined in /etc/config/ddns"
|
echo " [SECTION] - service section as defined in /etc/config/ddns"
|
||||||
echo " [VERBOSE_MODE] - '0' NO output to console"
|
echo " [VERBOSE_MODE] - '0' NO output to console"
|
||||||
echo " '1' output to console"
|
echo " '1' output to console"
|
||||||
|
@ -36,7 +41,10 @@
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
. /usr/lib/ddns/dynamic_dns_functions.sh # global vars are also defined here
|
[ "$1" = "-V" -o "$1" = "--version" ] && {
|
||||||
|
echo -e "ddns-scripts $VERSION\n"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
SECTION_ID="$1"
|
SECTION_ID="$1"
|
||||||
VERBOSE_MODE=${2:-1} # default mode is log to console
|
VERBOSE_MODE=${2:-1} # default mode is log to console
|
||||||
|
@ -77,9 +85,12 @@ trap "trap_handler 15" 15 # SIGTERM Termination
|
||||||
# update_url URL to use to update your "custom" DDNS service
|
# update_url URL to use to update your "custom" DDNS service
|
||||||
# update_script SCRIPT to use to update your "custom" DDNS service
|
# update_script SCRIPT to use to update your "custom" DDNS service
|
||||||
#
|
#
|
||||||
# domain Your DNS name / replace [DOMAIN] in update_url
|
# lookup_host FQDN of ONE of your at DDNS service defined host / required to validate if IP update happen/necessary
|
||||||
# username Username of your DDNS service account / replace [USERNAME] in update_url
|
# domain Nomally your DDNS hostname / replace [DOMAIN] in update_url
|
||||||
# password Password of your DDNS service account / replace [PASSWORD] in update_url
|
# username Username of your DDNS service account / urlenceded and replace [USERNAME] in update_url
|
||||||
|
# password Password of your DDNS service account / urlencoded and replace [PASSWORD] in update_url
|
||||||
|
# param_enc Optional parameter for (later) usage / urlencoded and replace [PARAMENC] in update_url
|
||||||
|
# param_opt Optional parameter for (later) usage / replace [PARAMOPT] in update_url
|
||||||
#
|
#
|
||||||
# use_https use HTTPS to update DDNS service
|
# use_https use HTTPS to update DDNS service
|
||||||
# cacert file or directory where HTTPS can find certificates to verify server; 'IGNORE' ignore check of server certificate
|
# cacert file or directory where HTTPS can find certificates to verify server; 'IGNORE' ignore check of server certificate
|
||||||
|
@ -140,14 +151,16 @@ ERR_LAST=$? # save return code - equal 0 if SECTION_ID found
|
||||||
[ -f $LOGFILE ] && rm -f $LOGFILE # clear logfile before first entry
|
[ -f $LOGFILE ] && rm -f $LOGFILE # clear logfile before first entry
|
||||||
write_log 7 "************ ************** ************** **************"
|
write_log 7 "************ ************** ************** **************"
|
||||||
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
||||||
|
write_log 7 "ddns version : $VERSION"
|
||||||
write_log 7 "uci configuration:\n$(uci -q show ddns | grep '=service' | sort)"
|
write_log 7 "uci configuration:\n$(uci -q show ddns | grep '=service' | sort)"
|
||||||
write_log 14 "Service section '$SECTION_ID' not defined"
|
write_log 14 "Service section '$SECTION_ID' not defined"
|
||||||
}
|
}
|
||||||
|
|
||||||
write_log 7 "************ ************** ************** **************"
|
write_log 7 "************ ************** ************** **************"
|
||||||
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
||||||
|
write_log 7 "ddns version : $VERSION"
|
||||||
write_log 7 "uci configuration:\n$(uci -q show ddns.$SECTION_ID | sort)"
|
write_log 7 "uci configuration:\n$(uci -q show ddns.$SECTION_ID | sort)"
|
||||||
write_log 7 "ddns version : $(opkg list-installed ddns-scripts | cut -d ' ' -f 3)"
|
# write_log 7 "ddns version : $(opkg list-installed ddns-scripts | cut -d ' ' -f 3)"
|
||||||
case $VERBOSE_MODE in
|
case $VERBOSE_MODE in
|
||||||
0) write_log 7 "verbose mode : 0 - run normal, NO console output";;
|
0) write_log 7 "verbose mode : 0 - run normal, NO console output";;
|
||||||
1) write_log 7 "verbose mode : 1 - run normal, console mode";;
|
1) write_log 7 "verbose mode : 1 - run normal, console mode";;
|
||||||
|
@ -162,24 +175,41 @@ esac
|
||||||
# determine what update url we're using if a service_name is supplied
|
# determine what update url we're using if a service_name is supplied
|
||||||
# otherwise update_url is set inside configuration (custom update url)
|
# otherwise update_url is set inside configuration (custom update url)
|
||||||
# or update_script is set inside configuration (custom update script)
|
# or update_script is set inside configuration (custom update script)
|
||||||
[ -n "$service_name" ] && get_service_data update_url update_script
|
[ -n "$service_name" ] && get_service_data update_url update_script SRV_ANSWER
|
||||||
[ -z "$update_url" -a -z "$update_script" ] && write_log 14 "No update_url found/defined or no update_script found/defined!"
|
[ -z "$update_url" -a -z "$update_script" ] && write_log 14 "No update_url found/defined or no update_script found/defined!"
|
||||||
[ -n "$update_script" -a ! -f "$update_script" ] && write_log 14 "Custom update_script not found!"
|
[ -n "$update_script" -a ! -f "$update_script" ] && write_log 14 "Custom update_script not found!"
|
||||||
|
|
||||||
# without domain and possibly username and password we can do nothing for you
|
# temporary needed to convert existing uci settings
|
||||||
[ -z "$domain" ] && write_log 14 "Service section not configured correctly! Missing 'domain'"
|
[ -z "$lookup_host" ] && {
|
||||||
|
uci -q set ddns.$SECTION_ID.lookup_host="$domain"
|
||||||
|
uci -q commit ddns
|
||||||
|
lookup_host="$domain"
|
||||||
|
}
|
||||||
|
# later versions only check if configured correctly
|
||||||
|
|
||||||
|
# without lookup host and possibly other required options we can do nothing for you
|
||||||
|
[ -z "$lookup_host" ] && write_log 14 "Service section not configured correctly! Missing 'lookup_host'"
|
||||||
|
|
||||||
[ -n "$update_url" ] && {
|
[ -n "$update_url" ] && {
|
||||||
# only check if update_url is given, update_scripts have to check themselves
|
# only check if update_url is given, update_scripts have to check themselves
|
||||||
|
[ -z "$domain" ] && $(echo "$update_url" | grep "\[DOMAIN\]" >/dev/null 2>&1) && \
|
||||||
|
write_log 14 "Service section not configured correctly! Missing 'domain'"
|
||||||
[ -z "$username" ] && $(echo "$update_url" | grep "\[USERNAME\]" >/dev/null 2>&1) && \
|
[ -z "$username" ] && $(echo "$update_url" | grep "\[USERNAME\]" >/dev/null 2>&1) && \
|
||||||
write_log 14 "Service section not configured correctly! Missing 'username'"
|
write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||||
[ -z "$password" ] && $(echo "$update_url" | grep "\[PASSWORD\]" >/dev/null 2>&1) && \
|
[ -z "$password" ] && $(echo "$update_url" | grep "\[PASSWORD\]" >/dev/null 2>&1) && \
|
||||||
write_log 14 "Service section not configured correctly! Missing 'password'"
|
write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||||
|
[ -z "$param_enc" ] && $(echo "$update_url" | grep "\[PARAMENC\]" >/dev/null 2>&1) && \
|
||||||
|
write_log 14 "Service section not configured correctly! Missing 'param_enc'"
|
||||||
|
[ -z "$param_opt" ] && $(echo "$update_url" | grep "\[PARAMOPT\]" >/dev/null 2>&1) && \
|
||||||
|
write_log 14 "Service section not configured correctly! Missing 'param_opt'"
|
||||||
}
|
}
|
||||||
|
|
||||||
# url encode username (might be email or something like this)
|
# url encode username (might be email or something like this)
|
||||||
# and password (might have special chars for security reason)
|
# and password (might have special chars for security reason)
|
||||||
|
# and optional parameter "param_enc"
|
||||||
[ -n "$username" ] && urlencode URL_USER "$username"
|
[ -n "$username" ] && urlencode URL_USER "$username"
|
||||||
[ -n "$password" ] && urlencode URL_PASS "$password"
|
[ -n "$password" ] && urlencode URL_PASS "$password"
|
||||||
|
[ -n "$param_enc" ] && urlencode URL_PENC "$param_enc"
|
||||||
|
|
||||||
# verify ip_source 'script' if script is configured and executable
|
# verify ip_source 'script' if script is configured and executable
|
||||||
if [ "$ip_source" = "script" ]; then
|
if [ "$ip_source" = "script" ]; then
|
||||||
|
@ -289,7 +319,7 @@ while : ; do
|
||||||
&& write_log 6 "Update successful - IP '$LOCAL_IP' send" \
|
&& write_log 6 "Update successful - IP '$LOCAL_IP' send" \
|
||||||
|| write_log 6 "Forced update successful - IP: '$LOCAL_IP' send"
|
|| write_log 6 "Forced update successful - IP: '$LOCAL_IP' send"
|
||||||
else
|
else
|
||||||
write_log 3 "Can not update IP at DDNS Provider"
|
write_log 3 "IP update not accepted by DDNS Provider"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -46,18 +46,18 @@
|
||||||
"dnsexit.com" "http://www.dnsexit.com/RemoteUpdate.sv?login=[USERNAME]&password=[PASSWORD]&host=[DOMAIN]&myip=[IP]"
|
"dnsexit.com" "http://www.dnsexit.com/RemoteUpdate.sv?login=[USERNAME]&password=[PASSWORD]&host=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
# OVH
|
# OVH
|
||||||
"ovh.com" "http://[USERNAME]:[PASSWORD]@www.ovh.com/nic/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]"
|
"ovh.com" "http://[USERNAME]:[PASSWORD]@www.ovh.com/nic/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
# dns-o-matic is a free service by opendns.com for updating multiple hosts and
|
# dns-o-matic is a free service by opendns.com for updating multiple hosts and
|
||||||
# dynamic dns services in one api call. To update all your configured services
|
# dynamic dns services in one api call. To update all your configured services
|
||||||
# at once, use "all.dnsomatic.com as the hostname.
|
# at once, use "all.dnsomatic.com as the hostname.
|
||||||
"dnsomatic.com" "http://[USERNAME]:[PASSWORD]@updates.dnsomatic.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
"dnsomatic.com" "http://[USERNAME]:[PASSWORD]@updates.dnsomatic.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
# 3322.org
|
# 3322.org
|
||||||
"3322.org" "http://[USERNAME]:[PASSWORD]@members.3322.org/dyndns/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]"
|
"3322.org" "http://[USERNAME]:[PASSWORD]@members.3322.org/dyndns/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
# namecheap.com
|
# namecheap.com
|
||||||
"namecheap.com" "http://dynamicdns.park-your-domain.com/update?host=[USERNAME]&domain=[DOMAIN]&password=[PASSWORD]&ip=[IP]"
|
"namecheap.com" "http://dynamicdns.park-your-domain.com/update?host=[USERNAME]&domain=[DOMAIN]&password=[PASSWORD]&ip=[IP]"
|
||||||
|
|
||||||
# easydns.com dynamic DNS
|
# easydns.com dynamic DNS
|
||||||
"easydns.com" "http://[USERNAME]:[PASSWORD]@api.cp.easydns.com/dyn/tomato.php?hostname=[DOMAIN]&myip=[IP]"
|
"easydns.com" "http://[USERNAME]:[PASSWORD]@api.cp.easydns.com/dyn/tomato.php?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
@ -69,28 +69,35 @@
|
||||||
"mythic-beasts.com" "http://dnsapi4.mythic-beasts.com/?domain=[USERNAME]&password=[PASSWORD]&command=REPLACE%20[DOMAIN]%2060%20A%20DYNAMIC_IP"
|
"mythic-beasts.com" "http://dnsapi4.mythic-beasts.com/?domain=[USERNAME]&password=[PASSWORD]&command=REPLACE%20[DOMAIN]%2060%20A%20DYNAMIC_IP"
|
||||||
|
|
||||||
# Securepoint Dynamic-DNS-Service (http://www.spdns.de)
|
# Securepoint Dynamic-DNS-Service (http://www.spdns.de)
|
||||||
"spdns.de" "http://[USERNAME]:[PASSWORD]@update.spdns.de/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
"spdns.de" "http://[USERNAME]:[PASSWORD]@update.spdns.de/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||||
|
|
||||||
# duiadns.net - free dynamic DNS
|
# duiadns.net - free dynamic DNS
|
||||||
"duiadns.net" "http://ipv4.duia.ro/dynamic.duia?host=[DOMAIN]&password=[PASSWORD]&ip4=[IP]"
|
"duiadns.net" "http://ipv4.duia.ro/dynamic.duia?host=[DOMAIN]&password=[PASSWORD]&ip4=[IP]"
|
||||||
|
|
||||||
# Two-DNS - Simply. Connected. Everywhere.
|
# Two-DNS - Simply. Connected. Everywhere.
|
||||||
"twodns.de" "http://[USERNAME]:[PASSWORD]@update.twodns.de/update?hostname=[DOMAIN]&ip=[IP]"
|
"twodns.de" "http://[USERNAME]:[PASSWORD]@update.twodns.de/update?hostname=[DOMAIN]&ip=[IP]"
|
||||||
|
|
||||||
# MyDNS.JP
|
# MyDNS.JP
|
||||||
"mydns.jp" "http://www.mydns.jp/directip.html?MID=[USERNAME]&PWD=[PASSWORD]&IPV4ADDR=[IP]"
|
"mydns.jp" "http://www.mydns.jp/directip.html?MID=[USERNAME]&PWD=[PASSWORD]&IPV4ADDR=[IP]"
|
||||||
|
|
||||||
# LoopiaDNS
|
# LoopiaDNS
|
||||||
"loopia.se" "http://[USERNAME]:[PASSWORD]@dns.loopia.se/XDynDNSServer/XDynDNS.php?system=custom&hostname=[DOMAIN]&myip=[IP]"
|
"loopia.se" "http://[USERNAME]:[PASSWORD]@dns.loopia.se/XDynDNSServer/XDynDNS.php?system=custom&hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
# SelfHost.de
|
# SelfHost.de
|
||||||
"selfhost.de" "http://carol.selfhost.de/update?username=[USERNAME]&password=[PASSWORD]&myip=[IP]&hostname=1"
|
"selfhost.de" "http://carol.selfhost.de/update?username=[USERNAME]&password=[PASSWORD]&myip=[IP]&hostname=1" "good|nochg"
|
||||||
|
|
||||||
# no-ip.pl nothing to do with no-ip.com (domain registered to www.domeny.tv) (IP autodetected by provider)
|
# no-ip.pl nothing to do with no-ip.com (domain registered to www.domeny.tv) (IP autodetected by provider)
|
||||||
"no-ip.pl" "http://[USERNAME]:[PASSWORD]@update.no-ip.pl/?hostname=[DOMAIN]"
|
"no-ip.pl" "http://[USERNAME]:[PASSWORD]@update.no-ip.pl/?hostname=[DOMAIN]"
|
||||||
|
|
||||||
# domains.google.com non free service - require HTTPS communication
|
# domains.google.com non free service - require HTTPS communication
|
||||||
"domains.google.com" "https://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
"domains.google.com" "http://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
# Schokokeks Hosting, schokokeks.org
|
# Schokokeks Hosting, schokokeks.org
|
||||||
"schokokeks.org" "http://[USERNAME]:[PASSWORD]@dyndns.schokokeks.org/nic/update?myip=[IP]"
|
"schokokeks.org" "http://[USERNAME]:[PASSWORD]@dyndns.schokokeks.org/nic/update?myip=[IP]"
|
||||||
|
|
||||||
|
# STRATO AG
|
||||||
|
"strato.de" "http://[USERNAME]:[PASSWORD]@dyndns.strato.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
|
# Variomedia AG
|
||||||
|
"variomedia.de" "http://[USERNAME]:[PASSWORD]@dyndns.variomedia.de/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
# 66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
|
# 66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||||
|
|
||||||
# IPv6 @ Securepoint Dynamic-DNS-Service
|
# IPv6 @ Securepoint Dynamic-DNS-Service
|
||||||
"spdns.de" "http://[USERNAME]:[PASSWORD]@update.spdns.de/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
"spdns.de" "http://[USERNAME]:[PASSWORD]@update.spdns.de/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||||
|
|
||||||
# IPv6 @ Hurricane Electric Dynamic DNS
|
# IPv6 @ Hurricane Electric Dynamic DNS
|
||||||
"he.net" "http://[DOMAIN]:[PASSWORD]@dyn.dns.he.net/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
"he.net" "http://[DOMAIN]:[PASSWORD]@dyn.dns.he.net/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
@ -41,3 +41,7 @@
|
||||||
|
|
||||||
# IPv6 @ LoopiaDNS
|
# IPv6 @ LoopiaDNS
|
||||||
"loopia.se" "http://[USERNAME]:[PASSWORD]@dns.loopia.se/XDynDNSServer/XDynDNS.php?system=custom&hostname=[DOMAIN]&myip=[IP]"
|
"loopia.se" "http://[USERNAME]:[PASSWORD]@dns.loopia.se/XDynDNSServer/XDynDNS.php?system=custom&hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
|
# Variomedia AG
|
||||||
|
"variomedia.de" "http://[USERNAME]:[PASSWORD]@dyndns.variomedia.de/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -115,9 +115,13 @@ config service "myddns"
|
||||||
# option update_script ""
|
# option update_script ""
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# You must specify your domain/host name, your username and your password
|
# Keep an eye on providers help pages.
|
||||||
# as you get from you DDNS provider. Keep an eye on providers help pages.
|
|
||||||
#
|
#
|
||||||
|
# FQDN of ONE of your defined host at DDNS provider
|
||||||
|
# REQUIRED to verify what the current IP at DNS using nslookup/host command
|
||||||
|
# default: none
|
||||||
|
option lookup_host ""
|
||||||
|
|
||||||
# Your DNS name / replace [DOMAIN] in update_url
|
# Your DNS name / replace [DOMAIN] in update_url
|
||||||
# default: none
|
# default: none
|
||||||
option domain ""
|
option domain ""
|
||||||
|
@ -126,10 +130,21 @@ config service "myddns"
|
||||||
# default: none
|
# default: none
|
||||||
option username ""
|
option username ""
|
||||||
|
|
||||||
# Password of your DDNS service account / replace [PASSWORD] in update_url
|
# Password of your DDNS service account / replace [PASSWORD] in update url
|
||||||
# default: none
|
# default: none
|
||||||
option password ""
|
option password ""
|
||||||
|
|
||||||
|
###########
|
||||||
|
# Optional parameters for use inside update_url
|
||||||
|
#
|
||||||
|
# parameter that will be urlencoded before replacement of [PARAMENC] inside update url
|
||||||
|
# default: none
|
||||||
|
option param_enc ""
|
||||||
|
|
||||||
|
# parameter that repace [PARAMOPT] inside update url
|
||||||
|
# default: none
|
||||||
|
option param_opt ""
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# use HTTPS for secure communication with you DDNS provider
|
# use HTTPS for secure communication with you DDNS provider
|
||||||
# personally found some providers having problems when not sending
|
# personally found some providers having problems when not sending
|
||||||
|
|
|
@ -18,13 +18,15 @@
|
||||||
#
|
#
|
||||||
# tested with spdns.de
|
# tested with spdns.de
|
||||||
local __URL="http://[USERNAME]:[PASSWORD]@update.spdns.de/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
local __URL="http://[USERNAME]:[PASSWORD]@update.spdns.de/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
# inside url we need username and password
|
# inside url we need domain, username and password
|
||||||
|
[ -z "$domain" ] && write_log 14 "Service section not configured correctly! Missing 'domain'"
|
||||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||||
|
|
||||||
# do replaces in URL
|
# do replaces in URL
|
||||||
__URL=$(echo $__URL | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
__URL=$(echo $__URL | | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
|
||||||
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
|
-e "s#\[PARAMENC\]#$URL_PENC#g" -e "s#\[PARAMOPT\]#$param_opt#g" \
|
||||||
|
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
|
||||||
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
|
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
|
||||||
|
|
||||||
do_transfer "$__URL" || return 1
|
do_transfer "$__URL" || return 1
|
||||||
|
@ -34,6 +36,6 @@ write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)"
|
||||||
# analyse provider answers
|
# analyse provider answers
|
||||||
# "good [IP_ADR]" = successful
|
# "good [IP_ADR]" = successful
|
||||||
# "nochg [IP_ADR]" = no change but OK
|
# "nochg [IP_ADR]" = no change but OK
|
||||||
grep -E "good|nochg" $DATFILE >/dev/null 2>&1
|
grep -i -E "good|nochg" $DATFILE >/dev/null 2>&1
|
||||||
return $? # "0" if "good" or "nochg" found
|
return $? # "0" if "good" or "nochg" found
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue