31. Consider a mongod process configured to use auditing. The following set of commands are sent to this server with the corresponding return messages: use admin > db.auth("user1", "passwordNotOk") Error: Authentication failed. 0 > db.auth("user1", "passwordOk") 1 > use prod > db.dropDatabase() { "ok": 0, "errmsg": "not authorized on prod to execute command { dropDatabase: 1.0, lsid: { id: UUID(\"1bc553fa-f720-4512-a03b-c5aacc13a7da\") }, $db: \"prod\" }", "code": 13, "codeName": "Unauthorized" } Which of the previous commands would produce the following audit message? { "atype" : "authenticate", "ts" : { "$date" : "2019-02-01T14:00:08.254-0500" }, "local" : { "ip" : "127.0.0.1", "port" : 30000 }, "remote" : { "ip" :"127.0.0.1", "port" : 64812 }, "users" : [ { "user" : "user1", "db" : "admin" }], "roles" : [ { "role" : "dbOwner", "db" : "staging" } ], "param" : { "user" :"user1", "db" : "admin", "mechanism" : "SCRAM-SHA-256" }, "result" : 0 } Check all that apply:
题目选项
- A.db.dropDatabase()
- B.db.auth("user1", "passwordOk")
- C.db.auth("user1", "passwordNotOk")
答案置信度:高
正确答案:C
解析语言:中文
该审计消息的 atype 为 authenticate、result 为 0,是一次认证失败的记录:db.auth("user1","passwordNotOk") 返回 0 并报 Authentication failed,正对应它(C)。成功的 db.auth("user1","passwordOk") 会记 result 1(B 不符);dropDatabase 被拒时 atype 是 dropDatabase、result 为 13 Unauthorized,与这条 authenticate 消息无关(A 不符)。