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
caddyhttp: Add TLS client cert info to logs (#3640)
Matt Holt committed
Aug 7, 2020 at 12:12 UTC
65a09524c3926547ed0b8515da211173df4fe379
1 file changed
+5
-1
modules/caddyhttp/marshalers.go
+5
-1
@@ -73,10 +73,14 @@ type LoggableTLSConnState tls.ConnectionState
73
func (t LoggableTLSConnState) MarshalLogObject(enc zapcore.ObjectEncoder) error {
74
enc.AddBool("resumed", t.DidResume)
75
enc.AddUint16("version", t.Version)
76
- enc.AddUint16("ciphersuite", t.CipherSuite)
76
+ enc.AddUint16("cipher_suite", t.CipherSuite)
77
enc.AddString("proto", t.NegotiatedProtocol)
78
enc.AddBool("proto_mutual", t.NegotiatedProtocolIsMutual)
79
enc.AddString("server_name", t.ServerName)
80
+ if len(t.PeerCertificates) > 0 {
81
+ enc.AddString("client_common_name", t.PeerCertificates[0].Subject.CommonName)
82
+ enc.AddString("client_serial", t.PeerCertificates[0].SerialNumber.String())
83
+ }
84
return nil
85
}
86