1
0
Fork 0

Log TLS client subject

This commit is contained in:
xmessi 2022-11-21 10:18:05 +01:00 committed by GitHub
parent 630de7481e
commit 27c02b5a56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 0 deletions

View file

@ -3,6 +3,8 @@ package accesslog
import (
"bytes"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/json"
"fmt"
"io"
@ -370,6 +372,7 @@ func TestLoggerJSON(t *testing.T) {
Duration: assertFloat64NotZero(),
Overhead: assertFloat64NotZero(),
RetryAttempts: assertFloat64(float64(testRetryAttempts)),
TLSClientSubject: assertString("CN=foobar"),
TLSVersion: assertString("1.3"),
TLSCipher: assertString("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"),
"time": assertNotEmpty(),
@ -780,6 +783,9 @@ func doLoggingTLSOpt(t *testing.T, config *types.AccessLog, enableTLS bool) {
req.TLS = &tls.ConnectionState{
Version: tls.VersionTLS13,
CipherSuite: tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
PeerCertificates: []*x509.Certificate{{
Subject: pkix.Name{CommonName: "foobar"},
}},
}
}