Skip to content

Commit

Permalink
shared: Set GetClientCertificate in TLS config.
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Laing <[email protected]>
  • Loading branch information
markylaing committed Jul 5, 2024
1 parent e41e3e4 commit 6f8cdf6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shared/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ func GetTLSConfigMem(tlsClientCert string, tlsClientKey string, tlsClientCA stri
}

tlsConfig.Certificates = []tls.Certificate{cert}
tlsConfig.GetClientCertificate = func(info *tls.CertificateRequestInfo) (*tls.Certificate, error) {
// GetClientCertificate is called if not nil instead of performing the default selection of an appropriate
// certificate from the `Certificates` list. We only have one-key pair to send, and we always want to send it
// because this is what uniquely identifies the caller to the server.
return &cert, nil
}
}

var tlsRemoteCert *x509.Certificate
Expand Down

0 comments on commit 6f8cdf6

Please sign in to comment.