当我的 Linux 升级到 22.04 和 openssl3.0.2 (php7.4-fpm) 时,我的网站出现以下错误:
file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:0A000126:SSL routines::unexpected eof while reading
Run Code Online (Sandbox Code Playgroud)
启用旧版提供商怎么样?
我在 Ubuntu 22.04 上的 Nextcloud 中看到了类似的问题,最后我通过这个更改避免了它。
--- /etc/ssl/openssl.cnf~original 2022-03-16 08:35:51.000000000 +0000
+++ /etc/ssl/openssl.cnf 2022-05-04 02:37:30.336530711 +0000
@@ -56,6 +56,7 @@
# List of providers to load
[provider_sect]
default = default_sect
+legacy = legacy_sect
# The fips section name should match the section name inside the
# included fipsmodule.cnf.
# fips = fips_sect
@@ -69,7 +70,9 @@
# OpenSSL may not work correctly which could lead to significant system
# problems including inability to remotely access the system.
[default_sect]
-# activate = 1
+activate = 1
+[legacy_sect]
+activate = 1
Run Code Online (Sandbox Code Playgroud)
https://gist.github.com/rdh27785/97210d439a280063bd768006450c435d
小智 6
Ubuntu 22.04将OpenSSL升级到3.0.2版本,其安全策略更加严格。我猜您正在尝试从 OpenSSL 3.0.2 默认情况下不允许连接的过时服务器下载文件。
OpenSSL 手册描述了尽管存在漏洞但仍允许连接的选项标志:
SSL_OP_IGNORE_UNEXPECTED_EOF
某些 TLS 实现不会在关闭时发送强制的 close_notify 警报。如果应用程序尝试等待 close_notify 警报,但对等方关闭连接而不发送该警报,则会生成错误。启用此选项后,对等方不需要发送 close_notify 警报,并且关闭的连接将被视为收到 close_notify 警报。
实际上,该SSL_OP_IGNORE_UNEXPECTED_EOF选项需要通过 OpenSSL API 设置,但很可能您正在使用一些更高级别的函数来操作 HTTPS 连接(例如curl)。我认为你最好的选择是查明该函数是否允许设置 OpenSSL 选项。
小智 3
好的,我可以验证以下内容:如果您在 Ubuntu 22.04 上安装了 OpenSSL3.0.2 并且收到此错误,请验证您使用的 PHP 版本。PHP8.0及更低版本不兼容OpenSSL3.0.2。您需要升级到 PHP8.1 或更高版本。我在 Ubuntu22.04 上运行 zabbix 服务器,并且在很多服务器上收到此错误,但更新到 PHP8.1 后,所有服务器都上线且没有错误。
https://github.com/php/php-src/issues/8369#issuecomment-1126935451 PHP 8.0 不支持 OpenSSL 3.0,因此它在那里不适用。
| 归档时间: |
|
| 查看次数: |
46799 次 |
| 最近记录: |