【问题标题】:Is there any way to use Linux integrated security for MongoDb?有没有办法为 MongoDb 使用 Linux 集成安全性?
【发布时间】:2013-01-09 16:23:58
【问题描述】:

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

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

【问题讨论】:

    标签: security mongodb


    【解决方案1】:
    • 请给我一个链接。

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

    • 据我了解,默认情况下,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
    

    如文档所述here。从 2.3.2(开发版本)和下一个生产版本 2.4.0 开始,所有版本的 MongoDB 都将提供这种增强的 RBAC。

    在 MongoDB 2.4 中,还可以使用 Kerberos 进行身份验证,但是,这种委托身份验证仅在企业版本中可用,这需要我们签订商业支持合同。

    目前 MongoDB 中没有任何东西强制密码复杂性,但显然在 2.4 中使用 Kerberos,KDC 可以做到这一点。您必须手动确保(通过您的内部密码策略等)用户意识到使用非复杂密码和在多个设备上重复使用相同密码的问题。假设你运行的是 2.2,所有用于 MongoDB 访问的登录名、密码和权限都存储在每个数据库下的 system.users 集合中。 Here 是您应该阅读的文档的确切链接。

    【讨论】:

    • Mongo 2.4 版本是否计划在 2013 年 1 月 31 日发布?那是我可以开始使用所有这些新功能的时候,对吧?谢谢
    • @YMC:确切的 2.4 发布日期取决于最终测试和 QA 接受情况,但您可以通过MongoDB Jira SERVER roadmap 跟踪进度并在mongodb-announce google group 中发布公告。 2.3.2 开发版/不稳定版应该很快就会进行测试,或者如果您真的热衷于预览/测试新的安全功能,您可以下载nightly build
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-19
    • 2012-02-08
    • 2020-11-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多