Can't authenticate HM1.3

Hi ,
i’ve created the user

db.getSiblingDB("$external").runCommand(
{
createUser: “C=US,ST=New York,L=New York City,O=MongoDB,OU=UniversityClient,CN=M310 Client”,
roles: [
{ role: “root”, db: “admin” }
]
}
)

but, when I try the authentication with the command

db.getSiblingDB("$external").auth(
{
user: “C=US,ST=New York,L=New York City,O=MongoDB,OU=UniversityClient,CN=M310 Client”,
mechanism: “MONGODB-X509” }
)

I receive the error

MongoDB Enterprise database:PRIMARY> db.getSiblingDB("$external").auth(
… {
… user: “C=US,ST=New York,L=New York City,O=MongoDB,OU=UniversityClient,CN=M310 Client”,
… mechanism: “MONGODB-X509” }
… )
Error: Username “C=US,ST=New York,L=New York City,O=MongoDB,OU=UniversityClient,CN=M310 Client” does not match the provided client certificate user “C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client”
0

why??? (desperated)

It literally tells you why :slight_smile:

“C=US,ST=New York,L=New York City,O=MongoDB,OU=UniversityClient,CN=M310 Client”

does not match

“C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client”

Which is correct. It does NOT match.

ok,
if I try to create a user with

MongoDB Enterprise database:PRIMARY> db.getSiblingDB("$external").runCommand(
… {
… createUser: “C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client”,
… roles: [
… { role: “root”, db: “admin” }
… ]
… }
… )

I receive

errmsg" : “Cannot create an x.509 user with a subjectname that would be recognized as an internal cluster member.”,

AHA! Now that’s interesting… it seems that you have already used that particular certificate for one of the replica set nodes :slight_smile:

Me, I haven’t reached this lab assignment yet, so I’m looking forward to it!

now it’s okey.
I’ve created the user and the authentications success.

But when I try the validation I receive

{ unauthorizedStatus: {“info”:“run rs.initiate(…) if not yet done for the set”,“ok”:0,“errmsg”:“no replset config has been received”,“code”:94}, memberStatuses: Error: Could not find user C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client@$external 2018-11-19T20:37:08.923+0000 E QUERY [thread1] TypeError: status.members is undefined : @(shell eval):7:16 }

this is my user

MongoDB Enterprise database:PRIMARY> db.system.users.find().pretty()
{
“_id” : “$external.C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client”,
“user” : “C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client”,
“db” : “$external”,
“credentials” : {
“external” : true
},
“roles” : [
{
“role” : “root”,
“db” : “admin”
}
]
}