Chrome新版本浏览器无法打开sha-1的https证书

697 阅读3分钟

Chrome新版本浏览器无法打开sha-1的https证书

feature:Deprecate TLS SHA-1 server signatures

有部分老域名部署在debian7的nginx上,现象是chrome无法打开sha-1的https证书,提示ERR_SSL_PROTOCOL_ERROR,使用别的浏览器正常。

$ sudo dpkg -l |grep ssl
ii  libssl1.0.0:amd64                  1.0.1e-2+deb7u20                    amd64        SSL shared libraries
ii  openssl                            1.0.1e-2+deb7u20                    amd64        Secure Socket Layer (SSL) binary and related cryptographic tools

$ sudo nginx -V
nginx version: nginx/1.10.1
built with OpenSSL 1.0.1e 11 Feb 2013
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log \
--lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules \
--http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module \
--with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module \
--with-http_dav_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic \
--with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic \
--with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module \
--with-mail=dynamic --with-mail_ssl_module --add-module=/tmp/buildd/nginx-1.10.1/debian/modules/headers-more-nginx-module \
--add-dynamic-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx-auth-pam \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx-dav-ext-module \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx-echo \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx-upstream-fair \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx-hmux \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx_limit_access_module \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx-sticky-module-ng \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx_upstream_check_module \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx-upsync-module \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/nginx-http-concat-1.2.2 \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/ngx_http_prelog_module \
--add-module=/tmp/buildd/nginx-1.10.1/debian/modules/ngx_http_substitutions_filter_module

根本原因

nginx 版本使用的 OpenSSL 版本为 1.0.1e,其中默认启用了 TLS 1.0/1.1/1.2 协议,但不支持 TLS 1.3 协议。此外,OpenSSL 1.0.1e 默认启用了 SHA-1 签名算法,而 SHA-1 已经被广泛认为是不安全的,因为其安全性已经被破解。因此,如果使用 SHA-1 签名算法,存在安全风险,可能会遭到中间人攻击。建议升级 OpenSSL 版本并禁用 SHA-1 签名算法以提高安全性。

解决方法

临时解决方法

打开 chrome://flags/#use-sha1-server-handshakes ,设置为Enabled

一、域名迁移

将配置同步到高版本nginx,绑定hosts测试正常后,切换DNS即可

二、升级 OpenSSL

以下是chatgpt的回答

# Debian 7 的 OpenSSL 版本是 1.0.1e,如果需要升级 OpenSSL 版本,可以按照以下步骤进行:

# 更新操作系统:
   sudo apt-get update
   sudo apt-get upgrade
# 添加 Debian Backports 库:
   echo "deb http://ftp.debian.org/debian wheezy-backports main" | sudo tee -a /etc/apt/sources.list
# 更新软件包列表:
   sudo apt-get update
# 安装 OpenSSL 1.0.2:
   sudo apt-get install -t wheezy-backports openssl
# 确认 OpenSSL 版本:
   openssl version
# 如果输出的版本号为 1.0.2 或更高版本,则表示 OpenSSL 升级成功。

# 注意:升级 OpenSSL 可能会影响系统的其他软件包,因此在升级之前应该做好备份并测试相关应用程序的兼容性。
三、禁用 SHA-1

以下是chatgpt的回答

# 要禁用 OpenSSL 中的 SHA-1 签名算法,需要进行以下步骤:

# 编辑 OpenSSL 配置文件 /etc/ssl/openssl.cnf。找到 [default_conf] 部分,添加以下内容:
   [ default_conf ]
   ssl_conf = ssl_sect

   [ssl_sect]
   system_default = system_default_sect

   [system_default_sect]
   Options = !SHA1
# 重启相关服务,例如 Apache 或 Nginx。这样就可以禁用 SHA-1 签名算法了。
# 请注意,禁用 SHA-1 签名算法可能会影响某些旧版本的客户端连接。因此,在禁用之前,应该测试相关应用程序的兼容性,并确保不会对系统的正常运行产生负面影响。