From eadbba5c955070985ea918cffb724a8a92793572 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev Date: Thu, 3 Dec 2020 17:56:39 +0500 Subject: [PATCH 1/2] security master use access.ui --- docker/local-registry-compose.yml | 4 ---- weed/server/master_server.go | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docker/local-registry-compose.yml b/docker/local-registry-compose.yml index da86b4d74..7f3672cd0 100644 --- a/docker/local-registry-compose.yml +++ b/docker/local-registry-compose.yml @@ -13,10 +13,6 @@ services: - 8080:8080 - 18080:18080 command: "volume -mserver=master:9333 -port=8080 -ip=volume -max=0 -preStopSeconds=1" - volumes: - - type: bind - source: /Volumes/mobile_disk/data - target: /data depends_on: - master filer: diff --git a/weed/server/master_server.go b/weed/server/master_server.go index ccc94ebac..6d27d8035 100644 --- a/weed/server/master_server.go +++ b/weed/server/master_server.go @@ -82,6 +82,9 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste v.SetDefault("master.replication.treat_replication_as_minimums", false) replicationAsMin := v.GetBool("master.replication.treat_replication_as_minimums") + v.SetDefault("access.ui", true) + enableUiAccess := v.GetBool("access.ui") + var preallocateSize int64 if option.VolumePreallocate { preallocateSize = int64(option.VolumeSizeLimitMB) * (1 << 20) @@ -108,10 +111,12 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste ms.guard = security.NewGuard(ms.option.WhiteList, signingKey, expiresAfterSec, readSigningKey, readExpiresAfterSec) - if !ms.option.DisableHttp { + if enableUiAccess { handleStaticResources2(r) r.HandleFunc("/", ms.proxyToLeader(ms.uiStatusHandler)) r.HandleFunc("/ui/index.html", ms.uiStatusHandler) + } + if !ms.option.DisableHttp { r.HandleFunc("/dir/assign", ms.proxyToLeader(ms.guard.WhiteList(ms.dirAssignHandler))) r.HandleFunc("/dir/lookup", ms.guard.WhiteList(ms.dirLookupHandler)) r.HandleFunc("/dir/status", ms.proxyToLeader(ms.guard.WhiteList(ms.dirStatusHandler))) From c4459249efedb117cb66fbdbd8df87ec3d995865 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev Date: Mon, 14 Dec 2020 13:24:41 +0500 Subject: [PATCH 2/2] ui interface is always on --- weed/server/master_server.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/weed/server/master_server.go b/weed/server/master_server.go index 6d27d8035..58a991876 100644 --- a/weed/server/master_server.go +++ b/weed/server/master_server.go @@ -82,9 +82,6 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste v.SetDefault("master.replication.treat_replication_as_minimums", false) replicationAsMin := v.GetBool("master.replication.treat_replication_as_minimums") - v.SetDefault("access.ui", true) - enableUiAccess := v.GetBool("access.ui") - var preallocateSize int64 if option.VolumePreallocate { preallocateSize = int64(option.VolumeSizeLimitMB) * (1 << 20) @@ -111,11 +108,9 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste ms.guard = security.NewGuard(ms.option.WhiteList, signingKey, expiresAfterSec, readSigningKey, readExpiresAfterSec) - if enableUiAccess { - handleStaticResources2(r) - r.HandleFunc("/", ms.proxyToLeader(ms.uiStatusHandler)) - r.HandleFunc("/ui/index.html", ms.uiStatusHandler) - } + handleStaticResources2(r) + r.HandleFunc("/", ms.proxyToLeader(ms.uiStatusHandler)) + r.HandleFunc("/ui/index.html", ms.uiStatusHandler) if !ms.option.DisableHttp { r.HandleFunc("/dir/assign", ms.proxyToLeader(ms.guard.WhiteList(ms.dirAssignHandler))) r.HandleFunc("/dir/lookup", ms.guard.WhiteList(ms.dirLookupHandler))