mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-14 14:35:20 +08:00
caddyhttp: Add TLS client cert info to logs (#3640)
This commit is contained in:
parent
c6d6a775a1
commit
65a09524c3
@ -73,10 +73,14 @@ type LoggableTLSConnState tls.ConnectionState
|
|||||||
func (t LoggableTLSConnState) MarshalLogObject(enc zapcore.ObjectEncoder) error {
|
func (t LoggableTLSConnState) MarshalLogObject(enc zapcore.ObjectEncoder) error {
|
||||||
enc.AddBool("resumed", t.DidResume)
|
enc.AddBool("resumed", t.DidResume)
|
||||||
enc.AddUint16("version", t.Version)
|
enc.AddUint16("version", t.Version)
|
||||||
enc.AddUint16("ciphersuite", t.CipherSuite)
|
enc.AddUint16("cipher_suite", t.CipherSuite)
|
||||||
enc.AddString("proto", t.NegotiatedProtocol)
|
enc.AddString("proto", t.NegotiatedProtocol)
|
||||||
enc.AddBool("proto_mutual", t.NegotiatedProtocolIsMutual)
|
enc.AddBool("proto_mutual", t.NegotiatedProtocolIsMutual)
|
||||||
enc.AddString("server_name", t.ServerName)
|
enc.AddString("server_name", t.ServerName)
|
||||||
|
if len(t.PeerCertificates) > 0 {
|
||||||
|
enc.AddString("client_common_name", t.PeerCertificates[0].Subject.CommonName)
|
||||||
|
enc.AddString("client_serial", t.PeerCertificates[0].SerialNumber.String())
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user