Skip to content

Commit

Permalink
Merge pull request #12539 from asubiotto/auth-err-msg
Browse files Browse the repository at this point in the history
security: make error message clearer
  • Loading branch information
asubiotto authored Dec 21, 2016
2 parents c05970f + 5c1b71e commit 4095f94
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/cli/interactive_tests/test_secure.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ eexpect $prompt

# Root can only authenticate using certificate authentication.
send "$argv sql --ca-cert=$ca_crt\r"
eexpect "user root must authenticate using a client certificate"
eexpect "user root must use certificate authentication instead of password authentication"

eexpect $prompt

Expand Down
2 changes: 1 addition & 1 deletion pkg/security/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func UserAuthPasswordHook(insecureMode bool, password string, hashedPassword []b
}

if requestedUser == RootUser {
return errors.Errorf("user %s must authenticate using a client certificate ", RootUser)
return errors.Errorf("user %s must use certificate authentication instead of password authentication", RootUser)
}

// If the requested user has an empty password, disallow authentication.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/pgwire_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestPGWire(t *testing.T) {
} else {
// No certificates provided in secure mode defaults to password
// authentication. This is disallowed for security.RootUser.
if !testutils.IsError(err, fmt.Sprintf("pq: user %s must authenticate using a client certificate", security.RootUser)) {
if !testutils.IsError(err, fmt.Sprintf("pq: user %s must use certificate authentication instead of password authentication", security.RootUser)) {
t.Errorf("unexpected error: %v", err)
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestPGWire(t *testing.T) {
t.Error(err)
}
} else {
if !testutils.IsError(err, fmt.Sprintf("pq: user %s must authenticate using a client certificate", security.RootUser)) {
if !testutils.IsError(err, fmt.Sprintf("pq: user %s must use certificate authentication instead of password authentication", security.RootUser)) {
t.Errorf("unexpected error: %v", err)
}
}
Expand Down

0 comments on commit 4095f94

Please sign in to comment.