LDAP 认证
除了原生的基于密码的认证,StarRocks 还支持 LDAP 认证。
本主题描述了如何在 StarRocks 中使用 LDAP 手动创建和认证用户。有关如何使用安全集成将 StarRocks 与您的 LDAP 服务集成的说明,请参见Authenticate with Security Integration。有关如何在 LDAP 服务中认证用户组的更多信息,请参见Authenticate User Groups。
启用 LDAP 认证
要使用 LDAP 认证,您需要首先将 LDAP 服务添加到 FE 节点配置中。
# 添加 LDAP 服务的 IP 地址。
authentication_ldap_simple_server_host =
# 添加 LDAP 服务的端口,默认值为 389。
authentication_ldap_simple_server_port =
# 是否允许使用非加密方式连接到 LDAP 服务器。默认值:`true`。将此值设置为 `false` 表示访问 LDAP 需要使用 SSL 加密。
authentication_ldap_simple_ssl_conn_allow_insecure =
# 存储 LDAP 服务器的 SSL CA 证书的本地路径。支持 pem 和 jks 格式。如果证书是由受信机构颁发的,则无需配置。
authentication_ldap_simple_ssl_conn_trust_store_path =
# 访问本地存储的 LDAP 服务器的 SSL CA 证书所用的密码。pem 格式证书不需要密码,只有 jsk 格式证书需要。
authentication_ldap_simple_ssl_conn_trust_store_pwd =
如果希望通过 StarRocks 直接在 LDAP 系统中检索用户进行认证,您需要添加以下额外的配置项。
# 添加用户的 Base DN,指定用户的检索范围。
authentication_ldap_simple_bind_base_dn =
# 添加在 LDAP 对象中标识用户的属性名称。默认:uid。
authentication_ldap_simple_user_search_attr =
# 添加用于检索用户的 Admin DN。
authentication_ldap_simple_bind_root_dn =
# 添加用于检索用户的 Admin 密码。
authentication_ldap_simple_bind_root_pwd =
DN 匹配机制
自 v3.5.0 起,StarRocks 支持在 LDAP 认证过程中记录和传递用户的 Distinguished Name (DN) 信息,以提供更准确的组解析功能。
工作原理
-
认证阶段:LDAPAuthProvider 在用户认证成功后会同时记录:
- 登录用户名(用于传统组匹配)
- 用户的完整 DN(用于基于 DN 的组匹配)
-
组解析阶段:LDAPGroupProvider 根据
ldap_user_search_attr参数的配置决定匹配策略: