安全

身份验证

qianmoQqianmoQ· 更新于 2026-09-27· 阅读 11 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

Apache Atlas 中的身份认证

身份认证

Atlas 支持以下身份认证方式

  • File(文件)
  • Kerberos
  • LDAP
  • Keycloak(OpenID Connect / OAUTH2)
  • PAM

若要启用某种类型的身份认证,需在 atlas-application.properties 文件中将对应属性设置为 true。

atlas.authentication.method.kerberos=true|false
atlas.authentication.method.ldap=true|false
atlas.authentication.method.file=true|false
atlas.authentication.method.keycloak=true|false

如果将两个或多个身份验证方法都设置为 true,则当较早的方法失败时,身份验证会回退到后者。例如,如果 Kerberos 身份验证设置为 true,LDAP 身份验证也设置为 true,那么对于没有 Kerberos 主体和 keytab 的请求,将把 LDAP 身份验证作为回退方案使用。

FILE 方法

文件身份验证要求用户的登录凭据存储在用户凭据文件中,格式如下所述,并且需要在 atlas-application.properties 中将文件路径设置为属性 atlas.authentication.method.file.filename。

atlas.authentication.method.file=true
atlas.authentication.method.file.filename=sys:atlas.home/conf/users-credentials.properties

用户凭据文件应遵循以下格式

username=group::sha256-password

例如

admin=ADMIN::e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a

用户组可以是 ADMIN、DATA_STEWARD 或 DATA_SCIENTIST

注意:密码使用 sha256 编码方式加密,可以使用 unix 工具生成。

例如

echo -n "Password" | sha256sum
e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a  -

Kerberos 方式

要在 Atlas 中启用 Kerberos 模式的认证,请在 atlas-application.properties 中将属性 atlas.authentication.method.kerberos 设置为 true

atlas.authentication.method.kerberos = true

此外,还应设置以下属性。

atlas.authentication.method.kerberos.principal=<principal>/<fqdn>@EXAMPLE.COM
atlas.authentication.method.kerberos.keytab = /<key tab filepath>.keytab
atlas.authentication.method.kerberos.name.rules = RULE:[2:$1@$0](atlas@EXAMPLE.COM)s/.*/atlas/
atlas.authentication.method.kerberos.token.validity = 3600 [ in Seconds (optional)]

LDAP 方式

要在 Atlas 中启用 LDAP 模式认证,请在 atlas-application.properties 中将属性 atlas.authentication.method.ldap 设置为 true,并将 LDAP 类型属性 atlas.authentication.method.ldap.type 设置为 LDAP 或 AD。如果连接的是 Active Directory,请使用 AD。

atlas.authentication.method.ldap=true
atlas.authentication.method.ldap.type=ldap|ad

对于 LDAP 或 AD,需要在 Atlas 应用属性中设置以下配置。

Active Directory(活动目录)

atlas.authentication.method.ldap.ad.domain= example.com
atlas.authentication.method.ldap.ad.url=ldap://<AD server ip>:389
atlas.authentication.method.ldap.ad.base.dn=DC=example,DC=com
atlas.authentication.method.ldap.ad.bind.dn=CN=Administrator,CN=Users,DC=example,DC=com
atlas.authentication.method.ldap.ad.bind.password=<password>
atlas.authentication.method.ldap.ad.referral=ignore
atlas.authentication.method.ldap.ad.user.searchfilter=(sAMAccountName={0})
atlas.authentication.method.ldap.ad.default.role=ROLE_USER

LDAP 目录

atlas.authentication.method.ldap.url=ldap://<Ldap server ip>:389
atlas.authentication.method.ldap.userDNpattern=uid={0},ou=users,dc=example,dc=com
atlas.authentication.method.ldap.groupSearchBase=dc=example,dc=com
atlas.authentication.method.ldap.groupSearchFilter=(member=cn={0},ou=users,dc=example,dc=com
atlas.authentication.method.ldap.groupRoleAttribute=cn
atlas.authentication.method.ldap.base.dn=dc=example,dc=com
atlas.authentication.method.ldap.bind.dn=cn=Manager,dc=example,dc=com
atlas.authentication.method.ldap.bind.password=<password>
atlas.authentication.method.ldap.referral=ignore
atlas.authentication.method.ldap.user.searchfilter=(uid={0})
atlas.authentication.method.ldap.default.role=ROLE_USER

Keycloak 方式。

要在 Atlas 中启用 Keycloak 认证模式,请在 atlas-application.properties 中将属性 atlas.authentication.method.keycloak 设置为 true,并将属性 atlas.authentication.method.keycloak.file 设置为 keycloak.json 文件的位置。如果你希望从 Keycloak 中获取组信息,还需将 atlas.authentication.method.keycloak.ugi-groups 设置为 false。默认情况下,组信息将从 Keycloak 中定义的 角色 中获取。如果要使用组信息,则需要在 Keycloak 中创建一个映射,并将 atlas.authentication.method.keycloak.groups_claim 设置为令牌 claim 的名称。请确保不要使用完整的组路径,并将该信息添加到访问令牌中。

atlas.authentication.method.keycloak=true
atlas.authentication.method.keycloak.file=/opt/atlas/conf/keycloak.json
atlas.authentication.method.keycloak.ugi-groups=false

按照 Keycloak 的说明配置你的 keycloak.json。确保包含 "principal-attribute": "preferred_username" 以保证用户名可读,并设置 "autodetect-bearer-only": true。

{
  "realm": "auth",
  "auth-server-url": "http://keycloak-server/auth",
  "ssl-required": "external",
  "resource": "atlas",
  "public-client": true,
  "confidential-port": 0,
  "principal-attribute": "preferred_username",
  "autodetect-bearer-only": true
}

PAM

启用 PAM 认证的前提是 /etc/pam.d/ 中存在登录服务文件。

要在 Atlas 中启用 PAM 认证模式:

  • 在 atlas-application.properties 中将 Atlas 属性 atlas.authentication.method.pam 设置为 true。
atlas.authentication.method.pam=true
  • 设置属性 atlas.authentication.method.pam.service=<登录服务> 以使用所需的 PAM 登录服务。例如,设置以下属性以使用 /etc/pam.d/login。
atlas.authentication.method.pam.service=login

评论

登录后参与评论

正在加载评论…