allow root user to be disabled via config settings (#17089)

This commit is contained in:
Harshavardhana
2023-04-28 12:24:14 -07:00
committed by GitHub
parent 701b89f377
commit 7ae69accc0
14 changed files with 303 additions and 178 deletions

View File

@@ -51,6 +51,7 @@ type apiConfig struct {
deleteCleanupInterval time.Duration
disableODirect bool
gzipObjects bool
rootAccess bool
}
const cgroupLimitFile = "/sys/fs/cgroup/memory/memory.limit_in_bytes"
@@ -152,6 +153,7 @@ func (t *apiConfig) init(cfg api.Config, setDriveCounts []int) {
t.deleteCleanupInterval = cfg.DeleteCleanupInterval
t.disableODirect = cfg.DisableODirect
t.gzipObjects = cfg.GzipObjects
t.rootAccess = cfg.RootAccess
}
func (t *apiConfig) isDisableODirect() bool {
@@ -168,6 +170,13 @@ func (t *apiConfig) shouldGzipObjects() bool {
return t.gzipObjects
}
func (t *apiConfig) permitRootAccess() bool {
t.mu.RLock()
defer t.mu.RUnlock()
return t.rootAccess
}
func (t *apiConfig) getListQuorum() string {
t.mu.RLock()
defer t.mu.RUnlock()