HW 1.5 Not Validating

Exercise 1.5

Having trouble with HW 1.5

When I run validate1.5 the script runs but I fail.
I am missing something in understanding the question.

  1. I have internal authentication set up with a keyfile on all replica sets

Replica Sets are running.

Confirmed by when I do rs.status() multiple times I can see the heartbeat change.

Collection is replicating

  1. I created a collection called aircraft and it can be read on when accessing the other member replica sets when I set rs.slaveok.

Confirmed x509 client authentication is working

  1. I set the SSL to work optionally for client authentication
  2. I have accessed via SSL with both client certificate and without client certificate
  3. I am able to login with the client.pem

Demonstrate not logged on

MongoDB Enterprise myReplSet:PRIMARY> show dbs
2019-02-18T11:10:40.415+0000 E QUERY [thread1] Error: listDatabases failed:{
“ok” : 0,
“errmsg” : “not authorized on admin to execute command { listDatabases: 1.0 }”,
“code” : 13
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:62:1
shellHelper.show@src/mongo/shell/utils.js:781:19
shellHelper@src/mongo/shell/utils.js:671:15
@(shellhelp2):1:1

Login with Client.PEM

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

SUCCESS

MongoDB Enterprise myReplSet:PRIMARY> show dbs
admin 0.000GB
local 0.000GB
MongoDB Enterprise myReplSet:PRIMARY>

Certificates are in the correct share.

Script output is as follows:

{ unauthorizedStatus: {“ok”:0,“errmsg”:“not authorized on admin to execute command { replSetGetStatus: 1.0 }”,“code”:13}, memberStatuses: Error: Authentication failed. 2019-02-18T11:24:18.028+0000 E QUERY [thread1] TypeError: status.members is undefined : @(shell eval):4:16, users: [{"_id":“admin.will”,“roles”:[{“role”:“root”,“db”:“admin”}]},{"_id":"$external.C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client",“roles”:[{“role”:“userAdminAnyDatabase”,“db”:“admin”}]}] }

What requirement am I not meeting?

Did you resolve your problem?, I have this status
{ unauthorizedStatus: {“ok”:0,“errmsg”:“not authorized on admin to execute command { replSetGetStatus: 1.0 }”,“code”:13}, memberStatuses: [“PRIMARY”,“SECONDARY”,“SECONDARY”], users: [{"_id":“admin.will”,“roles”:[{“role”:“root”,“db”:“admin”}]},{"_id":"$external.C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client",“roles”:[{“role”:“root”,“db”:“admin”}]}] }

You did not mentioned which course you are taking so it is a little bit hard to help.

What is the exact question?

Sometimes the status is the answer.

Please check the role given to the external user
Go through your lab requirements againThe line “after creating the wil user create another account…”

1 Like

That was my error, thanks