SCRAM-SHA-256 not supported on mongodb 4.4

Viewed 44

I'm trying to update use password using db.updateUser(). Supposedly, mongo should support SHA-256 since 4.0 when using passwordDigestor: "server". However, when I try, I get the following error:

uncaught exception: Error: Updating user failed: SCRAM-SHA-256 not supported in authMechanisms :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.updateUser@src/mongo/shell/db.js:1436:11
@(shell):1:1

Here's the command(s) I used on the individual node of a replica set:

use admin
db.updateUser(
    "the_username",
    {
        pwd: passwordPrompt(),
        mechanisms: [ "SCRAM-SHA-256" ],
        passwordDigestor: "server"
    }
)

I'm running 4.4.15 binaries, and Feature Compatibility Version is 4.4

1 Answers

Turns out there is a config file (on each individual node, mine was in /etc) which explicitly sets the mechanism set to only sha-1:

setParameter:
  authenticationMechanisms: SCRAM-SHA-1

If I change it to the folliwing it works as expected:

setParameter:
  authenticationMechanisms: SCRAM-SHA-256,SCRAM-SHA-1
Related