mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Fixed #2810. Do not warn about password for internally generated no auth user when just system account assigned to non-default.
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -171,16 +171,19 @@ func (p *Permissions) clone() *Permissions {
|
||||
// Lock is assumed held.
|
||||
func (s *Server) checkAuthforWarnings() {
|
||||
warn := false
|
||||
if s.opts.Password != "" && !isBcrypt(s.opts.Password) {
|
||||
if s.opts.Password != _EMPTY_ && !isBcrypt(s.opts.Password) {
|
||||
warn = true
|
||||
}
|
||||
for _, u := range s.users {
|
||||
// Skip warn if using TLS certs based auth
|
||||
// unless a password has been left in the config.
|
||||
if u.Password == "" && s.opts.TLSMap {
|
||||
if u.Password == _EMPTY_ && s.opts.TLSMap {
|
||||
continue
|
||||
}
|
||||
// Check if this is our internal sys client created on the fly.
|
||||
if s.sysAccOnlyNoAuthUser != _EMPTY_ && u.Username == s.sysAccOnlyNoAuthUser {
|
||||
continue
|
||||
}
|
||||
|
||||
if !isBcrypt(u.Password) {
|
||||
warn = true
|
||||
break
|
||||
@@ -1142,7 +1145,7 @@ func validateAllowedConnectionTypes(m map[string]struct{}) error {
|
||||
}
|
||||
|
||||
func validateNoAuthUser(o *Options, noAuthUser string) error {
|
||||
if noAuthUser == "" {
|
||||
if noAuthUser == _EMPTY_ {
|
||||
return nil
|
||||
}
|
||||
if len(o.TrustedOperators) > 0 {
|
||||
|
||||
@@ -663,7 +663,7 @@ func configureSystemAccount(o *Options, m map[string]interface{}) (retErr error)
|
||||
// or was present but set to false.
|
||||
func (o *Options) ProcessConfigFile(configFile string) error {
|
||||
o.ConfigFile = configFile
|
||||
if configFile == "" {
|
||||
if configFile == _EMPTY_ {
|
||||
return nil
|
||||
}
|
||||
m, err := conf.ParseFileWithChecks(configFile)
|
||||
@@ -1018,7 +1018,7 @@ func (o *Options) processConfigFileLine(k string, v interface{}, errors *[]error
|
||||
}
|
||||
}
|
||||
// In case "system_account" is defined as well, it takes precedence
|
||||
if o.SystemAccount == "" {
|
||||
if o.SystemAccount == _EMPTY_ {
|
||||
o.SystemAccount = o.TrustedOperators[0].SystemAccount
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user