From 52d3fa08d963ef72fe11fe969469626c9301dc7e Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Thu, 19 Sep 2024 15:37:15 +0800 Subject: [PATCH 1/3] fix DoH/DoT always fallback check /etc/ssl/ --- scripts/menu.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/menu.sh b/scripts/menu.sh index 545df8e..10739c2 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -608,9 +608,8 @@ setdns(){ #DNS设置 elif [ "$num" = 4 ]; then echo ----------------------------------------------- - openssldir=$(openssl version -a 2>&1 | grep OPENSSLDIR | awk -F "\"" '{print $2}') - [ -z "$openssldir" ] && openssldir=/etc/ssl - if [ -s "$openssldir/certs/ca-certificates.crt" ];then + openssldir="$(openssl version -d 2>&1 | awk -F '"' '{print $2}')" + if [ -s "$openssldir/certs/ca-certificates.crt" -o "/etc/ssl/certs/ca-certificates.crt" ];then dns_nameserver='https://223.5.5.5/dns-query, https://doh.pub/dns-query, tls://dns.rubyfish.cn:853' dns_fallback='tls://1.0.0.1:853, tls://8.8.4.4:853, https://doh.opendns.com/dns-query' setconfig dns_nameserver \'"$dns_nameserver"\' From 95c507f61e9860fd83b13089cf0ef405cff70282 Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Thu, 19 Sep 2024 15:44:38 +0800 Subject: [PATCH 2/3] Update menu.sh --- scripts/menu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/menu.sh b/scripts/menu.sh index 10739c2..f6240f8 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -609,7 +609,7 @@ setdns(){ #DNS设置 elif [ "$num" = 4 ]; then echo ----------------------------------------------- openssldir="$(openssl version -d 2>&1 | awk -F '"' '{print $2}')" - if [ -s "$openssldir/certs/ca-certificates.crt" -o "/etc/ssl/certs/ca-certificates.crt" ];then + if [ -s "$openssldir/certs/ca-certificates.crt" -o -s "/etc/ssl/certs/ca-certificates.crt" ];then dns_nameserver='https://223.5.5.5/dns-query, https://doh.pub/dns-query, tls://dns.rubyfish.cn:853' dns_fallback='tls://1.0.0.1:853, tls://8.8.4.4:853, https://doh.opendns.com/dns-query' setconfig dns_nameserver \'"$dns_nameserver"\' From 6015bc4425ecad182f04086eb869238bad12cc6d Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Thu, 19 Sep 2024 16:21:09 +0800 Subject: [PATCH 3/3] Update webget.sh --- scripts/webget.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/webget.sh b/scripts/webget.sh index 6790ac3..edcd531 100644 --- a/scripts/webget.sh +++ b/scripts/webget.sh @@ -1943,10 +1943,13 @@ getcrt(){ #下载根证书文件 fi } setcrt(){ - openssldir=$(openssl version -a 2>&1 | grep OPENSSLDIR | awk -F "\"" '{print $2}') - [ -z "$openssldir" ] && openssldir=/etc/ssl + openssldir="$(openssl version -d 2>&1 | awk -F '"' '{print $2}')" + if [ -d "$openssldir/certs/" ];then + crtdir="$openssldir/certs/ca-certificates.crt" + else + crtdir="/etc/ssl/certs/ca-certificates.crt" + fi if [ -n "$openssldir" ];then - crtdir="$openssldir/certs/ca-certificates.crt" echo ----------------------------------------------- echo -e "\033[36m安装/更新本地根证书文件(ca-certificates.crt)\033[0m" echo -e "\033[33m用于解决证书校验错误,x509报错等问题\033[0m" @@ -2273,8 +2276,8 @@ userguide(){ } fi #检测及下载根证书 - openssldir=$(openssl version -a 2>&1 | grep OPENSSLDIR | awk -F "\"" '{print $2}') - [ -z "$openssldir" ] && openssldir=/etc/ssl + openssldir="$(openssl version -d 2>&1 | awk -F '"' '{print $2}')" + [ ! -d "$openssldir/certs" ] && openssldir=/etc/ssl if [ -d $openssldir/certs -a ! -f $openssldir/certs/ca-certificates.crt ];then echo ----------------------------------------------- echo -e "\033[33m当前设备未找到根证书文件\033[0m"