ssl - 通过 Apache JMeter 连接到自签名 SSL 网站

标签 ssl jmeter

我尝试在使用自签名 SSL 证书的网站上进行性能测试。

我的 JMeter 测试计划在“普通”SSL 站点(具有正确签名的证书)和没有 SSL 的测试页面上工作正常。一旦我访问测试页面(使用自签名证书),JMeter 只会产生错误。我尝试过的:

  1. 存储证书(通过浏览器)并将其导入 Java(通过控制面板“Java”)

  2. 将证书添加到 keystore 并通过以下命令行启动 JMeter(我不知道如何以另一种方式“在 JVM 中引用 keystore ”?!)

    java -jar "ApacheJMeter.jar" -Djavax.net.ssl.keyStore="C:\Program Files\Java\jre7\lib\security\cacerts" -Djavax.net.ssl.keyStorePassword=changeit

感谢提示如何让 JMeter 访问测试页面:)

目前的结果(JMeter 输出)是:

javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
    at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.readResponse(HTTPJavaImpl.java:264)
    at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(HTTPJavaImpl.java:520)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
    at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
    at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
    at java.net.URLConnection.getHeaderFieldLong(Unknown Source)
    at java.net.URLConnection.getContentLengthLong(Unknown Source)
    at java.net.URLConnection.getContentLength(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getContentLength(Unknown Source)
    at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.readResponse(HTTPJavaImpl.java:230)
    ... 7 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at sun.security.ssl.InputRecord.read(Unknown Source)
    ... 21 more

最佳答案

看看这个答案:JMeter and optional SSL client certificate在 JMeter HTTP 请求中查看您的端口号。 https 的标准端口是 443。

关于ssl - 通过 Apache JMeter 连接到自签名 SSL 网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15163081/

相关文章:

mysql - 需要了解不同 pem key 的使用

java - 以编程方式将 PEM 证书导入 Java KeyStore

iis - 在 IIS 7.5 中要求设置 SSL 时忽略/禁止客户端/服务器 SSL 证书

java - 未在 saucelabs 上设置测试状态

tomcat - javax.net.ssl.SSLPeerUnverifiedException : peer not authenticated when load testing with JMeter

java - Collections.sort 未按预期对 ArrayList 进行排序 [beanshell、Java、JMeter]

performance - Jmeter :- Running a bundle of samplers sequentially within concurrent threads

jmeter - 使用 JMeter __FileToString 函数,获取 java.io.FileNotFoundException

java - 当加速周期和/或线程数量很大时,日志中会出现错误

sockets - Erlang 接受 SSL 连接真的很慢(与 C++ 相比)