HTTPD + OpenSSL – 很长时间连接到端口443然后ssl_handshake_failure

我知道ssl_handshake_failure是一个通用的错误,但这是我最后的手段,因为我已经调查了这个问题三个星期。

我正在AIX服务器上部署Apache HTTPD服务器。 AIX没有标准的存储库,所以我从perzl.org/aix/的RPM软件包中安装了它

我很难解决所有的依赖,但最终我得到了它的工作。 我希望RPM不会让我这样做,没有所有适当的依赖。

当我只通过端口80使用HTTP时,Apache服务器工作得很好。当我尝试通过端口443连接到它时,问题就出现了。

我用下面的命令testing它:

openssl s_client -state -connect 127.0.0.1:443 

一旦我运行这个命令,我得到:

 CONNECTED(00000003) SSL_connect:before/connect initialization SSL_connect:SSLv2/v3 write client hello A 

OpenSSL然后等待大约两分钟,然后抛出以下错误:

 804401144:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 0 bytes and written 305 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : 0000 Session-ID: Session-ID-ctx: Master-Key: Key-Arg : None PSK identity: None PSK identity hint: None SRP username: None Start Time: 1505947800 Timeout : 300 (sec) Verify return code: 0 (ok) --- 

这很奇怪,似乎apache 没有发回任何数据 ,然后在一段时间之后,OpenSSL客户端“轮胎”等待,然后抛出err。

我试图保持我的configuration尽可能简单,因为我现在只想完成握手。

这是我的httpd-ssl.conf

 LoadModule ssl_module /opt/freeware/lib/httpd/modules/mod_ssl.so Listen 443 SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4 SSLProtocol all -SSLv3 <VirtualHost *:443> DocumentRoot "/usr/local/Tomcat/tomcat1/webapps/ROOT" ServerName <server_name>:443 ServerAdmin root@localhost ErrorLog "logs/httpd/ssl_error_log" LogLevel trace8 TransferLog "logs/httpd/ssl_access_log" LogLevel trace8 SSLEngine on SSLCertificateFile "cert.crt" SSLCertificateKeyFile "cert.key" <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory "/var/www/cgi-bin"> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-5]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog "/var/log/httpd/ssl_request_log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </VirtualHost> 

我把所有的日志都放在trace8级别,但是这并没有帮助我,当我尝试完成ssl握手时,这是我从ssl_error_log获得的所有信息

 [ssl:info] [client 127.0.0.1:36193] AH01964: Connection to child 66 established (server <server_name>:443) [ssl:trace2] ssl_engine_rand.c(125): Seeding PRNG with 136 bytes of entropy [ssl:trace3] ssl_engine_kernel.c(1988): [client 127.0.0.1:36193] OpenSSL: Handshake: start [ssl:trace3] ssl_engine_kernel.c(1996): [client 127.0.0.1:36193] OpenSSL: Loop: before/accept initialization [ssl:info] [client 194.10.155.114:52781] AH01964: Connection to child 65 established (server <server_name>:443) [ssl:trace2] ssl_engine_rand.c(125): Seeding PRNG with 136 bytes of entropy [ssl:trace3] ssl_engine_kernel.c(1988): [client 194.10.155.114:52781] OpenSSL: Handshake: start [ssl:trace3] ssl_engine_kernel.c(1996): [client 194.10.155.114:52781] OpenSSL: Loop: before/accept initialization 

OpenSSL版本:

 OpenSSL 1.0.2j-fips 26 Sep 2016 

Apache HTTPD版本:

 Server version: Apache/2.4.25 (Unix) 

任何关于我可能想念人的想法? 为什么握手错误需要相当长的时间才能出现,类似于超时错误?

恐怕这可能是我错过了的东西,或者是一些与依赖有关的复杂问题,因为我没有从任何回购安装它。

任何猜测?

使用真实的服务器名称,而不是“ ServerName <server_name>:443 ”。 https://httpd.apache.org/docs/current/en/mod/core.html#servername

“如果没有指定ServerName,则服务器首先向操作系统请求系统主机名,然后尝试推断客户端可见主机名,如果失败,则对系统上存在的IP地址执行反向查找。