Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
tls/client auth: verify first certificates in client request (#3344)
When client certificate is enabled Caddy check only last certificate from request. When this cert is not in list of trusted leaf certificates, connection is rejected. According to RFC TLS1.x the sender's certificate must come first in the list. Each following certificate must directly certify the one preceding it. This patch fix this problem - first certificate is checked instead of last.
Karol Będkowski committed
May 6, 2020 at 16:07 UTC
b814c0af9c2c20a92f86e4db9836fd6b127dcf5b
1 file changed
+1
-1
modules/caddytls/connpolicy.go
+1
-1
@@ -395,7 +395,7 @@ func (clientauth ClientAuthentication) verifyPeerCertificate(rawCerts [][]byte,
395
return fmt.Errorf("no client certificate provided")
396
}
397
398
- remoteLeafCert, err := x509.ParseCertificate(rawCerts[len(rawCerts)-1])
398
+ remoteLeafCert, err := x509.ParseCertificate(rawCerts[0])
399
if err != nil {
400
return fmt.Errorf("can't parse the given certificate: %s", err.Error())
401
}