简体   繁体   English

访问cassandra没有硬编码的用户名密码

[英]Accessing cassandra without hardcoded username password

I have an existing Datastax Cassandra setup that is working. 我有一个正在运行的现有Datastax Cassandra设置。 We just added authentication to the system and now we can log in with our AD accounts. 我们刚刚向系统添加了身份验证,现在我们可以使用AD帐户登录。 This is very nice and certainly works. 这非常好,肯定有效。 However applications need to use a hard-coded username/password in order to connect. 但是,应用程序需要使用硬编码的用户名/密码才能进行连接。

In SQL Server we were able to setup a user to run the service as and then it would connect and work through AD. 在SQL Server中,我们能够设置用户运行服务,然后它将连接并通过AD工作。 However in Cassandra it is not the same. 然而在卡桑德拉却不一样。

If I don't want to include usernames and especially passwords in my app.config files what are my options? 如果我不想在我的app.config文件中包含用户名,特别是密码,我有哪些选择?

You can use authentication via LDAP with DSE (Datastax Enterprise), so the authentication stage is done with LDAP instead of the internal authentication in DSE which you're using at the moment. 您可以通过LDAP使用DSE(Datastax Enterprise)进行身份验证,因此身份验证阶段是使用LDAP完成的,而不是您目前使用的DSE中的内部身份验证。 Note that my comments here apply to DSE5.0 onwards but you can use LDAP auth with earlier versions of DSE from 4.6 onwards. 请注意,此处的注释适用于DSE5.0以上版本,但您可以在4.6以后使用早期版本的DSE进行LDAP身份验证。

The documentation (link below) covers this. 文档(下面的链接)涵盖了这一点。 The basic steps are as follows: 基本步骤如下:

  1. Configure your authenticator in the cassandra.yaml to use the DSE authenticator cassandra.yaml配置身份验证器以使用DSE身份验证器

    authenticator: com.datastax.bdp.cassandra.auth.DseAuthenticator

  2. Create an internal role in cassandra to map to the LDAP group(s) in your LDAP server using the CREATE ROLE command 在cassandra中创建内部角色,以使用CREATE ROLE命令映射到LDAP服务器中的LDAP组

  3. Ensure all the users you need to use map to the relevant LDAP group (part of your LDAP config) 确保您需要使用的所有用户映射到相关的LDAP组(LDAP配置的一部分)

  4. Configure your dse.yaml to have the correct settings for your LDAP server 配置dse.yaml以使LDAP服务器具有正确的设置

  5. Restart the DSE process for the settings to take effect 重新启动DSE进程以使设置生效

The following documentation gives some good examples and background information: 以下文档提供了一些很好的示例和背景信息:

https://docs.datastax.com/en/latest-dse/datastax_enterprise/unifiedAuth/unifiedAuthConfig.html https://docs.datastax.com/en/latest-dse/datastax_enterprise/unifiedAuth/unifiedAuthConfig.html

https://docs.datastax.com/en/latest-dse/datastax_enterprise/sec/authLdapConfig.html https://docs.datastax.com/en/latest-dse/datastax_enterprise/sec/authLdapConfig.html

Note: when configuring the dse.yaml note the comment in the docs regarding user_search_filter : 注意:配置dse.yaml请注意有关user_search_filter的文档中的user_search_filter

When using Active Directory set the filter to (sAMAccountName={0}) 使用Active Directory时将过滤器设置为(sAMAccountName={0})

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

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