[JAVA-3712] User authorization issue Created: 28/Apr/20  Updated: 28/Apr/20  Resolved: 28/Apr/20

Status: Closed
Project: Java Driver
Component/s: Command Operations
Affects Version/s: 4.0.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: jiang yongbing Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

system : centos 7



 Description   

平台安装了一个三个节点的MongoDB复制集群。

当我在主节点登陆admin数据库,然后选择了其中的一个应用数据库,使用db.createUser({user:"XX",pwd:"XX",roles:[

{role:"dbOwner",db:"XXX"}

]})给数据库创建了一个用户。

然后我使用robo等工具,能使用这个账号密码访问对应的数据库,也能进行查询修改等操作。但是当我在控制台使用mongo命令连接进去之后,所有的操作都被拒绝。错误信息一直显示我一个已经删除了的test数据库权限被拒绝,跟我当前操作的数据完全不搭边。当我输入show users,类似下面的错误信息:

------

2020-04-28T19:17:09.066+0800 E QUERY [js] Error: not authorized on test to execute command { usersInfo: 1.0, lsid:

{ id: UUID("fd77665d-73e4-4281-98e3-db3ef79849ca") }

, $clusterTime: { clusterTime: Timestamp(1588072625, 1), signature:

{ hash: BinData(0, 3F0BA488A9BF081067029BC157D379CB7364AE4A), keyId: 6815855173080973313 }

}, $db: "test" } 


其中上述报错信息中的数据库test,是跟当前数据库完全没有任何联系的。

 

输入show collections

------

Warning: unable to run listCollections, attempting to approximate collection names by parsing connectionStatus

------

接着我验证登陆 db.auth("xxxx","xxxx"),我确认了无数次,再账号密码输对的情况下还是被拒绝。这如果是个bug,希望你们能够修改。否则希望能够说明一下原因,目前我没找到遇到类似问题的答案。

 



 Comments   
Comment by Jeffrey Yemin [ 28/Apr/20 ]

Hi 253684597@qq.com

You've opened an issue in the JAVA project, which is meant for reporting bugs against the MongoDB Java driver. Your question seems unrelated to the Java driver, so I'm going to close it.

 

I suggest you first seek help in our [Community Forums|https://developer.mongodb.com/community/forums/] to ascertain whether this is truly a bug.

Comment by Jeffrey Yemin [ 28/Apr/20 ]

I attempted to translate the description via translate.google.com:

The platform installed a three-node MongoDB replication cluster.

When I log in to the admin database on the master node, and then select one of the application databases, use

db.createUser ({user: "XX", pwd: "XX", roles: [
 
{role: "dbOwner", db: "XXX"}
]}) 
Created a user for the database.

Then I use tools such as robo to use this account password to access the corresponding database, as well as query and modify operations. But when I use the mongo command to connect in the console, all operations are rejected. The error message keeps showing that the permission of a test database that I have deleted has been denied, which is completely incompatible with the data I am currently operating. When I enter show users, an error message similar to the following:

------

2020-04-28T19:17:09.066+0800 E QUERY [js] Error: not authorized on test to execute command { usersInfo: 1.0, lsid:

{ id: UUID("fd77665d-73e4-4281-98e3-db3ef79849ca") }

, $clusterTime: { clusterTime: Timestamp(1588072625, 1), signature:

{ hash: BinData(0, 3F0BA488A9BF081067029BC157D379CB7364AE4A), keyId: 6815855173080973313 }

}, $db: "test" } 


Among them, the database test in the above error message has absolutely no connection with the current database.

 

Input: show collections

------

Warning: unable to run listCollections, attempting to approximate collection names by parsing connectionStatus

------

Then I verified the login to db.auth ("xxxx", "xxxx"), I confirmed it countless times, and it was rejected even if the account password was entered correctly. If this is a bug, I hope you can fix it. Otherwise, I hope I can explain why. At present, I have not found an answer to a similar problem.

 

Generated at Thu Feb 08 09:00:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.