2

I am getting the exception listed below:

 javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
        at sun.security.ssl.SSLSessionImpl.getPeerCertificates(Unknown Source)
        at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)
        at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:572)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
        at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:284)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.followRedirects(HTTPSamplerBase.java:1390)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.resultProcessing(HTTPSamplerBase.java:1461)
        at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.resultProcessing(HTTPAbstractImpl.java:251)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:356)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1075)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1064)
        at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:426)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:255)
        at java.lang.Thread.run(Unknown Source)

properties in Jmeter.properties:

> #https.default.protocol=TLS
> #https.default.protocol=SSLv3
> #https.socket.protocols=SSLv2Hello SSLv3 TLSv1

JDK version: 1.7

1.I have already imported the required certificates. 2.I tried setting the https.socket.protocols=SSLv3 [https://bz.apache.org/bugzilla/show_bug.cgi?id=54759]
3.I have changed the implementation to HTTPClient4 4. The certificate's expiry year is 2022

but it didn't work.Please suggest solutions

UPDATE:

           2020/09/23 13:32:07 INFO  - jmeter.util.HttpSSLProtocolSocketFactory: Using protocol list: SSLv3 
2020/09/23 13:32:07 INFO  - jmeter.util.JsseSSLManager: Using default SSL protocol: SSLv3 
2020/09/23 13:32:07 INFO  - jmeter.util.JsseSSLManager: SSL session context: per-thread 
2020/09/23 13:32:07 DEBUG - jmeter.util.JsseSSLManager: ssl Provider =  null 
2020/09/23 13:32:07 DEBUG - jmeter.util.JsseSSLManager: SSL stuff all set 
2020/09/23 13:32:07 DEBUG - jmeter.util.JsseSSLManager: JsseSSLManager installed 
2020/09/23 13:32:14 DEBUG - jmeter.protocol.http.sampler.HTTPHC4Impl: notifyFirstSampleAfterLoopRestart 
2020/09/23 13:32:15 DEBUG - jmeter.protocol.http.sampler.HTTPHC4Impl: Created new HttpClient: @******** 
2020/09/23 13:32:15 DEBUG - jmeter.protocol.http.control.HC3CookieHandler: Found 0 cookies for https:*******
2020/09/23 13:32:15 DEBUG - jmeter.util.JsseSSLManager: Creating threadLocal SSL context for: test
2020/09/23 13:32:15 INFO  - jmeter.util.SSLManager: JmeterKeyStore Location:  type JKS 
2020/09/23 13:32:15 INFO  - jmeter.util.SSLManager: KeyStore created OK 
2020/09/23 13:32:15 WARN  - jmeter.util.SSLManager: Keystore file not found, loading empty keystore 
2020/09/23 13:32:15 DEBUG - jmeter.util.SSLManager: JmeterKeyStore type: class org.apache.jmeter.util.keystore.JmeterKeyStore 
2020/09/23 13:32:15 DEBUG - jmeter.util.JsseSSLManager: class org.apache.jmeter.util.keystore.JmeterKeyStore 
2020/09/23 13:32:15 INFO  - jmeter.util.SSLManager: TrustStore Location: D:/apache-jmeter-2.11/test_truststore.jks 
2020/09/23 13:32:15 INFO  - jmeter.util.SSLManager: TrustStore created OK, Type: JKS 
2020/09/23 13:32:15 INFO  - jmeter.util.SSLManager: Truststore loaded OK from file

New Exception:

java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at sun.security.ssl.InputRecord.readFully(Unknown Source)
    at sun.security.ssl.InputRecord.readV3Record(Unknown Source)
    at sun.security.ssl.InputRecord.read(Unknown Source)
    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 org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:436)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:481)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:298)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1094)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
    at java.lang.Thread.run(Unknown Source)

Followed these steps but still getting the socket exception:

In user.properties file:

httpclient4.retrycount=1
hc.parameters.file=hc.parameters

In hc.parameters file:

http.connection.stalecheck$Boolean=true
HMT
  • 2,093
  • 1
  • 19
  • 51

2 Answers2

1

Enable debug logging for SSL by adding the next line to system.properties file

javax.net.debug=ssl

and then look at jmeter.log file and stdout, most probably you will figure out the exact reason for the failure from them.

Blind shot: the reason of failure might be due to you're using 8 years old JMeter version which is running on top of 10 years old JDK and some essential security certificates which reside under jre/lib/security/cacerts has expired already.

As per JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.3 (or whatever is the latest stable version you can find at JMeter Downloads page) and the latest stable version of 64-bit server JRE or JDK from OpenJDK website (the minimum supported one is mentioned in JMeter release notes)

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks for the response. I have updated the quetsion with debug logs. The exceptin says "No key(s) found" . Any idea on this ? – HMT Sep 22 '20 at 21:49
  • `test_truststore.jks` isn't something which comes with JMeter, if you're testing an endpoint requiring client-side authentication - you need to add the certificate to this `test_truststore.jks` file. If you don't - just remove any references to it from *system.properties* file. More information: [How to Set Your JMeter Load Test to Use Client Side Certificates](https://www.blazemeter.com/blog/how-set-your-jmeter-load-test-use-client-side-certificates) – Dmitri T Sep 23 '20 at 03:43
  • It turns out keystore setup is not required as we have a server certificate. I have updated the question, I don't see any error in the logs but getting new exception now. Can you share your views ? – HMT Sep 23 '20 at 12:45
  • 1
    Having an old truststore (in old JDK, with root expired or just not yet present) could not cause 'connection reset'; it would cause a very different exception. More likely free j7 implemented up to TLS 1.2 but by default client offers only up to TLS 1.0 (named TLSv1 in JSSE), and many servers that use TLS and HTTPS for security no longer allow TLS 1.0 because it is no longer considered secure. (E.g. the payment-card standard PCI DSS prohibits it.) [PAID update 7u131 enabled TLS 1.1 and 1.2.](https://www.oracle.com/java/technologies/javase/7-support-relnotes.html#R170_131) – dave_thompson_085 Sep 24 '20 at 00:03
  • 1
    (PS: _definitely_ don't try to use SSLv3; that's completely broken since 2014 and NOBODY allows it. See POODLE in https://en.wikipedia.org/wiki/Transport_Layer_Security .) – dave_thompson_085 Sep 24 '20 at 00:07
1

https.default.protocol=TLSv1.2

setting this worked for me.

MKG
  • 361
  • 2
  • 10