Skip to content

Commit

Permalink
Merge pull request #775 from abcfy2/patch-1
Browse files Browse the repository at this point in the history
fix DoH/DoT always fallback check /etc/ssl/
  • Loading branch information
juewuy authored Sep 19, 2024
2 parents 999e42c + 903b638 commit f2c8835
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 2 additions & 3 deletions scripts/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -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"\'
Expand Down
13 changes: 8 additions & 5 deletions scripts/webget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit f2c8835

Please sign in to comment.