简体   繁体   English

Mongodb --身份验证

[英]Mongodb --authentication

I used mongodb on my local without authentication by running mongod as server and connecting it by just mongo as a user.我通过将mongod作为服务器运行并仅通过mongo作为用户连接它来在我的本地使用 mongodb 而不进行身份验证。 Now after creating users and running the server as mongod --auth i can connect using user id and pwd assigned by me.现在,在创建用户并以mongod --auth身份运行服务器后,我可以使用我分配的用户 ID 和密码进行连接。

The problem is while connecting back mongo with mongod it again gets connected to the database and whole database is visible again,this should not happen as I have enabled the authentication.问题是当用mongod连接回 mongo 时,它再次连接到数据库并且整个数据库再次可见,这不应该发生,因为我已经启用了身份验证。

Using mongod as a server should block the users from getting access.使用mongod作为服务器应该会阻止用户访问。 Same is the problem for my personal server.我的个人服务器也有同样的问题。

Is there any solution to enable the security permanently that is enable mongod --auth and not just mongod.是否有任何解决方案可以永久启用安全性,即启用mongod --auth而不仅仅是 mongod。

If I understand correctly, your concern is that restarting a mongod process without access control enabled allows you to access data without authentication.如果我理解正确,您担心的是在没有启用访问控制的情况下重新启动mongod进程允许您在没有身份验证的情况下访问数据。 This is the expected outcome: a user with direct access to restart services or copy MongoDB data files has greater permissions than the mongod process.这是预期的结果:可以直接访问重启服务或复制 MongoDB 数据文件的用户比mongod进程拥有更大的权限。

Authentication only verifies remote client access to the mongod service: it does not encrypt or protect data files if a user has direct local read access.身份验证仅验证远程客户端对mongod服务的访问:如果用户具有直接本地读取访问权限,它不会加密或保护数据文件。 If you have an environment allowing remote and/or multi-user access, you should take steps to appropropriately limit access to your data files and service management.如果您的环境允许远程和/或多用户访问,您应该采取措施适当地限制对您的数据文件和服务管理的访问。

If you want to secure data files from direct access, it sounds like you may be looking for Encryption at Rest or Disk Encryption .如果您想保护数据文件免于直接访问,听起来您可能正在寻找Encryption at RestDisk Encryption These security measures prevent direct read access to your data files or filesystem without appropriate credentials, but you still have to limit access appropriately and protect those credentials.这些安全措施可防止在没有适当凭据的情况下直接读取您的数据文件或文件系统,但您仍然必须适当限制访问并保护这些凭据。

For general measures see the MongoDB Security Checklist .有关一般措施,请参阅 MongoDB 安全检查表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM