大网数据广告活动
服务器运维问答

SSL error "unexpected eof while reading" on same server as the originating request

· 52CE 我爱测

First, I'm aware of the SSL Library Error: error:0A000126:SSL routines::unexpected eof while reading error stemming from OpenSSL 3 reintroducing a feature to prevent truncation attacks. The question I have is why I'm seeing this …

问题原文

原帖链接 · oucil · CC BY-SA 4.0

First, I'm aware of the SSL Library Error: error:0A000126:SSL routines::unexpected eof while reading error stemming from OpenSSL 3 reintroducing a feature to prevent truncation attacks.

The question I have is why I'm seeing this error when I'm making a curl call via PHP from the very same server that's reporting the error?

I'm running Rocky Linux 9.1, PHP 8.0.27, and have OpenSSL 3.0.1 (latest versions available). I can't upgrade to PHP8.1 via the dnf module yet due to missing libraries not yet available for that release.

Since I'm making a curl call from the server to itself, one would think that if it's up to date enough to recognize the error, that it would be issuing the requests properly. The "bug" reports indicate that this is generally from non-compliant servers issuing the requests, so where should I be looking in my system to correct the request format so I can bring myself into compliance and get my curl requests working again?

Here are the current curl opts I'm using with my request...

CURLOPT_HTTPGET => TRUE,
CURLOPT_HEADER => FALSE,
CURLOPT_FAILONERROR => FALSE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 60,
CURLOPT_SSL_CIPHER_LIST => NULL,
CURLOPT_CAINFO => '/path/to/ca-certs.pem',
CURLOPT_SSL_VERIFYPEER => TRUE,
CURLOPT_SSL_VERIFYHOST => 2

And here are the SSL/TLS related options from httpd.conf...

SSLProtocol -all +TLSv1.3 +TLSv1.2
SSLProxyProtocol -all +TLSv1.3 +TLSv1.2

SSLCipherSuite    TLSv1.3   TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
SSLCipherSuite    SSL       AES256+EECDH:AES256+EDH:!SHA1:!SHA256:!SHA384

SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off

SSLOpenSSLConfCmd Curves X25519:secp521r1:prime256v1

Thanks for any help you can offer!


EDIT: Solution below, tldr; had to specify TLS version and cipher in the client request.

已采纳解答

原帖链接 · oucil · CC BY-SA 4.0

A useful error message would have been helpful, but essentially this boiled down to curl not negotiating one of the limited (but available) ciphers and so failing during the handshake. I had to manually force curl to utilize TLS1.2, and a specific cipher that the server is limited to. Here's what I added to the curlopt list...

CURLOPT_SSLVERSION = CURL_SSLVERSION_TLSv1_2,
CURLOPT_SSL_CIPHER_LIST = 'AES256+EECDH:AES256+EDH' 

No more errors. Hope that helps someone avoid the 2 days I wasted on this.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-03-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。