-
Notifications
You must be signed in to change notification settings - Fork 257
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
The session resumption doesn`t work #182
Comments
I'm not sure about if it is a bug in uTLS or As far as I know, our upstream And unfortunately uTLS did not extend any functionality in terms of PSK. You might want to try if you could get |
Related to #107. |
#231 adds support for PSK. |
HI @gaukas, great job on the PSK I'm trying to use PSK while restoring client hello from raw bytes(comes from a real browser) via
everything is well from my logs I see client session being stored and retrieved without a problem(shared client session cache between uTlsClient with a mutex), until the 2nd handshake where it dies with a panic For some reason browser never sends PreSharedKeyExtension in the 2nd ClientHello, which I verified by inserting a bunch of fmt.Println into uTLS here: Line 226 in fc79497
first handshake:
second handshake:
as you see 2nd handshake doesn't have presharedkeyextension(41) In normal operation browser(Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0) always sends PreSharedKeyExtension on resume I would like to understand what's going on... At the very least there should be no panic... |
If this is any help, I'm using uTLS in a context of proxy server where I'm parsing ClientHello from my browser(firefox) and trying to reproduce it via uTLSClient by calling I pinned this down to uTLS server being unable to establish PSK, I configured it with the following:
and then
tls package is uTLS here obviously |
@3andne possibly related. When no PSK ext is used, by misconfiguration the client MAY call I could not stably reproduce this panic but I do see it a few times when trying different combinations of configs. |
One of the thing to note when you try PSK-based resumption is you may want to carefully check IF there is a valid session to resume (the version needs to be TLS1.3). Also, you may want to set For more detailed usages please check out the examples. |
@let4be From the assertion failure, it can be inferred that the issue is as follows: The utls is basically complaining that:
In this scenario, the utls is unsure how to proceed. Although the error message could be improved, the intention is to highlight such unintended behaviors explicitly. |
Not sure if I understood correctly here. But in my opinion, in that case, we may just want to simply skipping attempting on the resumption. It could be very common (or at least justifiable, if anyone would argue on that) for a user to use a non-PSK ClientHelloSpec with CSC set. |
It has to have both ClientSessionCache and |
It is awkward since it is an passive flag and people will most likely just ignore it. But I see your point that simply skipping the resumption may cause other problems... |
Agreed. I really hate making things verbose. However in this case there are something we have to do. I propose improving the error message, adding another control flag 😂 that enables the skipping behavior. We can also find a way to enable this automatically for predefined fingerprints that doesn't contain PSK extensions. |
So, turns out I was using uTLS wrong - no UtlsPreSharedKeyExtension in the ClientHello I was using to build ClientHello spec from was my fault... Better error message could be nice to have, so that further users have a better idea about what exactly went wrong |
I tried using HelloChrome_100_PSK to see the session resumption
error occurred:
#> HttpGetCustom() failed: uTlsConn.Handshake() error: local error: tls: bad record MAC
Is PSK binders is wrong or some other reason?
deep into the code
handshake_client.go -> loadSession
It seems like the PSK binder calculation is correct, so I cannot find where the issue is
The text was updated successfully, but these errors were encountered: