From: Florian Fainelli Date: Sat, 19 Feb 2011 12:44:03 +0000 (+0000) Subject: ddns-scripts: add https support to ddns-scripts X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=de88dc074eac14fd7e5d41db1d34e619b7022a96;p=openwrt%2Fsvn-archive%2Fpackages.git ddns-scripts: add https support to ddns-scripts adds a "use_https" and "cacert" option to the ddns-scripts package. when use_https is enabled, then curl is required to perform the update. the cacert option can be set to either a single file containing a trust signing authority certificate or a directory containing certificates which has been prepared with the usual c_rehash method. Signed-off-by: Matthew William Cox SVN-Revision: 25578 --- diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile index 5b42a816e..680e8940a 100644 --- a/net/ddns-scripts/Makefile +++ b/net/ddns-scripts/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ddns-scripts PKG_VERSION:=1.0.0 -PKG_RELEASE:=12 +PKG_RELEASE:=13 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh index a58b30729..e8e08e720 100755 --- a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh @@ -45,6 +45,9 @@ fi #config_get domain $service_id domain # # +#config_get use_https $service_id use_https +#config_get cacert $service_id cacert +# #config_get ip_source $service_id ip_source #config_get ip_interface $service_id ip_interface #config_get ip_network $service_id ip_network @@ -81,11 +84,29 @@ then force_unit="hours" fi +if [ -z "$use_https" ] +then + use_https=0 +fi + #some constants -retrieve_prog="/usr/bin/wget -O - "; +if [ "x$use_https" = "x1" ] +then + retrieve_prog="/usr/bin/curl " + if [ -f "$cacert" ] + then + retrieve_prog="${retrieve_prog}--cacert $cacert " + elif [ -d "$cacert" ] + then + retrieve_prog="${retrieve_prog}--capath $cacert " + fi +else + retrieve_prog="/usr/bin/wget -O - "; +fi + service_file="/usr/lib/ddns/services" ip_regex="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" @@ -118,6 +139,10 @@ then IFS=$OLD_IFS fi +if [ "x$use_https" = x1 ] +then + update_url=$(echo $update_url | sed -e 's/^http:/https:/') +fi verbose_echo "update_url=$update_url"