diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-03-16 09:40:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-16 09:40:51 -0700 |
| commit | 2aa9d9f84ac466e348821066f6332a8a5b777d47 (patch) | |
| tree | 416bd650c36851ed7603c74bc86308a24f214221 /weed/command/volume.go | |
| parent | b5b97a4799e1929bb22d816aca450ea18f7ec08e (diff) | |
| parent | 9b14f0c81a9348ccb8a79ffcf9cdbc7033d00fac (diff) | |
| download | seaweedfs-2aa9d9f84ac466e348821066f6332a8a5b777d47.tar.xz seaweedfs-2aa9d9f84ac466e348821066f6332a8a5b777d47.zip | |
Merge pull request #2760 from bercknash/berck/mtls
Diffstat (limited to 'weed/command/volume.go')
| -rw-r--r-- | weed/command/volume.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/weed/command/volume.go b/weed/command/volume.go index f3b36fcda..645c698b1 100644 --- a/weed/command/volume.go +++ b/weed/command/volume.go @@ -2,7 +2,6 @@ package command import ( "fmt" - "github.com/chrislusf/seaweedfs/weed/storage/types" "net/http" httppprof "net/http/pprof" "os" @@ -11,6 +10,8 @@ import ( "strings" "time" + "github.com/chrislusf/seaweedfs/weed/storage/types" + "github.com/spf13/viper" "google.golang.org/grpc" @@ -24,7 +25,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb" - "github.com/chrislusf/seaweedfs/weed/server" + weed_server "github.com/chrislusf/seaweedfs/weed/server" stats_collect "github.com/chrislusf/seaweedfs/weed/stats" "github.com/chrislusf/seaweedfs/weed/storage" "github.com/chrislusf/seaweedfs/weed/util" @@ -371,7 +372,14 @@ func (v VolumeServerOptions) startClusterHttpService(handler http.Handler) httpd StopTimeout: 30 * time.Second, CertFile: certFile, KeyFile: keyFile} - clusterHttpServer := httpDown.Serve(&http.Server{Handler: handler}, listener) + httpS := &http.Server{Handler: handler} + + if viper.GetString("https.volume.ca") != "" { + clientCertFile := viper.GetString("https.volume.ca") + httpS.TLSConfig = security.LoadClientTLSHTTP(clientCertFile) + } + + clusterHttpServer := httpDown.Serve(httpS, listener) go func() { if e := clusterHttpServer.Wait(); e != nil { glog.Fatalf("Volume server fail to serve: %v", e) |
