Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-74738

Can't run transitionToDedicatedConfigServer with auth on, but can run removeShard

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Sharding NYC
    • Fully Compatible
    • ALL

      I'm logged in as a user with the "root" role

      [direct: mongos] admin> db.runCommand({connectionStatus:1})
      {
        authInfo: {
          authenticatedUsers: [ { user: 'admin', db: 'admin' } ],
          authenticatedUserRoles: [ { role: 'root', db: 'admin' } ]
        },
        ok: 1,
        '$clusterTime': {
          clusterTime: Timestamp({ t: 1678422366, i: 1 }),
          signature: {
            hash: Binary(Buffer.from("caabfec785f45dd5f8a7ae0ddfe87a213a7b29ab", "hex"), 0),
            keyId: Long("7208009756202500117")
          }
        },
        operationTime: Timestamp({ t: 1678422366, i: 1 })
      }
      

      But I can't run the transitionToDedicatedConfigServer command

      [direct: mongos] admin> db.adminCommand({ transitionToDedicatedConfigServer: 1 });
      MongoServerError: not authorized on admin to execute command { transitionToDedicatedConfigServer: 1, lsid: { id: UUID("9b4c914a-68c2-4429-80c5-1a4c210c980c") }, $clusterTime: { clusterTime: Timestamp(1678422366, 1), signature: { hash: BinData(0, CAABFEC785F45DD5F8A7AE0DDFE87A213A7B29AB), keyId: 7208009756202500117 } }, $db: "admin" }
      

      However, this is just a wrapper around removeShard, and I can still run removeShard

      [direct: mongos] admin> db.adminCommand({removeShard: "config"})
      {
        msg: 'draining started successfully',
        state: 'started',
        shard: 'config',
        note: 'you need to drop or movePrimary these databases',
        dbsToMove: [ 'test' ],
        ok: 1,
        '$clusterTime': {
          clusterTime: Timestamp({ t: 1678422410, i: 2 }),
          signature: {
            hash: Binary(Buffer.from("00ed9d2573b2779304bcde3c54c1c8a9a0fef5b2", "hex"), 0),
            keyId: Long("7208009756202500117")
          }
        },
        operationTime: Timestamp({ t: 1678422410, i: 2 })
      }
      

            Assignee:
            jack.mulrow@mongodb.com Jack Mulrow
            Reporter:
            joanna.cheng@mongodb.com Joanna Cheng
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: