aboutsummaryrefslogtreecommitdiff
path: root/weed/security
diff options
context:
space:
mode:
authorshibinbin <shibinbin@megvii.com>2020-06-04 17:24:18 +0800
committershibinbin <shibinbin@megvii.com>2020-06-04 17:24:18 +0800
commit40334bc28d3fa694ce59b4e65077efb845264d20 (patch)
treea085e2e33851c4d916bef2952abc7cfbfe95ee88 /weed/security
parentd892cad15d748327c2b7c649f6398ff35d8dce0b (diff)
parentfbed2e9026b71c810dd86bd826c9e068e93d3c48 (diff)
downloadseaweedfs-40334bc28d3fa694ce59b4e65077efb845264d20.tar.xz
seaweedfs-40334bc28d3fa694ce59b4e65077efb845264d20.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'weed/security')
-rw-r--r--weed/security/guard.go2
-rw-r--r--weed/security/tls.go14
2 files changed, 9 insertions, 7 deletions
diff --git a/weed/security/guard.go b/weed/security/guard.go
index 17fe2ea9e..87ec91ec1 100644
--- a/weed/security/guard.go
+++ b/weed/security/guard.go
@@ -62,7 +62,7 @@ func NewGuard(whiteList []string, signingKey string, expiresAfterSec int, readSi
return g
}
-func (g *Guard) WhiteList(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
+func (g *Guard) WhiteList(f http.HandlerFunc) http.HandlerFunc {
if !g.isWriteActive {
//if no security needed, just skip all checking
return f
diff --git a/weed/security/tls.go b/weed/security/tls.go
index f4f525ede..1832e6e07 100644
--- a/weed/security/tls.go
+++ b/weed/security/tls.go
@@ -3,12 +3,14 @@ package security
import (
"crypto/tls"
"crypto/x509"
- "github.com/spf13/viper"
"io/ioutil"
- "github.com/chrislusf/seaweedfs/weed/glog"
+ "github.com/spf13/viper"
+
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
+
+ "github.com/chrislusf/seaweedfs/weed/glog"
)
func LoadServerTLS(config *viper.Viper, component string) grpc.ServerOption {
@@ -19,12 +21,12 @@ func LoadServerTLS(config *viper.Viper, 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.Errorf("load cert/key error: %v", err)
+ glog.V(1).Infof("load cert/key error: %v", err)
return nil
}
caCert, err := ioutil.ReadFile(config.GetString(component + ".ca"))
if err != nil {
- glog.Errorf("read ca cert file error: %v", err)
+ glog.V(1).Infof("read ca cert file error: %v", err)
return nil
}
caCertPool := x509.NewCertPool()
@@ -46,12 +48,12 @@ func LoadClientTLS(config *viper.Viper, component string) grpc.DialOption {
// load cert/key, cacert
cert, err := tls.LoadX509KeyPair(config.GetString(component+".cert"), config.GetString(component+".key"))
if err != nil {
- glog.Errorf("load cert/key error: %v", err)
+ glog.V(1).Infof("load cert/key error: %v", err)
return grpc.WithInsecure()
}
caCert, err := ioutil.ReadFile(config.GetString(component + ".ca"))
if err != nil {
- glog.Errorf("read ca cert file error: %v", err)
+ glog.V(1).Infof("read ca cert file error: %v", err)
return grpc.WithInsecure()
}
caCertPool := x509.NewCertPool()