绕过TLS证书不匹配

问题描述 投票:0回答:1

我正在尝试使用Fiddler捕获基于https://github.com/TakahikoKawasaki/nv-websocket-client和服务器wss://echo.websocket.org的java客户端之间的websocket通信。我可以通过使用Proxifier或ProxyCap将客户端重定向到localhost:8888来监听非安全连接(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的组合 我将FiddlerRoot.cer添加到java cacerts中。 我会感激更多的想法。

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

java ssl websocket proxy fiddler
1个回答
1
投票

最简单的机制是配置Fiddler将证书的主机名设置为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";
}
© www.soinside.com 2019 - 2024. All rights reserved.