Skip to content

Commit 0b28f28

Browse files
committed
set ClientAuth and ClientCAs on plugin client tls config
1 parent 78c507c commit 0b28f28

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

client.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,8 @@ func (c *Client) Start() (addr net.Addr, err error) {
574574

575575
c.config.TLSConfig = &tls.Config{
576576
Certificates: []tls.Certificate{cert},
577+
ClientAuth: tls.RequireAndVerifyClientCert,
578+
MinVersion: tls.VersionTLS12,
577579
ServerName: "localhost",
578580
}
579581
}
@@ -774,7 +776,7 @@ func (c *Client) Start() (addr net.Addr, err error) {
774776
}
775777

776778
// loadServerCert is used by AutoMTLS to read an x.509 cert returned by the
777-
// server, and load it as the RootCA for the client TLSConfig.
779+
// server, and load it as the RootCA and ClientCA for the client TLSConfig.
778780
func (c *Client) loadServerCert(cert string) error {
779781
certPool := x509.NewCertPool()
780782

@@ -791,6 +793,7 @@ func (c *Client) loadServerCert(cert string) error {
791793
certPool.AddCert(x509Cert)
792794

793795
c.config.TLSConfig.RootCAs = certPool
796+
c.config.TLSConfig.ClientCAs = certPool
794797
return nil
795798
}
796799

0 commit comments

Comments
 (0)