-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conscrypt does not support server-side SNI #11413
Comments
More clues...
I eventually redirected pointing So it seems that the only way to hit the server is through the hostname that matches the SSL certificate. |
Okay, I feel like an idiot :) My code contains I still suggest improving ease of troubleshooting for this case. The DEBUG logs don't seem to contain any hint that this is what went wrong. |
This is the code that does this check ... Lines 212 to 231 in 3d36825
When you run your DEBUG logs with your failing scenario do you get the DEBUG log output seen on line 223? Having the BadMessageException say something different and specific can be viewed as a security issue. |
Got it. Here is where I'm at now:
My understanding is that this means that the client is not sending a SNI hostname as part of the request, but that doesn't make sense since all browsers are supposed to support this by now. Here are some clues that might help:
The documentation mentions the |
@cowwoc remember that DEBUG log statements are typically for Jetty developers to have a clearer understanding of what's going on. In that particular log statement As a side note, remember that the SNI is sent per connection, not per request. It really seems from your logs that the SNI is not sent. Also, you are using |
@sbordet Sorry for the delayed response. Yes, it seems to be a bug in Conscrypt. If I replace:
with:
and remove:
from my code, then the SNI error goes away and the debug log show the correct SNI value. Can you please confirm that I was using Conscrypt correctly? Is it sufficient to include the dependencies I mentioned and invoking the two lines to configure I tried removing the |
I'm digging further into this and it smells of user error. Any ideas? |
The SNI host value is put into the Your logs shows that I really think that |
I think you're right, but then... what did google/conscrypt#712 add? I thought it was adding SNI support on the server. Okay, so what are the next steps here? Will you guys pick up the torch and follow up with the Conscrypt team? If so, google/conscrypt#644 might be a good place to start. I guess another thing to do is add an automated test for this scenario. In light of the current restriction, what is the recommended behavior for production? Use Conscript with SNI disabled or use the slower Java implementation? It's not clear how much of a performance difference this would make, nor how big a security risk it would be to disable SNI. |
@sbordet friendly bump |
I dug into this scenario again now that I have a better understanding of SNI and reverse-proxy configurations, and I'm seeing something weird...
Here are the server logs: server.log This makes me wonder whether the bug lies in conscrypt, jetty itself or a configuration mistaken on my part. What should I try next? Then again, maybe I'm beating a dead horse and #11413 (comment) proves that the problem lies in Conscrypt... EDIT: I just updated the server logs. The previous ones suffered from an nginx configuration problem (the reverse proxy wasn't configured to handle http2). Also, I just found out that nginx for Windows does not support http3, so that's guaranteed not to work. Is that a problem in our case? Is Conscrypt only used for HTTP/3 support? |
I think it's a Conscrypt bug. The The wrapping goes Unfortunately, calling What we can do is to try to retrieve the SNI via Stand by for a PR, but I would need you to test it 😃 |
Modified `SecureRequestCustomizer` to use `ExtendedSSLSession` APIs instead of relying on SSLSession attributes, that do not work in Conscrypt. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@cowwoc friendly bump 😄 |
Sorry @sbordet. I saw your earlier message. Unfortunately, my project is in an akward state at the moment which prevents it from running. I'll try to get this sorted out and test your fix in the upcoming week. |
The change to o.a.a.c.t.WebServerComponentTest#testSimpleSecureServerWithSniRequiredEnabled was due to jetty/jetty.project#11413. The test needed to be updated to deal with the new behavior from Jetty.
The change to o.a.a.c.t.WebServerComponentTest#testSimpleSecureServerWithSniRequiredEnabled was due to jetty/jetty.project#11413. The test needed to be updated to deal with the new behavior from Jetty.
Jetty version(s)
12.0.7
Jetty Environment
core
Java version/vendor
(use: java -version)
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Zulu21.30+15-CA (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Zulu21.30+15-CA (build 21.0.1+12-LTS, mixed mode, sharing)
OS type/version
Microsoft Windows [Version 10.0.19045.4046]
Description
https://eclipse.dev/jetty/documentation/jetty-12/operations-guide/index.html#og-protocols-ssl-sni states that when
sniRequired=false
the SNI checks should always pass.If you take a look at the attached DEBUG log, you'll notice that
sniRequired=false
(the default setting. I didn't alter it) but the server still responds withorg.eclipse.jetty.http.BadMessageException: 400: Invalid SNI
.debug.log
I suspect I know what is going wrong in my particular case: the browser is hitting the server by IP address, and that IP address happens to be my own IP address. I'm not sure if that ends up getting rerouted to localhost but it could be the case.
Per https://stackoverflow.com/a/69945374/14731:
If the failure I am seeing is expected behavior (working as designed) then I'd suggest making the following changes:
Invalid SNI. localhost is not allowed
orInvalid SNI IP address literals are not allowed
, etc.Out of curiosity, is there any way to bypass these restrictions? Or do I have to hit the server by name instead of by IP?
The text was updated successfully, but these errors were encountered: