aboutsummaryrefslogtreecommitdiff
path: root/weed/security/tls.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <lebedev_k@tochka.com>2021-03-08 21:39:44 +0500
committerKonstantin Lebedev <lebedev_k@tochka.com>2021-03-08 21:39:44 +0500
commit190fada1ef079186b6bc62feda5d571c5aaa274a (patch)
treebf721855d706a539ac4233f422122856d549198a /weed/security/tls.go
parentc6d3735605b9e643c1b1c8c4c9c35bc467c27c5e (diff)
downloadseaweedfs-190fada1ef079186b6bc62feda5d571c5aaa274a.tar.xz
seaweedfs-190fada1ef079186b6bc62feda5d571c5aaa274a.zip
TLS allowed commonNames
Diffstat (limited to 'weed/security/tls.go')
-rw-r--r--weed/security/tls.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/weed/security/tls.go b/weed/security/tls.go
index 437d658a8..b38745fbf 100644
--- a/weed/security/tls.go
+++ b/weed/security/tls.go
@@ -29,12 +29,15 @@ func LoadServerTLS(config *util.ViperProxy, component string) (grpc.ServerOption
// load cert/key, ca cert
cert, err := tls.LoadX509KeyPair(config.GetString(component+".cert"), config.GetString(component+".key"))
if err != nil {
- glog.V(1).Infof("load cert/key error: %v", err)
+ glog.V(1).Infof("load cert: %s / key: %s error: %v",
+ config.GetString(component+".cert"),
+ config.GetString(component+".key"),
+ err)
return nil, nil
}
caCert, err := ioutil.ReadFile(config.GetString("grpc.ca"))
if err != nil {
- glog.V(1).Infof("read ca cert file error: %v", err)
+ glog.V(1).Infof("read ca cert file %s error: %v", config.GetString("grpc.ca"), err)
return nil, nil
}
caCertPool := x509.NewCertPool()
@@ -44,11 +47,11 @@ func LoadServerTLS(config *util.ViperProxy, component string) (grpc.ServerOption
ClientCAs: caCertPool,
ClientAuth: tls.RequireAndVerifyClientCert,
})
- permitCommonNames := config.GetStringSlice(component + "permitCommonNames")
+ permitCommonNames := config.GetStringSlice(component + ".allowed_commonNames")
if len(permitCommonNames) > 0 {
permitCommonNamesMap := make(map[string]bool)
- for _, s := range util.GetViper().GetStringSlice(component + "permitCommonNames") {
+ for _, s := range permitCommonNames {
permitCommonNamesMap[s] = true
}
auther := Authenticator{