因此,我设置了 JMeter 来测试启用 SSL 的站点(我从 Geotrust 获得了真正的证书,而不是自签名证书),当我尝试直接从 Tomcat 测试 SSL 连接时遇到了问题。我得到:
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at com.sun.net.ssl.internal.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:352)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:397)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:150)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:575)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:277)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1060)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1049)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:442)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:271)
at java.lang.Thread.run(Thread.java:680)
每当我尝试连接时。这是使用带有 HttpClient4 实现的 JMeter 2.7。这是对我在 Tomcat 7 上托管的一项服务的简单 GET 请求(对任何感兴趣的人来说都是 7.0.27)。
这是我的 SSL 连接器的 Tomcat 配置。请注意,我安装了 APR/native,它在 EC2 上的 Ubuntu 12.04 服务器上运行。
<Connector port="8443" maxHttpHeaderSize="8192"
protocol="HTTP/1.1"
URIEncoding="UTF-8"
acceptorThreadCount="5"
maxThreads="400"
scheme="https"
secure="true"
SSLEnabled="true"
SSLCipherSuite="ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH"
SSLHonorCipherOrder="true"
SSLVerifyClient="optional"
SSLCertificateFile="/etc/tomcat7/ssl/star.example.com.crt"
SSLCertificateKeyFile="/etc/tomcat7/ssl/star.example.com.key"
SSLCertificateChainFile="/etc/tomcat7/ssl/geotrust.crt" />
同样,这只是 JMeter 的一个问题。我可以使用任何浏览器毫无问题地访问该站点,如果我将 Apache 放在 Tomcat 前面并使用 mod_proxy 或 mod_jk,我没有任何问题。任何帮助,将不胜感激。