Atlas 2.1.0 實踐(4)—— 權限控制


Atlas的權限控制非常的豐富,本文將進行其支持的各種權限控制的介紹。

在atlas-application.properties配置文件中,可以設置不同權限的開關。

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

如果設置了多個權限,就相當於有一個備用方案。比如同時設置了Kerberos 和 ldap 。Kerberos 失效的情況下,就會走ldap的權限。

1、File

文件控制權限是Atlas最基本的,也是默認的權限控制方式。

需要指定文件權限配置路徑

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

users-credentials.properties的格式如下:

username=group::sha256-password

例如

admin=ADMIN::e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a

注意:-密碼使用sha256編碼方法進行編碼,可以使用unix工具生成。

例如

echo -n "Password" | sha256sum
e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a  -

2、Kerberos

啟動kerberos

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)]

3、LDAP

啟動ldap

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

對於LDAP或AD,需要在Atlas應用程序屬性中設置以下配置。

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

4、Keycloak

開啟keycloak

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

keycloak.json文件配置如下

{
  "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
}

5、PAM

開啟PAM

atlas.authentication.method.pam=true
atlas.authentication.method.pam.service=login


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM