mirror of
https://github.com/openwrt/packages.git
synced 2026-12-02 07:15:32 +04:00
ddns-scripts: apply HTTPS settings to https:// URLs
do_transfer() applies the cacert option and checks that the transfer program supports HTTPS only when use_https is enabled. Many provider definitions use https:// update URLs, and a custom update_url or ip_url can do the same. With use_https disabled, such a transfer ignores cacert, including IGNORE. On a device without HTTPS support the transfer is still attempted and retried, although it cannot succeed. Treat a transfer as HTTPS when use_https is enabled or the URL starts with https://. Without HTTPS support in uclient-fetch, curl or BusyBox wget, the update now stops with the matching error message, as it already does with use_https enabled. A cacert value left in a hand-written configuration with use_https disabled now applies to https:// URLs. LuCI removes cacert on save when use_https is disabled. Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
This commit is contained in:
1 parent
4fabb58b5c
commit
9ae6abf62a
2 files changed
+13
-7
No files matched your search
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-scripts
|
||||
PKG_VERSION:=2.8.5
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
|
||||
@@ -621,9 +621,15 @@ do_transfer() {
|
||||
local __CNT=0 # error counter
|
||||
local __PROG __RUNPROG
|
||||
local __FALLBACK_RUNPROG __FALLBACK_DESC
|
||||
local __HTTPS=$use_https
|
||||
|
||||
[ $# -ne 1 ] && write_log 12 "Error in 'do_transfer()' - wrong number of parameters"
|
||||
|
||||
# an https:// URL needs HTTPS support and the cacert settings even without use_https
|
||||
case "$__URL" in
|
||||
https://*) __HTTPS=1 ;;
|
||||
esac
|
||||
|
||||
# Use ip_network as default for bind_network if not separately specified
|
||||
[ -z "$bind_network" ] && [ "$ip_source" = "network" ] && [ "$ip_network" ] && bind_network="$ip_network"
|
||||
|
||||
@@ -645,7 +651,7 @@ do_transfer() {
|
||||
[ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6
|
||||
fi
|
||||
# set certificate parameters
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ $__HTTPS -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then # idea from Ticket #15327 to ignore server cert
|
||||
__PROG="$__PROG --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
@@ -674,7 +680,7 @@ do_transfer() {
|
||||
elif [ -n "$CURL" ]; then
|
||||
__PROG="$CURL -RsS -o $DATFILE --stderr $ERRFILE"
|
||||
# check HTTPS support
|
||||
[ -z "$CURL_SSL" -a $use_https -eq 1 ] && \
|
||||
[ -z "$CURL_SSL" -a $__HTTPS -eq 1 ] && \
|
||||
write_log 13 "cURL: libcurl compiled without https support"
|
||||
# force network/interface-device to use for communication
|
||||
if [ -n "$bind_network" ]; then
|
||||
@@ -695,7 +701,7 @@ do_transfer() {
|
||||
[ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6
|
||||
fi
|
||||
# set certificate parameters
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ $__HTTPS -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then # idea from Ticket #15327 to ignore server cert
|
||||
__PROG="$__PROG --insecure" # but not empty better to use "IGNORE"
|
||||
elif [ -f "$cacert" ]; then
|
||||
@@ -733,12 +739,12 @@ do_transfer() {
|
||||
[ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6
|
||||
fi
|
||||
# https possibly not supported
|
||||
[ $use_https -eq 1 -a -z "$UCLIENT_FETCH_SSL" ] && \
|
||||
[ $__HTTPS -eq 1 -a -z "$UCLIENT_FETCH_SSL" ] && \
|
||||
write_log 14 "uclient-fetch: no HTTPS support! Additional install one of ustream-ssl packages"
|
||||
# proxy support
|
||||
[ -z "$proxy" ] && __PROG="$__PROG -Y off" || __PROG="$__PROG -Y on"
|
||||
# https & certificates
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ $__HTTPS -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__PROG="$__PROG --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
@@ -760,7 +766,7 @@ do_transfer() {
|
||||
[ $force_ipversion -eq 1 ] && \
|
||||
write_log 14 "BusyBox Wget: Force connecting to IPv4 or IPv6 addresses not supported"
|
||||
# https not supported
|
||||
[ $use_https -eq 1 ] && \
|
||||
[ $__HTTPS -eq 1 ] && \
|
||||
write_log 14 "BusyBox Wget: no HTTPS support"
|
||||
# disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set)
|
||||
[ -z "$proxy" ] && __PROG="$__PROG -Y off"
|
||||
|
||||
Reference in new issue
Block a user