Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Problem in mongodb 5.0 #259

Open
ruben-herold opened this issue Jul 12, 2022 · 2 comments
Open

Permission Problem in mongodb 5.0 #259

ruben-herold opened this issue Jul 12, 2022 · 2 comments

Comments

@ruben-herold
Copy link
Contributor

hi,

i try:

python3 /tmp/check_mongodb.py -a admin -u admin -p $adminpw -H "[$IPV6_Hostname]" -A replication_lag_percent -P 27017

I got:

CRITICAL - General MongoDB Error: not authorized on local to execute command { find: "system.namespaces", filter: { name: "local.oplog.$main" }, limit: 1, singleBatch: true, lsid: { id: UUID("1bcb0767-2f73-44ae-ace3-332f2378368b") }, $clusterTime: { clusterTime: Timestamp(1657633819, 1), signature: { hash: BinData(0, A4D4BEFFFEB4558DCAFE1BA0D1935F9F3C818952), keyId: 7119121417987162113 } }, $db: "local", $readPreference: { mode: "primaryPreferred" } }, full error: {'ok': 0.0, 'errmsg': 'not authorized on local to execute command { find: "system.namespaces", filter: { name: "local.oplog.$main" }, limit: 1, singleBatch: true, lsid: { id: UUID("1bcb0767-2f73-44ae-ace3-332f2378368b") }, $clusterTime: { clusterTime: Timestamp(1657633819, 1), signature: { hash: BinData(0, A4D4BEFFFEB4558DCAFE1BA0D1935F9F3C818952), keyId: 7119121417987162113 } }, $db: "local", $readPreference: { mode: "primaryPreferred" } }', 'code': 13, 'codeName': 'Unauthorized', '$clusterTime': {'clusterTime': Timestamp(1657633819, 1), 'signature': {'hash': b'\xa4\xd4\xbe\xff\xfe\xb4U\x8d\xca\xfe\x1b\xa0\xd1\x93_\x9f<\x81\x89R', 'keyId': 7119121417987162113}}, 'operationTime': Timestamp(1657633819, 1)}

The admin user looks like:

{
  users: [
    {
      _id: 'admin.admin',
      userId: UUID("298fb75d-889d-493e-8ac0-13621342dba9"),
      user: 'admin',
      db: 'admin',
      roles: [
        { role: 'readWriteAnyDatabase', db: 'admin' },
        { role: 'root', db: 'admin' },
        { role: 'userAdminAnyDatabase', db: 'admin' }
      ],
      mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
    },
    {
      _id: 'admin.nagios',
      userId: UUID("5b0ae07b-2c3f-429f-92df-addb4a47cb81"),
      user: 'nagios',
      db: 'admin',
      roles: [
        { role: 'readAnyDatabase', db: 'admin' },
        { role: 'clusterAdmin', db: 'admin' }
      ],
      mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
    }
  ],
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1657633939, i: 1 }),
    signature: {
      hash: Binary(Buffer.from("17c447b8bba8d582392c605616f6eb53006c5837", "hex"), 0),
      keyId: Long("7119121417987162113")
    }
  },
  operationTime: Timestamp({ t: 1657633939, i: 1 })
}


@jbeaujour
Copy link

jbeaujour commented Aug 11, 2022

Hello
I have the same problem, did you find a solution ?
In fact ihave this message on all actions: "Username/Password incorrect"
What are the credentials on your account ?
Thank's

@discostur
Copy link

Ran into the same problem with MongoDB v6.x. --action=replication_lag seems to work, but --action=replication_lag_percent is broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants