我遇到了一个使用TLS后端的HAProxy-Server问题。 启动HAProxy时,后端会将所有服务器报告为closures状态:
Server web_remote/apache_rem_1 is DOWN, reason: Layer6 invalid response, info: "SSL handshake failure", check duration: 41ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
后端的configuration如下:
backend web_remote balance leastconn option httpchk HEAD / option redispatch retries 3 default-server inter 5000 rise 2 fall 5 maxconn 10000 maxqueue 50000 server apache_rem_1 192.0.2.1:12345 check maxconn 1000 maxqueue 5000 ssl ca-file /etc/ssl/web.pem server apache_rem_2 2001:DB8:3:4:5:6:8:12345 check maxconn 1000 maxqueue 5000 ssl ca-file /etc/ssl/web.pem
这个后端工作得很好,直到现在,服务器上的快速wget也起作用了, openssl s_client报告后端的证书是有效的。
HAProxy / TLS还有什么可以configuration错误的吗? 当一切都报告握手成功时,我怎么能debugging这个问题?
在试图find用HAProxy进行debugging的方法之后,我终于input并使用tcpdump来debuggingnetworking通信。
通过将TLS密钥和PCAP文件导入到启用了SSL的Wireshark中,我发现错误非常迅速:根CA对于HAProxy而言是未知的,因此validation失败。 事实certificate,一个同事改变了证书,但不知道这个PEM需要完整的信任链。 将正确的根CA添加到.PEM文件解决了这一问题,服务器恢复正常操作。
尝试将check-ssl添加到server行以强制健康检查通过SSL运行。