绕过TLS证书不匹配



我正在尝试基于https://github.com/takahikokawasaki/nv-websocket-client和服务器WSS://echo.websocket捕获Java客户端之间的WebSocket通信。使用提琴手的组织。我可以通过将客户端重定向到Localhost:8888使用Proxifier或ProxyCap来收听非安全连接(WS://)。但是,使用TLS,我会遇到一个错误:The certificate of the peer does not match the expected hostname (echo.websocket.org)。如何在不修改客户端的源代码的情况下解决此问题?使用浏览器(Chrome/Firefox),我可以看到所有问题(我相信Fiddler的根证书)。我正在使用Windows 7。

编辑提供更多信息:
我尝试了Ericlaw解决方案,但结果是相同的。我在客户端内部打印了验证步骤:

//direct connection:
(SocketConnector)mSocket.InetAddress: echo.websocket.org/174.129.224.73
(SocketConnector)mSocket.getLocalSocketAddress: /192.168.0.100:2044
(SSLSession)verify: host=echo.websocket.org
(SSLSession)verify: cipher suite=TLS_RSA_WITH_AES_128_CBC_SHA256
(SSLSession)verify: peer host=echo.websocket.org
(SSLSession)verify: session.toString=[Session-1, 
TLS_RSA_WITH_AES_128_CBC_SHA256]
verifyHostName: hostName=echo.websocket.org, pattern=*.websocket.org
VERIFIED!
//proxy+fiddler:
(SocketConnector)mSocket.InetAddress: echo.websocket.org/174.129.224.73
(SocketConnector)mSocket.getLocalSocketAddress: /127.0.0.1:2039
(SSLSession)verify: host=echo.websocket.org
(SSLSession)verify: cipher suite=SSL_NULL_WITH_NULL_NULL
(SSLSession)verify: peer host=null
(SSLSession)verify: session.toString=[Session-1, SSL_NULL_WITH_NULL_NULL]

提琴手内部:
200 HTTP Tunnel to 174.129.224.73:443 proxifier:5840
CONNECT标头SessionID: empty)没有响应。我还尝试了Protocols: <client>;ssl3;tls1.0;tls1.1;tls1.2的组合
我在Java Cacerts中添加了FiddlerRoot.cer
我会感谢更多的想法。

编辑2
我安装了多个Java版本,并且将证书添加到错误的密钥库中。最终解决方案确实是OnBeforeRequest功能内部的oSession["x-OverrideCertCN"] = "*.websocket.org"; CACERT更新。

最简单的机制是配置提示器将证书的主机设置为echo.websocket.org(或其他)。

// Put the correct IP address or hostname in the next line.
if (oSession.uriContains("1.2.3.4")) {
    oSession["x-OverrideCertCN"] = "*.websocket.org";
}

相关内容

最新更新