Skip to content

javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name #117

@DareBoost

Description

@DareBoost

Hi !

I got an SSLProtocolException when I try to access https://www.allianz.fr or https://www.fluo.com/ through browsermob-proxy.

javax.net.ssl.SSLProtocolException: handshake alert:  unrecognized_name
    at sun.security.ssl.ClientHandshaker.handshakeAlert(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.recvAlert(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.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275)
    at net.lightbody.bmp.proxy.http.TrustingSSLSocketFactory.createLayeredSocket(TrustingSSLSocketFactory.java:77)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:254)
    at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at net.lightbody.bmp.proxy.http.BrowserMobHttpClient.execute(BrowserMobHttpClient.java:824)
    at net.lightbody.bmp.proxy.http.BrowserMobHttpClient.execute(BrowserMobHttpClient.java:625)
    at net.lightbody.bmp.proxy.http.BrowserMobHttpRequest.execute(BrowserMobHttpRequest.java:148)
    at net.lightbody.bmp.proxy.BrowserMobProxyHandler.proxyPlainTextRequest(BrowserMobProxyHandler.java:265)
    at net.lightbody.bmp.proxy.selenium.SeleniumProxyHandler.handle(SeleniumProxyHandler.java:185)
    at net.lightbody.bmp.proxy.jetty.http.HttpContext.handle(HttpContext.java:1509)
    at net.lightbody.bmp.proxy.jetty.http.HttpContext.handle(HttpContext.java:1461)
    at net.lightbody.bmp.proxy.jetty.http.HttpServer.service(HttpServer.java:892)
    at net.lightbody.bmp.proxy.jetty.http.HttpConnection.service(HttpConnection.java:815)
    at net.lightbody.bmp.proxy.jetty.http.HttpConnection.handleNext(HttpConnection.java:981)
    at net.lightbody.bmp.proxy.jetty.http.HttpConnection.handle(HttpConnection.java:832)
    at net.lightbody.bmp.proxy.jetty.http.SocketListener.handleConnection(SocketListener.java:245)
    at net.lightbody.bmp.proxy.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
    at net.lightbody.bmp.proxy.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

It seems to be due to the Server Name Indication (http://www.ietf.org/rfc/rfc4366.txt : page 8)
which is enabled by default in Java 7.
http://stackoverflow.com/questions/7615645/ssl-handshake-alert-unrecognized-name-error-since-upgrade-to-java-1-7-0

The simpliest way to resolve the issue would be to add a flag to disabled SNI :
java -Djsse.enableSNIExtension=false

But it will disabled the SNI for all the JVM, so it may cause trouble to access other website which required SNI.

A solution to enable SNI and still support misconfigured server is suggest here: http://stackoverflow.com/a/14884941

But I'm not sure it's the best way to do it.
Any opinion ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions