[for-15.05] ddns-scripts: backport of 2.7.6-10

Backport of current version 2.7.6-10
- more services
- more functionality
- be prepared for next versions

compiled ipk-packages available at
https://github.com/chris5560/OpenWrt-Backports/tree/master/for-CC15.05.01/ddns-scripts_2.7.6-10

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
This commit is contained in:
Christian Schoenebeck
2017-01-11 17:05:05 +01:00
parent 61fad8538b
commit 728f37ad15
19 changed files with 4415 additions and 1426 deletions
+23 -8
View File
@@ -29,31 +29,31 @@ config ddns "global"
# and LuCI web application.
# For codes see man pages of date command.
# default: "%F %R" (ISO 8601 format)
# option date_format "%F %R"
# option ddns_dateformat "%F %R"
###########
# set run directory to use for .pid and .update files
# there will be a separate file for every running service section
# default: "/var/run/ddns"
# option run_dir "/var/run/ddns"
# option ddns_rundir "/var/run/ddns"
###########
# set log directory to use for .log files
# there will be a separate file for every running service section
# default: "/var/log/ddns"
# option log_dir "/var/log/ddns"
# option ddns_logdir "/var/log/ddns"
###########
# set number of lines stored in .log file before auto truncated
# default: "250" lines
# option log_lines "250"
# option ddns_loglines "250"
###########
# Whether to allow to send Private/Special IP's to the DDNS provider
# IPv4: 0.x, 10.x, 127.x, 172.16.x-172.31.x, 192.168.x
# IPv6: ::, Fxxx:
# default: "0" disabled
# option allow_local_ip "0"
# option upd_privateip "0"
#####################################################################
# DDNS service settings
@@ -115,9 +115,13 @@ config service "myddns"
# option update_script ""
###########
# You must specify your domain/host name, your username and your password
# as you get from you DDNS provider. Keep an eye on providers help pages.
# 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
# default: none
option domain ""
@@ -126,10 +130,21 @@ config service "myddns"
# default: none
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
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
# personally found some providers having problems when not sending
+6 -4
View File
@@ -18,13 +18,15 @@
#
# tested with spdns.de
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 "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
# do replaces in URL
__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")
__URL=$(echo $__URL | | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#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:#')
do_transfer "$__URL" || return 1
@@ -34,6 +36,6 @@ write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)"
# analyse provider answers
# "good [IP_ADR]" = successful
# "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