mirror of
https://github.com/minio/minio.git
synced 2025-03-31 09:43:43 -04:00
clarify error message for root user credential (#20043)
Signed-off-by: Austin Chang <austin880625@gmail.com>
This commit is contained in:
parent
ce183cb2b4
commit
5f64658faa
@ -843,6 +843,7 @@ func loadRootCredentials() {
|
|||||||
// Check both cases and authenticate them if correctly defined
|
// Check both cases and authenticate them if correctly defined
|
||||||
var user, password string
|
var user, password string
|
||||||
var hasCredentials bool
|
var hasCredentials bool
|
||||||
|
var legacyCredentials bool
|
||||||
//nolint:gocritic
|
//nolint:gocritic
|
||||||
if env.IsSet(config.EnvRootUser) && env.IsSet(config.EnvRootPassword) {
|
if env.IsSet(config.EnvRootUser) && env.IsSet(config.EnvRootPassword) {
|
||||||
user = env.Get(config.EnvRootUser, "")
|
user = env.Get(config.EnvRootUser, "")
|
||||||
@ -851,6 +852,7 @@ func loadRootCredentials() {
|
|||||||
} else if env.IsSet(config.EnvAccessKey) && env.IsSet(config.EnvSecretKey) {
|
} else if env.IsSet(config.EnvAccessKey) && env.IsSet(config.EnvSecretKey) {
|
||||||
user = env.Get(config.EnvAccessKey, "")
|
user = env.Get(config.EnvAccessKey, "")
|
||||||
password = env.Get(config.EnvSecretKey, "")
|
password = env.Get(config.EnvSecretKey, "")
|
||||||
|
legacyCredentials = true
|
||||||
hasCredentials = true
|
hasCredentials = true
|
||||||
} else if globalServerCtxt.RootUser != "" && globalServerCtxt.RootPwd != "" {
|
} else if globalServerCtxt.RootUser != "" && globalServerCtxt.RootPwd != "" {
|
||||||
user, password = globalServerCtxt.RootUser, globalServerCtxt.RootPwd
|
user, password = globalServerCtxt.RootUser, globalServerCtxt.RootPwd
|
||||||
@ -859,8 +861,13 @@ func loadRootCredentials() {
|
|||||||
if hasCredentials {
|
if hasCredentials {
|
||||||
cred, err := auth.CreateCredentials(user, password)
|
cred, err := auth.CreateCredentials(user, password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(config.ErrInvalidCredentials(err),
|
if legacyCredentials {
|
||||||
"Unable to validate credentials inherited from the shell environment")
|
logger.Fatal(config.ErrInvalidCredentials(err),
|
||||||
|
"Unable to validate credentials inherited from the shell environment")
|
||||||
|
} else {
|
||||||
|
logger.Fatal(config.ErrInvalidRootUserCredentials(err),
|
||||||
|
"Unable to validate credentials inherited from the shell environment")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if env.IsSet(config.EnvAccessKey) && env.IsSet(config.EnvSecretKey) {
|
if env.IsSet(config.EnvAccessKey) && env.IsSet(config.EnvSecretKey) {
|
||||||
msg := fmt.Sprintf("WARNING: %s and %s are deprecated.\n"+
|
msg := fmt.Sprintf("WARNING: %s and %s are deprecated.\n"+
|
||||||
|
@ -73,6 +73,12 @@ var (
|
|||||||
`Access key length should be at least 3, and secret key length at least 8 characters`,
|
`Access key length should be at least 3, and secret key length at least 8 characters`,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ErrInvalidRootUserCredentials = newErrFn(
|
||||||
|
"Invalid credentials",
|
||||||
|
"Please provide correct credentials",
|
||||||
|
EnvRootUser+` length should be at least 3, and `+EnvRootPassword+` length at least 8 characters`,
|
||||||
|
)
|
||||||
|
|
||||||
ErrMissingEnvCredentialRootUser = newErrFn(
|
ErrMissingEnvCredentialRootUser = newErrFn(
|
||||||
"Missing credential environment variable, \""+EnvRootUser+"\"",
|
"Missing credential environment variable, \""+EnvRootUser+"\"",
|
||||||
"Environment variable \""+EnvRootUser+"\" is missing",
|
"Environment variable \""+EnvRootUser+"\" is missing",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user