Merge pull request #792 from chris5560/master
ddns-scripts: Update to Version 2.1.0-5
This commit is contained in:
commit
0d5c284b49
10 changed files with 141 additions and 126 deletions
|
@ -2,8 +2,9 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ddns-scripts
|
PKG_NAME:=ddns-scripts
|
||||||
PKG_VERSION:=2.1.0
|
PKG_VERSION:=2.1.0
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=5
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
||||||
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
|
@ -15,7 +16,6 @@ define Package/ddns-scripts
|
||||||
SUBMENU:=IP Addresses and Names
|
SUBMENU:=IP Addresses and Names
|
||||||
TITLE:=Dynamic DNS Scripts (with IPv6 support)
|
TITLE:=Dynamic DNS Scripts (with IPv6 support)
|
||||||
PKGARCH:=all
|
PKGARCH:=all
|
||||||
MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/ddns-scripts/description
|
define Package/ddns-scripts/description
|
||||||
|
@ -28,7 +28,6 @@ A highly configurable set of scripts for doing dynamic dns updates.
|
||||||
- Proxy server support
|
- Proxy server support
|
||||||
- log file support
|
- log file support
|
||||||
- support to run once
|
- support to run once
|
||||||
Version: $(PKG_VERSION)-$(PKG_RELEASE)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
# variables in small chars are read from /etc/config/ddns
|
# variables in small chars are read from /etc/config/ddns
|
||||||
# variables in big chars are defined inside these scripts as global vars
|
# variables in big chars are defined inside these scripts as global vars
|
||||||
# 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
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
@ -32,12 +32,12 @@
|
||||||
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
|
||||||
|
|
||||||
# allow NON-public IP's
|
# allow NON-public IP's
|
||||||
ALLOW_LOCAL_IP=$(uci -q get ddns.global.allow_local_ip) || ALLOW_LOCAL_IP=0
|
ALLOW_LOCAL_IP=$(uci -q get ddns.global.allow_local_ip) || ALLOW_LOCAL_IP=0
|
||||||
# directory to store run information to.
|
# directory to store run information to.
|
||||||
RUNDIR=$(uci -q get ddns.global.run_dir) || RUNDIR="/var/run/ddns"
|
RUNDIR=$(uci -q get ddns.global.run_dir) || RUNDIR="/var/run/ddns"
|
||||||
[ -d $RUNDIR ] || mkdir -p -m755 $RUNDIR
|
[ -d $RUNDIR ] || mkdir -p -m755 $RUNDIR
|
||||||
# directory to store log files
|
# directory to store log files
|
||||||
LOGDIR=$(uci -q get ddns.global.log_dir) || LOGDIR="/var/log/ddns"
|
LOGDIR=$(uci -q get ddns.global.log_dir) || LOGDIR="/var/log/ddns"
|
||||||
[ -d $LOGDIR ] || mkdir -p -m755 $LOGDIR
|
[ -d $LOGDIR ] || mkdir -p -m755 $LOGDIR
|
||||||
LOGFILE="" # logfile - all files are set in dynamic_dns_updater.sh
|
LOGFILE="" # logfile - all files are set in dynamic_dns_updater.sh
|
||||||
|
@ -47,7 +47,7 @@ DATFILE="" # save stdout data of WGet and other external programs called
|
||||||
ERRFILE="" # save stderr output of WGet and other external programs called
|
ERRFILE="" # save stderr output of WGet and other external programs called
|
||||||
TLDFILE=/usr/lib/ddns/tld_names.dat # TLD file used by split_FQDN
|
TLDFILE=/usr/lib/ddns/tld_names.dat # TLD file used by split_FQDN
|
||||||
|
|
||||||
# number of lines to before rotate logfile
|
# number of lines to before rotate logfile
|
||||||
LOGLINES=$(uci -q get ddns.global.log_lines) || LOGLINES=250
|
LOGLINES=$(uci -q get ddns.global.log_lines) || LOGLINES=250
|
||||||
LOGLINES=$((LOGLINES + 1)) # correct sed handling
|
LOGLINES=$((LOGLINES + 1)) # correct sed handling
|
||||||
|
|
||||||
|
@ -295,19 +295,19 @@ get_service_data() {
|
||||||
local __SCRIPT=""
|
local __SCRIPT=""
|
||||||
local __OLD_IFS=$IFS
|
local __OLD_IFS=$IFS
|
||||||
local __NEWLINE_IFS='
|
local __NEWLINE_IFS='
|
||||||
' #__NEWLINE_IFS
|
' # __NEWLINE_IFS
|
||||||
[ $# -ne 2 ] && write_log 12 "Error calling 'get_service_data()' - wrong number of parameters"
|
[ $# -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
|
# remove any lines not containing data, and then make sure fields are enclosed in double quotes
|
||||||
__SERVICES=$(cat $__FILE | grep "^[\t ]*[^#]" | \
|
__SERVICES=$(cat $__FILE | grep "^[\t ]*[^#]" | \
|
||||||
awk ' gsub("\x27", "\"") { if ($1~/^[^\"]*$/) $1="\""$1"\"" }; { if ( $NF~/^[^\"]*$/) $NF="\""$NF"\"" }; { print $0 }')
|
awk ' gsub("\x27", "\"") { if ($1~/^[^\"]*$/) $1="\""$1"\"" }; { if ( $NF~/^[^\"]*$/) $NF="\""$NF"\"" }; { print $0 }')
|
||||||
|
|
||||||
IFS=$__NEWLINE_IFS
|
IFS=$__NEWLINE_IFS
|
||||||
for __LINE in $__SERVICES; do
|
for __LINE in $__SERVICES; do
|
||||||
#grep out proper parts of data and use echo to remove quotes
|
# grep out proper parts of data and use echo to remove quotes
|
||||||
__NAME=$(echo $__LINE | grep -o "^[\t ]*\"[^\"]*\"" | xargs -r -n1 echo)
|
__NAME=$(echo $__LINE | grep -o "^[\t ]*\"[^\"]*\"" | xargs -r -n1 echo)
|
||||||
__DATA=$(echo $__LINE | grep -o "\"[^\"]*\"[\t ]*$" | xargs -r -n1 echo)
|
__DATA=$(echo $__LINE | grep -o "\"[^\"]*\"[\t ]*$" | xargs -r -n1 echo)
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ timeout() {
|
||||||
return $status
|
return $status
|
||||||
}
|
}
|
||||||
|
|
||||||
#verify given host and port is connectable
|
# verify given host and port is connectable
|
||||||
# $1 Host/IP to verify
|
# $1 Host/IP to verify
|
||||||
# $2 Port to verify
|
# $2 Port to verify
|
||||||
verify_host_port() {
|
verify_host_port() {
|
||||||
|
@ -987,7 +987,7 @@ trap_handler() {
|
||||||
local __ERR=${2:-0}
|
local __ERR=${2:-0}
|
||||||
local __OLD_IFS=$IFS
|
local __OLD_IFS=$IFS
|
||||||
local __NEWLINE_IFS='
|
local __NEWLINE_IFS='
|
||||||
' #__NEWLINE_IFS
|
' # __NEWLINE_IFS
|
||||||
|
|
||||||
[ $PID_SLEEP -ne 0 ] && kill -$1 $PID_SLEEP 2>/dev/null # kill pending sleep if exist
|
[ $PID_SLEEP -ne 0 ] && kill -$1 $PID_SLEEP 2>/dev/null # kill pending sleep if exist
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
. /usr/lib/ddns/dynamic_dns_functions.sh # global vars are also defined here
|
. /usr/lib/ddns/dynamic_dns_functions.sh # global vars are also defined here
|
||||||
|
|
||||||
# set -vx #script debugger
|
|
||||||
|
|
||||||
# preset some variables, wrong or not set in dynamic_dns_functions.sh
|
# preset some variables, wrong or not set in dynamic_dns_functions.sh
|
||||||
SECTION_ID="lucihelper"
|
SECTION_ID="lucihelper"
|
||||||
LOGFILE="$LOGDIR/$SECTION_ID.log"
|
LOGFILE="$LOGDIR/$SECTION_ID.log"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
# variables in small chars are read from /etc/config/ddns
|
# variables in small chars are read from /etc/config/ddns
|
||||||
# variables in big chars are defined inside these scripts as global vars
|
# variables in big chars are defined inside these scripts as global vars
|
||||||
# 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
|
||||||
|
|
||||||
[ $# -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 USAGE:"
|
echo -e "\n USAGE:"
|
||||||
|
@ -58,7 +58,7 @@ trap "trap_handler 0 \$?" 0 # handle script exit with exit status
|
||||||
trap "trap_handler 1" 1 # SIGHUP Hangup / reload config
|
trap "trap_handler 1" 1 # SIGHUP Hangup / reload config
|
||||||
trap "trap_handler 2" 2 # SIGINT Terminal interrupt
|
trap "trap_handler 2" 2 # SIGINT Terminal interrupt
|
||||||
trap "trap_handler 3" 3 # SIGQUIT Terminal quit
|
trap "trap_handler 3" 3 # SIGQUIT Terminal quit
|
||||||
#trap "trap_handler 9" 9 # SIGKILL no chance to trap
|
# trap "trap_handler 9" 9 # SIGKILL no chance to trap
|
||||||
trap "trap_handler 15" 15 # SIGTERM Termination
|
trap "trap_handler 15" 15 # SIGTERM Termination
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -115,28 +115,8 @@ trap "trap_handler 15" 15 # SIGTERM Termination
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# verify and load SECTION_ID is exists
|
|
||||||
[ "$(uci -q get ddns.$SECTION_ID)" != "service" ] && {
|
|
||||||
[ $VERBOSE_MODE -le 1 ] && VERBOSE_MODE=2 # force console out and logfile output
|
|
||||||
[ -f $LOGFILE ] && rm -f $LOGFILE # clear logfile before first entry
|
|
||||||
write_log 7 "************ ************** ************** **************"
|
|
||||||
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
|
||||||
write_log 7 "uci configuration:\n$(uci -q show ddns | grep '=service' | sort)"
|
|
||||||
write_log 14 "Service section '$SECTION_ID' not defined"
|
|
||||||
}
|
|
||||||
load_all_config_options "ddns" "$SECTION_ID"
|
load_all_config_options "ddns" "$SECTION_ID"
|
||||||
|
ERR_LAST=$? # save return code - equal 0 if SECTION_ID found
|
||||||
write_log 7 "************ ************** ************** **************"
|
|
||||||
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
|
||||||
write_log 7 "uci configuraion:\n$(uci -q show ddns.$SECTION_ID | sort)"
|
|
||||||
write_log 7 "ddns version : $(opkg list-installed ddns-scripts | awk '{print $3}')"
|
|
||||||
case $VERBOSE_MODE in
|
|
||||||
0) write_log 7 "verbose mode : 0 - run normal, NO console output";;
|
|
||||||
1) write_log 7 "verbose mode : 1 - run normal, console mode";;
|
|
||||||
2) write_log 7 "verbose mode : 2 - run once, NO retry on error";;
|
|
||||||
3) write_log 7 "verbose mode : 3 - run once, NO retry on error, NOT sending update";;
|
|
||||||
*) write_log 14 "error detecting VERBOSE_MODE '$VERBOSE_MODE'";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# set defaults if not defined
|
# set defaults if not defined
|
||||||
[ -z "$enabled" ] && enabled=0
|
[ -z "$enabled" ] && enabled=0
|
||||||
|
@ -154,15 +134,54 @@ esac
|
||||||
[ "$ip_source" = "web" -a -z "$ip_url" -a $use_ipv6 -eq 1 ] && ip_url="http://checkipv6.dyndns.com"
|
[ "$ip_source" = "web" -a -z "$ip_url" -a $use_ipv6 -eq 1 ] && ip_url="http://checkipv6.dyndns.com"
|
||||||
[ "$ip_source" = "interface" -a -z "$ip_interface" ] && ip_interface="eth1"
|
[ "$ip_source" = "interface" -a -z "$ip_interface" ] && ip_interface="eth1"
|
||||||
|
|
||||||
|
# SECTION_ID does not exists
|
||||||
|
[ $ERR_LAST -ne 0 ] && {
|
||||||
|
[ $VERBOSE_MODE -le 1 ] && VERBOSE_MODE=2 # force console out and logfile output
|
||||||
|
[ -f $LOGFILE ] && rm -f $LOGFILE # clear logfile before first entry
|
||||||
|
write_log 7 "************ ************** ************** **************"
|
||||||
|
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
||||||
|
write_log 7 "uci configuration:\n$(uci -q show ddns | grep '=service' | sort)"
|
||||||
|
write_log 14 "Service section '$SECTION_ID' not defined"
|
||||||
|
}
|
||||||
|
|
||||||
|
write_log 7 "************ ************** ************** **************"
|
||||||
|
write_log 5 "PID '$$' started at $(eval $DATE_PROG)"
|
||||||
|
write_log 7 "uci configuration:\n$(uci -q show ddns.$SECTION_ID | sort)"
|
||||||
|
write_log 7 "ddns version : $(opkg list-installed ddns-scripts | awk '{print $3}')"
|
||||||
|
case $VERBOSE_MODE in
|
||||||
|
0) write_log 7 "verbose mode : 0 - run normal, NO console output";;
|
||||||
|
1) write_log 7 "verbose mode : 1 - run normal, console mode";;
|
||||||
|
2) write_log 7 "verbose mode : 2 - run once, NO retry on error";;
|
||||||
|
3) write_log 7 "verbose mode : 3 - run once, NO retry on error, NOT sending update";;
|
||||||
|
*) write_log 14 "error detecting VERBOSE_MODE '$VERBOSE_MODE'";;
|
||||||
|
esac
|
||||||
|
|
||||||
# check enabled state otherwise we don't need to continue
|
# check enabled state otherwise we don't need to continue
|
||||||
[ $enabled -eq 0 ] && write_log 14 "Service section disabled!"
|
[ $enabled -eq 0 ] && write_log 14 "Service section disabled!"
|
||||||
|
|
||||||
# without domain or username or password we can do nothing for you
|
# determine what update url we're using if a service_name is supplied
|
||||||
[ -z "$domain" -o -z "$username" -o -z "$password" ] && write_log 14 "Service section not correctly configured!"
|
# otherwise update_url is set inside configuration (custom update url)
|
||||||
urlencode URL_USER "$username" # encode username, might be email or something like this
|
# or update_script is set inside configuration (custom update script)
|
||||||
urlencode URL_PASS "$password" # encode password, might have special chars for security reason
|
[ -n "$service_name" ] && get_service_data update_url update_script
|
||||||
|
[ -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!"
|
||||||
|
|
||||||
# verify ip_source script if configured and executable
|
# without domain and possibly username and password we can do nothing for you
|
||||||
|
[ -z "$domain" ] && write_log 14 "Service section not configured correctly! Missing 'domain'"
|
||||||
|
[ -n "$update_url" ] && {
|
||||||
|
# only check if update_url is given, update_scripts have to check themselves
|
||||||
|
[ -z "$username" ] && $(echo "$update_url" | grep "\[USERNAME\]" >/dev/null 2>&1) && \
|
||||||
|
write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||||
|
[ -z "$password" ] && $(echo "$update_url" | grep "\[PASSWORD\]" >/dev/null 2>&1) && \
|
||||||
|
write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||||
|
}
|
||||||
|
|
||||||
|
# url encode username (might be email or something like this)
|
||||||
|
# and password (might have special chars for security reason)
|
||||||
|
[ -n "$username" ] && urlencode URL_USER "$username"
|
||||||
|
[ -n "$password" ] && urlencode URL_PASS "$password"
|
||||||
|
|
||||||
|
# verify ip_source 'script' if script is configured and executable
|
||||||
if [ "$ip_source" = "script" ]; then
|
if [ "$ip_source" = "script" ]; then
|
||||||
set -- $ip_script #handling script with parameters, we need a trick
|
set -- $ip_script #handling script with parameters, we need a trick
|
||||||
[ -z "$1" ] && write_log 14 "No script defined to detect local IP!"
|
[ -z "$1" ] && write_log 14 "No script defined to detect local IP!"
|
||||||
|
@ -180,16 +199,9 @@ write_log 7 "force interval: $FORCE_SECONDS seconds"
|
||||||
write_log 7 "retry interval: $RETRY_SECONDS seconds"
|
write_log 7 "retry interval: $RETRY_SECONDS seconds"
|
||||||
write_log 7 "retry counter : $retry_count times"
|
write_log 7 "retry counter : $retry_count times"
|
||||||
|
|
||||||
# determine what update url we're using if a service_name is supplied
|
# kill old process if it exists & set new pid file
|
||||||
# otherwise update_url is set inside configuration (custom update url)
|
|
||||||
# or update_script is set inside configuration (custom update script)
|
|
||||||
[ -n "$service_name" ] && get_service_data update_url update_script
|
|
||||||
[ -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!"
|
|
||||||
|
|
||||||
#kill old process if it exists & set new pid file
|
|
||||||
stop_section_processes "$SECTION_ID"
|
stop_section_processes "$SECTION_ID"
|
||||||
[ $? -gt 0 ] && write_log 7 "Send 'SIGTERM' to old process" || write_log 7 "No old process"
|
[ $? -gt 0 ] && write_log 7 "Send 'SIGTERM' was send to old process" || write_log 7 "No old process"
|
||||||
echo $$ > $PIDFILE
|
echo $$ > $PIDFILE
|
||||||
|
|
||||||
# determine when the last update was
|
# determine when the last update was
|
||||||
|
@ -213,14 +225,6 @@ else
|
||||||
write_log 7 "last update: $(eval $EPOCH_TIME)"
|
write_log 7 "last update: $(eval $EPOCH_TIME)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# we need time here because hotplug.d is fired by netifd
|
|
||||||
# but IP addresses are not set by DHCP/DHCPv6 etc.
|
|
||||||
write_log 7 "Waiting 10 seconds for interfaces to fully come up"
|
|
||||||
sleep 10 &
|
|
||||||
PID_SLEEP=$!
|
|
||||||
wait $PID_SLEEP # enable trap-handler
|
|
||||||
PID_SLEEP=0
|
|
||||||
|
|
||||||
# verify DNS server
|
# verify DNS server
|
||||||
[ -n "$dns_server" ] && verify_dns "$dns_server"
|
[ -n "$dns_server" ] && verify_dns "$dns_server"
|
||||||
|
|
||||||
|
@ -235,9 +239,11 @@ PID_SLEEP=0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# let's check if there is already an IP registered at the web
|
# let's check if there is already an IP registered on the web
|
||||||
# but ignore errors if not
|
|
||||||
get_registered_ip REGISTERED_IP "NO_RETRY"
|
get_registered_ip REGISTERED_IP "NO_RETRY"
|
||||||
|
ERR_LAST=$?
|
||||||
|
# No error or No IP set otherwise retry
|
||||||
|
[ $ERR_LAST -eq 0 -o $ERR_LAST -eq 127 ] || get_registered_ip REGISTERED_IP
|
||||||
|
|
||||||
# loop endlessly, checking ip every check_interval and forcing an updating once every force_interval
|
# loop endlessly, checking ip every check_interval and forcing an updating once every force_interval
|
||||||
write_log 6 "Starting main loop at $(eval $DATE_PROG)"
|
write_log 6 "Starting main loop at $(eval $DATE_PROG)"
|
||||||
|
@ -279,8 +285,9 @@ while : ; do
|
||||||
if [ $ERR_LAST -eq 0 ]; then
|
if [ $ERR_LAST -eq 0 ]; then
|
||||||
get_uptime LAST_TIME # we send update, so
|
get_uptime LAST_TIME # we send update, so
|
||||||
echo $LAST_TIME > $UPDFILE # save LASTTIME to file
|
echo $LAST_TIME > $UPDFILE # save LASTTIME to file
|
||||||
[ "$LOCAL_IP" != "$REGISTERED_IP" ] && write_log 6 "Update successful - IP '$LOCAL_IP' send"
|
[ "$LOCAL_IP" != "$REGISTERED_IP" ] \
|
||||||
[ "$LOCAL_IP" = "$REGISTERED_IP" ] || write_log 6 "Forced 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"
|
||||||
else
|
else
|
||||||
write_log 3 "Can not update IP at DDNS Provider"
|
write_log 3 "Can not update IP at DDNS Provider"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# sample script for detecting local IP
|
# sample script for detecting local IP
|
||||||
# 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
# 2014-2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||||
#
|
#
|
||||||
# activated inside /etc/config/ddns by setting
|
# activated inside /etc/config/ddns by setting
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
|
# 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||||
#4
|
#
|
||||||
#4 This file contains the update urls for various dynamic dns services.
|
# This file contains the update urls for various dynamic dns services.
|
||||||
#4 Column one contains the service name, column two contains the update url.
|
# Column one contains the service name, column two contains the update url.
|
||||||
#4 within the update url there are 4 variables you can use: [USERNAME],
|
# within the update url there are 4 variables you can use: [USERNAME],
|
||||||
#4 [PASSWORD], [DOMAIN] and [IP]. These are substituted for the username,
|
# [PASSWORD], [DOMAIN] and [IP]. These are substituted for the username,
|
||||||
#4 password, and domain name specified in the /etc/config/ddns file when an
|
# password, and domain name specified in the /etc/config/ddns file when an
|
||||||
#4 update is performed. The IP is substituted for the current ip address of the
|
# update is performed. The IP is substituted for the current ip address of the
|
||||||
#4 router. These variables are case sensitive, while urls generally are not, so
|
# router. These variables are case sensitive, while urls generally are not, so
|
||||||
#4 if you need to enter the same text in the url (which seems very unlikely) put
|
# if you need to enter the same text in the url (which seems very unlikely) put
|
||||||
#4 that text in lowercase, while the variables should remain in uppercase
|
# that text in lowercase, while the variables should remain in uppercase
|
||||||
#4
|
#
|
||||||
#4 There are TONS of dynamic dns services out there. There's a huge list of them at:
|
# There are TONS of dynamic dns services out there. There's a huge list of them at:
|
||||||
#4 http://www.dmoz.org/Computers/Software/Internet/Servers/Address_Management/Dynamic_DNS_Services/
|
# http://www.dmoz.org/Computers/Software/Internet/Servers/Address_Management/Dynamic_DNS_Services/
|
||||||
#4 If anyone has time they could update this file to be compatible with a bunch of them
|
# If anyone has time they could update this file to be compatible with a bunch of them
|
||||||
#4
|
#
|
||||||
#4 !!! Since ddns-scripts Version 2.x the update of IPv6 addresses is also supported
|
# !!! Since ddns-scripts Version 2.x the update of IPv6 addresses is also supported
|
||||||
#4 !!! This file is used for update of IPv4 adresses only. For IPv6 use services_ipv6
|
# !!! This file is used for update of IPv4 adresses only. For IPv6 use services_ipv6
|
||||||
#4
|
#
|
||||||
#4 !!! Since ddns-scripts Version 2.x the update via provider specific update scripts is supported.
|
# !!! Since ddns-scripts Version 2.x the update via provider specific update scripts is supported.
|
||||||
#4 !!! This scripts must be located at /usr/lib/ddns directory if defined inside this file.
|
# !!! This scripts must be located at /usr/lib/ddns directory if defined inside this file.
|
||||||
#4 !!! Use only the script name (without path). Sample:
|
# !!! Use only the script name (without path). Sample:
|
||||||
#4 !!! "example.com" "update_sample.sh"
|
# !!! "example.com" "update_sample.sh"
|
||||||
#4
|
#
|
||||||
#444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
|
# 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||||
|
|
||||||
"dyndns.org" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
"dyndns.org" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
"changeip.com" "http://[USERNAME]:[PASSWORD]@nic.changeip.com/nic/update?u=[USERNAME]&p=[PASSWORD]&cmd=update&hostname=[DOMAIN]&ip=[IP]"
|
"changeip.com" "http://[USERNAME]:[PASSWORD]@nic.changeip.com/nic/update?u=[USERNAME]&p=[PASSWORD]&cmd=update&hostname=[DOMAIN]&ip=[IP]"
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
"no-ip.com" "update_no-ip.sh"
|
"no-ip.com" "update_no-ip.sh"
|
||||||
"noip.com" "update_no-ip.sh"
|
"noip.com" "update_no-ip.sh"
|
||||||
|
|
||||||
#freedns.afraid.org is weird, you just need an update code, for which we use the password variable
|
# freedns.afraid.org is weird, you just need an update code, for which we use the password variable
|
||||||
"freedns.afraid.org" "http://freedns.afraid.org/dynamic/update.php?[PASSWORD]&address=[IP]"
|
"freedns.afraid.org" "http://freedns.afraid.org/dynamic/update.php?[PASSWORD]&address=[IP]"
|
||||||
|
|
||||||
# DNS Max and resellers' update urls
|
# DNS Max and resellers' update urls
|
||||||
|
|
|
@ -1,40 +1,43 @@
|
||||||
#666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
|
# 66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||||
#6
|
#
|
||||||
#6 This file contains the update urls for various dynamic dns services.
|
# This file contains the update urls for various dynamic dns services.
|
||||||
#6 Column one contains the service name, column two contains the update url.
|
# Column one contains the service name, column two contains the update url.
|
||||||
#6 within the update url there are 4 variables you can use: [USERNAME],
|
# within the update url there are 4 variables you can use: [USERNAME],
|
||||||
#6 [PASSWORD], [DOMAIN] and [IP]. These are substituted for the username,
|
# [PASSWORD], [DOMAIN] and [IP]. These are substituted for the username,
|
||||||
#6 password, and domain name specified in the /etc/config/ddns file when an
|
# password, and domain name specified in the /etc/config/ddns file when an
|
||||||
#6 update is performed. The IP is substituted for the current ip address of the
|
# update is performed. The IP is substituted for the current ip address of the
|
||||||
#6 router. These variables are case sensitive, while urls generally are not, so
|
# router. These variables are case sensitive, while urls generally are not, so
|
||||||
#6 if you need to enter the same text in the url (which seems very unlikely) put
|
# if you need to enter the same text in the url (which seems very unlikely) put
|
||||||
#6 that text in lowercase, while the variables should remain in uppercase
|
# that text in lowercase, while the variables should remain in uppercase
|
||||||
#6
|
#
|
||||||
#6 There are TONS of dynamic dns services out there. There's a huge list of them at:
|
# There are TONS of dynamic dns services out there. There's a huge list of them at:
|
||||||
#6 http://www.dmoz.org/Computers/Software/Internet/Servers/Address_Management/Dynamic_DNS_Services/
|
# http://www.dmoz.org/Computers/Software/Internet/Servers/Address_Management/Dynamic_DNS_Services/
|
||||||
#6 If anyone has time they could update this file to be compatible with a bunch of them
|
# If anyone has time they could update this file to be compatible with a bunch of them
|
||||||
#6
|
#
|
||||||
#6 !!! Since ddns-scripts Version 2.x the update of IPv6 addresses is also supported
|
# !!! Since ddns-scripts Version 2.x the update of IPv6 addresses is also supported
|
||||||
#6 !!! This file is used for update of IPv6 adresses only. For IPv4 use services
|
# !!! This file is used for update of IPv6 adresses only. For IPv4 use services
|
||||||
#6
|
#
|
||||||
#6 !!! Since ddns-scripts Version 2.x the update via provider specific update scripts is supported.
|
# !!! Since ddns-scripts Version 2.x the update via provider specific update scripts is supported.
|
||||||
#6 !!! This scripts must be located at /usr/lib/ddns directory if defined inside this file.
|
# !!! This scripts must be located at /usr/lib/ddns directory if defined inside this file.
|
||||||
#6 !!! Use only the script name (without path). Sample:
|
# !!! Use only the script name (without path). Sample:
|
||||||
#6 !!! "example.com" "update_sample.sh"
|
# !!! "example.com" "update_sample.sh"
|
||||||
#6
|
#
|
||||||
#666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
|
# 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]"
|
||||||
|
|
||||||
#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]"
|
||||||
|
|
||||||
#IPv6 @ MyDNS.JP
|
# IPv6 @ MyDNS.JP
|
||||||
"mydns.jp" "http://www.mydns.jp/directip.html?MID=[USERNAME]&PWD=[PASSWORD]&IPV6ADDR=[IP]"
|
"mydns.jp" "http://www.mydns.jp/directip.html?MID=[USERNAME]&PWD=[PASSWORD]&IPV6ADDR=[IP]"
|
||||||
|
|
||||||
#IPv6 @ Cloudflare
|
# IPv6 @ Cloudflare
|
||||||
"cloudflare.com" "update_cloudflare.sh"
|
"cloudflare.com" "update_cloudflare.sh"
|
||||||
|
|
||||||
#IPv6 @ no-ip.pl nothing to do with no-ip.com (domain registered to www.domeny.tv) (IP autodetected by provider)
|
# IPv6 @ 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]"
|
||||||
|
|
||||||
|
# IPv6 @ freedns.afraid.org
|
||||||
|
"freedns.afraid.org" "http://freedns.afraid.org/dynamic/update.php?[PASSWORD]&address=[IP]"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# script for sending updates to cloudflare.com
|
# script for sending updates to cloudflare.com
|
||||||
# 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
# 2014-2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||||
# many thanks to Paul for testing and feedback during development
|
# many thanks to Paul for testing and feedback during development
|
||||||
#
|
#
|
||||||
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
||||||
|
@ -14,6 +14,8 @@
|
||||||
# variable __IP already defined with the ip-address to use for update
|
# variable __IP already defined with the ip-address to use for update
|
||||||
#
|
#
|
||||||
[ $use_https -eq 0 ] && write_log 14 "Cloudflare only support updates via Secure HTTP (HTTPS). Please correct configuration!"
|
[ $use_https -eq 0 ] && write_log 14 "Cloudflare only support updates via Secure HTTP (HTTPS). Please correct configuration!"
|
||||||
|
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||||
|
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||||
|
|
||||||
local __RECID __URL __KEY __KEYS __FOUND __SUBDOM __DOMAIN __TLD
|
local __RECID __URL __KEY __KEYS __FOUND __SUBDOM __DOMAIN __TLD
|
||||||
|
|
||||||
|
@ -46,7 +48,7 @@ grep -i "json_get_keys" /usr/share/libubox/jshn.sh >/dev/null 2>&1 || json_get_k
|
||||||
|
|
||||||
# function to "sed" unwanted string parts from DATFILE
|
# function to "sed" unwanted string parts from DATFILE
|
||||||
cleanup() {
|
cleanup() {
|
||||||
#based on the sample output on cloudflare.com homepage we need to do some cleanup
|
# based on the sample output on cloudflare.com homepage we need to do some cleanup
|
||||||
sed -i 's/^[ \t]*//;s/[ \t]*$//' $DATFILE # remove invisible chars at beginning and end of lines
|
sed -i 's/^[ \t]*//;s/[ \t]*$//' $DATFILE # remove invisible chars at beginning and end of lines
|
||||||
sed -i '/^-$/d' $DATFILE # remove lines with "-" (dash)
|
sed -i '/^-$/d' $DATFILE # remove lines with "-" (dash)
|
||||||
sed -i '/^$/d' $DATFILE # remove empty lines
|
sed -i '/^$/d' $DATFILE # remove empty lines
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# script for sending updates to no-ip.com / noip.com
|
# script for sending updates to no-ip.com / noip.com
|
||||||
# 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
# 2014-2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||||
#
|
#
|
||||||
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
|
||||||
#
|
#
|
||||||
|
@ -9,6 +9,9 @@
|
||||||
#
|
#
|
||||||
local __DUMMY
|
local __DUMMY
|
||||||
local __UPDURL="http://[USERNAME]:[PASSWORD]@dynupdate.no-ip.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
local __UPDURL="http://[USERNAME]:[PASSWORD]@dynupdate.no-ip.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||||
|
# inside url we need username and password
|
||||||
|
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||||
|
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
|
||||||
|
|
||||||
# set IP version dependend dummy (localhost)
|
# set IP version dependend dummy (localhost)
|
||||||
[ $use_ipv6 -eq 0 ] && __DUMMY="127.0.0.1" || __DUMMY="::1"
|
[ $use_ipv6 -eq 0 ] && __DUMMY="127.0.0.1" || __DUMMY="::1"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# sample script for sending user defined updates
|
# sample script for sending user defined updates
|
||||||
# 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
# 2014-2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
|
||||||
#
|
#
|
||||||
# activated inside /etc/config/ddns by setting
|
# activated inside /etc/config/ddns by setting
|
||||||
#
|
#
|
||||||
|
@ -18,6 +18,9 @@
|
||||||
#
|
#
|
||||||
# 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
|
||||||
|
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
|
||||||
|
[ -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" \
|
||||||
|
|
Loading…
Reference in a new issue