-
Notifications
You must be signed in to change notification settings - Fork 97
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
require a TLS client certificate by default #453
Conversation
This commit changes the `ClientAuth` type from `RequestClientCert` to `RequireAnyClientCert` by default. In general, a KES server should demand a client certificate. Otherwise, a client (the HTTP/TLS stack) may choose to not send a client certificate - even if one is available. For example, the HTTP stack may try to be smart and not send a client certificate if it determines that cannot be validated since its self-signed. Instead, the KES server's TLS should abort the handshake if the client does not send a certificate. However, in some cases we cannot enforce this. In particular, when some APIs should be accessible without TLS authentication, like `/v1/metrics`. In these cases, we have to make it optional for clients to send a certificate. However, disabling auth for some APIs is an advanced use case intended only for users who are aware of the implications. Signed-off-by: Andreas Auernhammer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any obvious issues, but I also am not sure how to test this, so take my approval with a grain of salt.
// If mTLS authentication is disabled for at least one API, | ||
// we must no longer require that a client sends a certificate. | ||
// However, this may cause authentication errors when a client | ||
// (the client's HTTP/TLS stack) does not send a certificate | ||
// for an API that requires authentication. | ||
if api.InsecureSkipAuth.Value { | ||
if clientAuth == tls.RequireAnyClientCert { | ||
clientAuth = tls.RequestClientCert | ||
} | ||
if clientAuth == tls.RequireAndVerifyClientCert { | ||
clientAuth = tls.VerifyClientCertIfGiven | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aead just to confirm, how exactly would someone disable auth for an API? I don't recall this in the server config options off the top of my head.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit changes the
ClientAuth
type fromRequestClientCert
toRequireAnyClientCert
by default.In general, a KES server should demand a client certificate. Otherwise, a client (the HTTP/TLS stack) may choose to not send a client certificate - even if one is available. For example, the HTTP stack may try to be smart and not send a client certificate if it determines that cannot be validated since its self-signed.
Instead, the KES server's TLS should abort the handshake if the client does not send a certificate. However, in some cases we cannot enforce this. In particular, when some APIs should be accessible without TLS authentication, like
/v1/metrics
. In these cases, we have to make it optional for clients to send a certificate. However, disabling auth for some APIs is an advanced use case intended only for users who are aware of the implications.