Skip to content

crypto/tls: improve invalid client certificate error message #35190

Description

@dpifke

What version of Go are you using (go version)?

go version 1.13.1 linux/amd64

Does this issue reproduce with the latest release?

It should, based on reading the source code.

What did you do?

I have a web server which handles a mix of API and interactive requests. API requests are authenticated using TLS client certificates, so tls.Config.ClientAuth was set to tls.RequestClientCert.

A customer who uses the Brave browser was consistently seeing ERR_SSL_DECRYPT_ERROR_ALERT when trying to connect. This appears to correspond to the server aborting the TLS connection. When this happened, I saw the following message in the server logs:

tls: invalid certificate signature

This error is emitted by crypto/tls/handshake_server_tls13.go:821. Reading that routine, it appears that any error with the client cert causes the connection to be aborted, rather than the certificate being ignored.

Switching to NoClientCert allowed them to connect. Unfortunately, I didn't have a way to capture the client certificate they were sending.

What did you expect to see?

I'd like to be able to treat invalid client certificates as "not present." The documentation for ClientAuthType is sparse, but given these options:

const (
    NoClientCert ClientAuthType = iota
    RequestClientCert
    RequireAnyClientCert
    VerifyClientCertIfGiven
    RequireAndVerifyClientCert
)

... it seemed reasonable to assume that Request != Require or Verify. I thus think this is probably a bug.

If this is actually working as intended, then please consider a feature request for some setting below RequestClientCert which allows the use of client certificates but doesn't abort in the case of a bogus cert.

Expanding the ClientAuthType documentation would be a definite plus as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions