etcdctl: use "TrustedCAFile"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-03-20 15:08:36 -07:00
parent 706c760a3d
commit aece63b10e
3 changed files with 7 additions and 6 deletions

View File

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

View File

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

View File

@ -19,6 +19,7 @@ import (
"time" "time"
"github.com/coreos/etcd/etcdctl/ctlv3/command" "github.com/coreos/etcd/etcdctl/ctlv3/command"
"github.com/spf13/cobra" "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().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.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.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().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") rootCmd.PersistentFlags().StringVarP(&globalFlags.TLS.ServerName, "discovery-srv", "d", "", "domain name to query for SRV records describing cluster endpoints")