-
Notifications
You must be signed in to change notification settings - Fork 17.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
crypto/tls: client did not fail when lack of a certificate and server requires one #59012
Comments
cc @golang/security |
Because of how TLS 1.3 works, the client won't notice the issue until the first call to
Currently this information is only documented in the 1.12 release notes. It would be good to add it to crypto/tls. |
Thanks for the investigation. I stumbled over this, since I want to write a very simple syslog implementation, that sends logs to other syslog sinks (like rsyslog etc.) |
@codemaker219 checking prior to your first real interaction does not really add much benefit because of TOCTOU |
@zerkms |
Now I thought a little bit more about it. If the |
@codemaker219 What you want is simply incompatible with how TLS 1.3 works. You have to read from the connection to tell if the server rejected you. But if it didn't reject you, then reading from the connection will either block indefinitely, or irreversibly consume some actual data. I will also point out that any application that only writes data to a remote TCP connection is fundamentally broken in the event of a half-closed connection. In that case, you need to use application-level pings/acks, at which point your TLS 1.3 issue is resolved. |
@rittneje Thanks for the reply. I did also some research and it seems that this behavior is indeed not a bug. So I will close that issue even I think that this could be improved. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I was playing around with mtls in golang. During testing error cases I am not sure if golang behaves correctly.
If I configure the server to force client authentication with
RequireAndVerifyClientCert
the client seems not to get the info, that the tls handshake was not successful.Try this:
What did you expect to see?
On
tls.Dial
or at least onn, err := con.Write([]byte("msg"))
an error should be returned since the client was not able to authenticate (Dint send any client certificate). It seems like the client thinks that everything is going well...What did you see instead?
You will see
Wrote 3 bytes
produced by the client part, but the server part didnt received the messagemsg
The text was updated successfully, but these errors were encountered: