Bug 53922

Summary: Using HTTPS with a Certificate not matching Host leads to javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
Product: JMeter - Now in Github Reporter: Philippe Mouawad <p.mouawad>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: RESOLVED WONTFIX    
Severity: normal CC: p.mouawad
Priority: P2    
Version: 2.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Simple Test Plan showing issue
Test Case for HTTPCLient

Description Philippe Mouawad 2012-09-23 11:04:59 UTC
See :
http://stackoverflow.com/questions/12538233/javax-net-ssl-sslpeerunverifiedexception-peer-not-authenticated-when-load-testi

"So I have JMeter setup to test my SSL-enabled site (I've got a real certificate from Geotrust, not a self-signed cert) and I've been running into problems when I try testing an SSL connection directly from Tomcat. I get:
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)
"
whenever I try to connect. This is using JMeter 2.7 with the HttpClient4 implementation. It is a simple GET request to one of my services hosted on Tomcat 7 (7.0.27 for anyone interested).

Here is my Tomcat config for my SSL connector. Note that I have APR/native installed and this is running on an Ubuntu 12.04 server up on EC2.

<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" />

User has setup:
ec2-50-17-85-212.compute-1.amazonaws.com:8443/hello 
or ec2-50-17-85-212.compute-1.amazonaws.com:9090/hello 
which can be used for testing externally. The SSL certificate is valid, but it won't match the hostname since I don't have a DNS name for it. Regardless, this should help illustrate the issue. The URL is for a simple "Hello, world!" REST service that can be accessed via a standard GET. –





After some investigation issue seems to come from HttpClient, so I opened:
https://issues.apache.org/jira/browse/HTTPCLIENT-1234
Comment 1 Philippe Mouawad 2012-09-23 11:06:51 UTC
Affects 2.6, 2.7 and current trunk r1387986
Comment 2 Philippe Mouawad 2012-09-23 11:07:57 UTC
Created attachment 29408 [details]
Simple Test Plan showing issue
Comment 3 Philippe Mouawad 2012-09-23 11:08:53 UTC
Created attachment 29409 [details]
Test Case for HTTPCLient
Comment 4 Philippe Mouawad 2012-09-23 18:32:37 UTC
After feedback from Oleg, test case works with JDK7 but not with JDK6.

So I tested with JMeter on a JDK7 and I confirm what Oleg says, so issue is in JDK6.

I close bug.
Comment 5 The ASF infrastructure team 2022-09-24 20:37:51 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2935