-
Notifications
You must be signed in to change notification settings - Fork 1.6k
SSL host name verification disabled by default #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is indeed a security issue (just like issue #352). A quick grep through the code suggest that these are the places to fix:
|
As the hostname verification thing is not the easiest thing to do. In a project I set the verifier to |
… to HostnameChecker.
Fix for #197 -- use a hostname verifier that does hostname verification
Closed by #197 |
Testing hostname verification can require some specialized knowledge -- wrote it up in http://tersesystems.com/2014/03/31/testing-hostname-verification/ |
It looks like some tests in the test suite are failing because they ask for the SSL session's peer certificates before the session has actually completed the handshake. Both
first, and then way down the line there is:
I comment out the hostname verifier, and the handshake happens successfully, much much later after the NettyConnectListener.onFutureSuccess.
Either there's something wrong in the tests, or the verification is happening in the wrong place and is only working by accident. |
This seems to work more reliably, if I defer NettyConnectListener to listen for a handshakeFuture:
|
Still seeing this for the Grizzly test though:
For reference, Netty now looks like this:
|
Hi @wsargent, Why do you resolve the SslHandler once again? Should the presence of a hostnameVerifier be checked first so that the listener is not added if it doesn't exist? Shouldn't requestSender.writeRequest(future, channel) only happen once the hostnameVerifier has done its job? Did you notice a performance impact? |
BTW, the SOF question you pointed seems to be an Android issue: netty/netty#1823 |
This is cut and pasted code from the complete handler. You're correct that it should use the same handler inside the scope.
Yes. This is very much first draft code.
Yes, you're correct.
Haven't tested it yet -- I noticed that when I called session.getPeerCertificates() it would throw an exception unless the handshake was established. I'm not sure why it doesn't come up in the Play WS integration tests -- maybe there's a race condition resolved against the remote host which means the handshake completes by the time the event is received. The SOF question is just an API reference, so I can see the idioms. |
I would very much like to have #525 merged into the 1.8.x branch as well -- Play 2.3 is coming out shortly, and having hostname verification turned on by default is something I can only do if I can ensure with that patch. |
* Change version for jenkins * [SECURITY-650] Introduce acceptAnyCertificate config, defaulting to false * Use a hostname verifier that does hostname verification, backport AsyncHttpClient#510, close AsyncHttpClient#197 * Bump netty version * Restore necessary compatibility * [JENKINS-54601] Fix test failures. * [JENKINS-54601] Correct POM info. * Add script to make it easier to get a working JDK7 environment * [JENKINS-54601] Include proper hostname verifier logic. * [JENKINS-54601] Update README.
AllowAllHostnameVerifier
is used if user does not explicitly set anotherHostnameVerifier
.I consider this to be a security issue and think this should be an opt-in setting instead. If there are any good reasons to do so, then default behavior should at least be clearly indicated in user guide.
The text was updated successfully, but these errors were encountered: