Skip to content

Conversation

xdqi
Copy link

@xdqi xdqi commented Nov 18, 2023

@brandond

This patch should fix k3s-io/k3s#7821

Note: The original way of checking the validity of SAN[1] is not consistent with x509 logic of Go's standard library. So I adapted it.

[1]: Go never use CN field of a X509 certificate to validate, it use SAN only.

https://github.com/golang/go/blob/631a6c2abfb2cf7a877ea80f98c504fc4e0077be/src/crypto/x509/verify.go#L109

}
for _, cn := range cn {
if cnRegexp.MatchString(cn) {
if validHostnamePattern(cn) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is correct, as populateCN is also called to add CNs extracted from TLS handshakes and HTTP host headers. Since validHostnamePattern calls validHostname(host, true), I believe this would allow unauthenticated callers to make dynamiclistener add wildcard SANs, if they spoof the correct value. I think wildcards should only be added if requested by the administrator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wildcard domain support with --tls-san

2 participants