Skip to content

Commit

Permalink
etcdmain: support crl in grpcproxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Romano committed Jul 18, 2017
1 parent ecd3e11 commit e6d2b31
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions etcdmain/grpc_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package etcdmain

import (
"crypto/tls"
"fmt"
"math"
"net"
Expand Down Expand Up @@ -62,6 +61,7 @@ var (
grpcProxyListenCert string
grpcProxyListenKey string
grpcProxyListenAutoTLS bool
grpcProxyListenCRL string

grpcProxyAdvertiseClientURL string
grpcProxyResolverPrefix string
Expand Down Expand Up @@ -117,6 +117,7 @@ func newGRPCProxyStartCommand() *cobra.Command {
cmd.Flags().StringVar(&grpcProxyListenKey, "key-file", "", "identify secure connections to the proxy using this TLS key file")
cmd.Flags().StringVar(&grpcProxyListenCA, "trusted-ca-file", "", "verify certificates of TLS-enabled secure proxy using this CA bundle")
cmd.Flags().BoolVar(&grpcProxyListenAutoTLS, "auto-tls", false, "proxy TLS using generated certificates")
cmd.Flags().StringVar(&grpcProxyListenCRL, "client-crl-file", "", "proxy client certificate revocation list file.")

return &cmd
}
Expand Down Expand Up @@ -238,18 +239,17 @@ func mustListenCMux(tlsinfo *transport.TLSInfo) cmux.CMux {
os.Exit(1)
}

var tlscfg *tls.Config
scheme := "http"
if l, err = transport.NewKeepAliveListener(l, "tcp", nil); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if tlsinfo != nil {
if tlscfg, err = tlsinfo.ServerConfig(); err != nil {
tlsinfo.CRLFile = grpcProxyListenCRL
if l, err = transport.NewTLSListener(l, tlsinfo); err != nil {
plog.Fatal(err)
}
scheme = "https"
}
if l, err = transport.NewKeepAliveListener(l, scheme, tlscfg); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}

plog.Infof("listening for grpc-proxy client requests on %s", grpcProxyListenAddr)
return cmux.New(l)
}
Expand Down

0 comments on commit e6d2b31

Please sign in to comment.