Browse Source

etcdctl: use "TrustedCAFile"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
aece63b10e
3 changed files with 7 additions and 6 deletions
  1. 4 4
      etcdctl/ctlv2/command/util.go
  2. 1 1
      etcdctl/ctlv3/command/global.go
  3. 2 1
      etcdctl/ctlv3/ctl.go

+ 4 - 4
etcdctl/ctlv2/command/util.go

@@ -173,10 +173,10 @@ func getTransport(c *cli.Context) (*http.Transport, error) {
 		discoveryDomain = ""
 	}
 	tls := transport.TLSInfo{
-		CAFile:     cafile,
-		CertFile:   certfile,
-		KeyFile:    keyfile,
-		ServerName: discoveryDomain,
+		CertFile:      certfile,
+		KeyFile:       keyfile,
+		ServerName:    discoveryDomain,
+		TrustedCAFile: cafile,
 	}
 
 	dialTimeout := defaultDialTimeout

+ 1 - 1
etcdctl/ctlv3/command/global.go

@@ -180,7 +180,7 @@ func newClientCfg(endpoints []string, dialTimeout, keepAliveTime, keepAliveTimeo
 	}
 
 	if scfg.cacert != "" {
-		tlsinfo.CAFile = scfg.cacert
+		tlsinfo.TrustedCAFile = scfg.cacert
 		cfgtls = &tlsinfo
 	}
 

+ 2 - 1
etcdctl/ctlv3/ctl.go

@@ -19,6 +19,7 @@ import (
 	"time"
 
 	"github.com/coreos/etcd/etcdctl/ctlv3/command"
+
 	"github.com/spf13/cobra"
 )
 
@@ -62,7 +63,7 @@ func init() {
 	rootCmd.PersistentFlags().BoolVar(&globalFlags.InsecureSkipVerify, "insecure-skip-tls-verify", false, "skip server certificate verification")
 	rootCmd.PersistentFlags().StringVar(&globalFlags.TLS.CertFile, "cert", "", "identify secure client using this TLS certificate file")
 	rootCmd.PersistentFlags().StringVar(&globalFlags.TLS.KeyFile, "key", "", "identify secure client using this TLS key file")
-	rootCmd.PersistentFlags().StringVar(&globalFlags.TLS.CAFile, "cacert", "", "verify certificates of TLS-enabled secure servers using this CA bundle")
+	rootCmd.PersistentFlags().StringVar(&globalFlags.TLS.TrustedCAFile, "cacert", "", "verify certificates of TLS-enabled secure servers using this CA bundle")
 	rootCmd.PersistentFlags().StringVar(&globalFlags.User, "user", "", "username[:password] for authentication (prompt if password is not supplied)")
 	rootCmd.PersistentFlags().StringVarP(&globalFlags.TLS.ServerName, "discovery-srv", "d", "", "domain name to query for SRV records describing cluster endpoints")