0

我们在 Linux 服务器上部署了连接 MongoDb 的 c# Web 应用程序。这个想法是为我们的 Web 应用程序使用单个指定的 Linux 帐户来登录并连接到 MongoDb。据我了解,默认情况下,MongoDb 根本不支持集成安全性,它应该有自己的带密码的用户数据库,也没有角色,对吧?如果是这样,我想知道是否有任何单独的第三方框架/工具或可以帮助我使用所需方法的东西?

除此之外,如果您知道关于在 Web 应用程序中实现 Mongo 安全性的最佳实践的优秀在线文章,例如在哪里以及如何存储用户和加密密码等,请给我一个链接。

4

1 回答 1

2
  • 请给我一个链接。

几个月前我为 MongoDB 做了一些安全文档,可以在这里找到,这应该是你的起点。

  • 据我了解,默认情况下,MongoDb 根本不支持集成安全性,它应该有自己的带密码的用户数据库,也没有角色,对吧?

在 MongoDB 2.2 之前,身份验证和授权都是本地的。在 2.2 中,RBAC(基于角色的访问)是有限的,即“读”和“写”两个角色,“写”能够在该数据库上执行所有操作,即行政。

在 2.4 中,新角色将发生变化:

name            description of privilege

read            ability to query data in any collection in the database, other than 'system.users', and also ability to run any command without an A or W attribute

readWrite       everything permitted by 'read' privilege, and also the ability to insert, update,
or remove documents or indexes in any collection other than 'system.users', and also the ability to run any command without an A attribute

userAdmin       ability to read and write the 'system.users' collection

dbAdmin         ability to run admin commands affecting a single database; see list below

serverAdmin     ability to run admin commands affecting the entire database server; Can only be set on admin database; see discussion

clusterAdmin    admin commands for a cluster of shards or a replica set; Can only be set on admin database

如此处所述。这个增强的 RBAC 将在 2.3.2(开发版本)和下一个生产版本 2.4.0 的所有 MongoDB 版本中可用。

With MongoDB 2.4, there will also be the ability to use Kerberos for authentication, however, this delegated authentication will only be available in the Enterprise builds, which require a Commercial Support contract for us.

There is currently nothing within MongoDB that enforces password complexity but obviously in 2.4 with Kerberos, the KDC can do this. You will manually have to ensure (through your internal password policy etc) that users realise the issues of using non-complex passwords and re-using the same passwords on multiple devices. Assuming you are running 2.2, all logins, passwords and permissions for MongoDB access are stored in the system.users collection under each database. Here is the exact link to the documentation that you should read.

于 2013-01-10T15:09:12.780 回答