【问题标题】:"peer closed connection in SSL handshake" on cloud flare SSL handshake failed云耀斑 SSL 握手上的“SSL 握手中的对等关闭连接”失败
【发布时间】:2021-05-22 21:29:38
【问题描述】:

最近,我在 Cloudflare 网站上收到“SSL 握手失败”错误。 当我查看我的 nginx 日志时,我发现了以下错误:

2021/05/23 02:35:52 [info] 10528#0: *124920510 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking, client: 172.68.155.147, server: 0.0.0.0:443
2021/05/23 02:42:57 [info] 10528#0: *124925310 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking, client: 172.68.155.147, server: 0.0.0.0:443
2021/05/23 02:50:19 [info] 11633#0: *124929231 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking, client: 172.68.155.165, server: 0.0.0.0:443
2021/05/23 02:50:27 [info] 11632#0: *124929281 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking, client: 172.68.155.165, server: 0.0.0.0:443
2021/05/23 02:54:18 [info] 11633#0: *124930616 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking, client: 172.68.155.161, server: 0.0.0.0:443

每次发生 SSL 握手错误时,都会在日志中添加“对等关闭 SSL 握手中的连接”行。

你能告诉我如何解决这个问题吗?

Nginx 配置

server {
listen 443 ssl http2;
listen [::]:443 ssl http2; 

server_name mydomain.in;
set $base /home/username/websites/mydomain.in;
root $base/;

# SSL
 
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_certificate /etc/letsencrypt/live/mydomain.in/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain.in/privkey.pem;

# logging
access_log /home/username/nginx/logs/mydomain.in.access.log;
error_log /home/username/nginx/logs/mydomain.in.error.log debug;

# index.php
index index.php;

# index.php fallback
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

# handle .php
location ~ \.php$ {
    include nginxconfig.io/php7.4_fastcgi.conf;
}

#include nginxconfig.io/general.conf;

# security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline' worker-src blob:" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;

# . files
location ~ /\.(?!well-known) {
    deny all;
}

# favicon.ico
location = /favicon.ico {
    log_not_found off;
    access_log off;
}

# robots.txt
location = /robots.txt {
    log_not_found off;
    access_log off;
}

# assets, media
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
    expires 7d;
    access_log off;
}

# svg, fonts
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
    add_header Access-Control-Allow-Origin "*";
    expires 7d;
    access_log off;
}

# gzip
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;

}

服务器 Ubuntu 18.04 Nginx 1.16

【问题讨论】:

    标签: ssl cloudflare


    【解决方案1】:

    仅根据提供的有关这些特定客户端为何放弃 TLS 握手的信息,无法提取任何信息。可能是一些测试,也可能是其他东西。

    如果这些是正常的浏览器,一个常见的原因是服务器提供的证书无法被客户端验证。例如,这可能发生在自签名证书、非公共 CA 颁发的证书、缺少中间证书、主机名不匹配...

    鉴于这些 IP 似乎属于 Cloudflare,它可能仍然是证书设置混乱——不过,仅提供文件名而不提供实际内容将无济于事。

    但同样,仅基于提供的日志条目和配置,只能进行有根据的猜测和推测。

    【讨论】:

    • 我在服务器上尝试了“Cloudflare Origin 证书”和“让我们加密”。但是没有效果。错误来自最近几天。之前一切正常。
    • @FutureKing:正如我所说,您使用的文件的名称没有帮助。描述也没有,因为您认为它实际上可能与实际不同。您是否尝试过使用某些 SSL 客户端访问您的 internal 站点(即直接访问系统,而不是通过 Cloudflare)。如果是,会发生什么?如果没有,请尝试。
    • 是的,我尝试禁用 Cloudflare 代理并且站点运行正常。我使用 Qualys 来检查 SSL。当我使用 cloudflare 代理时,它给了我 B,但是当我禁用它时,它给了我“A+”
    • @FutureKing:基于此输出,与 Cloudflare 的连接似乎有效。所以这些不是系统性错误,只是偶尔发生,很少与正常流量相比?
    • 此问题来自 cloudflare,现已解决。 cloudflarestatus.com/incidents/…
    猜你喜欢
    • 1970-01-01
    • 2021-04-28
    • 2021-11-11
    • 2018-07-28
    • 2019-10-26
    • 2021-02-05
    • 2012-10-11
    • 2015-03-16
    相关资源
    最近更新 更多