0

my mongodb configuration which i am trying to add.

systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

storage:
  dbPath: /var/lib/mongo/mongo
journal:
  enabled: true

processManagement:
  fork: true
  pidFilePath: /var/run/mongodb/mongod.pid
  timeZoneInfo: /usr/share/zoneinfo

net:
  port: 27017
  bindIp: 0.0.0.0 # Enter 0.0.0.0, IPv4 and IPv6 addresses or alternatively, use the net.bindIpAll setting.
  ssl:
    mode: requireSSL
    PEMKeyFile: /usr/mongodb/keys/ip.pem
    clusterFile: /usr/mongodb/keys/ip.pem
    CAFile: /usr/mongodb/keys/mongodb-CA-cert.crt
    weakCertificateValidation: false
    allowInvalidCertificates: false

security:
  authorization: enabled
  clusterAuthMode: x509

replication:
  replSetName: rs
sharding:
  clusterRole: shardsvr

when I try to add this server, all servers try to log in with a nonexistent user. For example: they should use the following user "emailAddress=example@gmail.com,CN=rsroot,OU=Admin,O=company,L=,ST=Oblast,C=RU". but they do not use the username in the CN field, but their ip.

I tried to specify the certificate from the desired user in clusterFile, then it connected to the primary server, but could not connect to the server config (they have another rootuser authorization user)

"members" : [
    {
        "_id" : 0,
        "name" : "ip:27017",
        "health" : 1,
        "state" : 1,
        "stateStr" : "PRIMARY",
        "uptime" : 2379154,
        "optime" : {
            "ts" : Timestamp(1551515538, 7),
            "t" : NumberLong(2)
        },
        "optimeDate" : ISODate("2019-03-02T08:32:18Z"),
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "infoMessage" : "",
        "electionTime" : Timestamp(1549136387, 1),
        "electionDate" : ISODate("2019-02-02T19:39:47Z"),
        "configVersion" : 50,
        "self" : true,
        "lastHeartbeatMessage" : ""
    },
    {
        "_id" : 1,
        "name" : "ip:27017",
        "health" : 0,
        "state" : 6,
        "stateStr" : "(not reachable/healthy)",
        "uptime" : 0,
        "optime" : {
            "ts" : Timestamp(0, 0),
            "t" : NumberLong(-1)
        },
        "optimeDurable" : {
            "ts" : Timestamp(0, 0),
            "t" : NumberLong(-1)
        },
        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
        "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
        "lastHeartbeat" : ISODate("2019-03-02T08:32:18.656Z"),
        "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
        "pingMs" : NumberLong(0),
        "lastHeartbeatMessage" : "",
        "authenticated" : false,
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "infoMessage" : "",
        "configVersion" : -1
    }
],

ip all servers are different

Is it possible for each server to specify a user to authorize?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.