使用LDAP进行身份验证 (AEN 4.1.3)#
Anaconda Enterprise Notebooks 默认情况下对 AEN 数据库中的账户执行本地认证。
要配置AEN以对LDAP(轻量级目录访问协议)服务器中的帐户进行身份验证,请按照以下说明操作。
安装OpenLDAP库¶
系统需要安装OpenLDAP库,并且AEN需要能够访问这些库。 AEN使用OpenLDAP库来建立与您的LDAP服务器的LDAP连接。
在CentOS或Redhat上安装OpenLDAP:
sudo yum install openldap
要在Ubuntu或Debian上安装OpenLDAP,请遵循官方的 OpenLDAP安装说明。
配置OpenLDAP¶
打开
/opt/wakari/wakari-server/etc/wakari/wk-server-config.json
文件。添加以下LDAP设置:
{ "accounts":"wk_server.plugins.accounts.ldap2", "LDAP" : { "URI": "ldap://openldap.EXAMPLE.COM", "BIND_DN": "cn=Bob Jones,ou=Users,DC=EXAMPLE,DC=COM", "BIND_AUTH": "secretpass", "USER_SEARCH": {"base": "DC=EXAMPLE,DC=COM", "filter": "(| (& (ou=Payroll) (uid=%(username)s)) (& (ou=Facilities) (uid=%(username)s)))" }, "KEY_MAP": {"email": "mail", "name": "cn" } } }
URI—您的OpenLDAP服务器的IP地址或主机名。对于SSL/TLS,请使用
ldaps://
前缀,并按照下面的SSL/TLS配置部分指定TLS_CACERT。BIND_DN—您希望AEN服务器绑定的用户的完整目录路径。
BIND_AUTH—BIND_DN用户的密码。
用户搜索:
- base—The level at which you want to start the search.
- filter—The default is to search for the sAMAccountName attribute, and use its value for the AEN server username field.
KEY_MAP—将AEN服务器中的用户属性映射到LDAP用户属性。
示例:LDAP中的
mail
属性映射到AEN服务器中的email
属性。
一旦安装了LDAP,LDAP认证就会接管,因此你需要再次添加你的管理员账户:
/opt/wakari/wakari-server/bin/wk-server-admin superuser --add "jsmith"
配置Active Directory¶
Microsoft Active Directory 是一个提供目录服务并使用开放行业标准轻量级目录访问协议(LDAP)的服务器程序。
要启用Active Directory支持:
打开
/opt/wakari/wakari-server/etc/wakari/wk-server-config.json
文件。添加以下LDAP设置:
{ "accounts":"wk_server.plugins.accounts.ldap2", "LDAP" : { "URI": "ldap://<ad.EXAMPLE.COM>", "BIND_DN": "CN=Bind User,CN=Users,DC=EXAMPLE,DC=COM", "BIND_AUTH": "secretpass", "USER_SEARCH": {"base": "CN=Users,DC=EXAMPLE,DC=COM", "filter": "sAMAccountName=%(username)s" }, "KEY_MAP": {"email": "mail", "name": "cn" } } }
URI—您的Active Directory服务器的IP地址或主机名。将
替换为实际的URI。对于SSL/TLS,请使用ldaps://
前缀,并按照下面的SSL/TLS配置部分指定TLS_CACERT。BIND_DN—您希望AEN服务器绑定的用户的完整目录路径。
BIND_AUTH—BIND_DN用户的密码。
用户搜索:
- base—the level at which you want to start the search.
- filter—default is to search for the sAMAccountName attribute, and use its value for the AEN server
username
field.
KEY_MAP—将AEN服务器中的用户属性映射到LDAP用户属性。
示例:LDAP中的
mail
属性映射到AEN服务器中的email
属性。
一旦安装了LDAP,LDAP认证就会接管,因此你需要再次添加你的管理员账户:
/opt/wakari/wakari-server/bin/wk-server-admin superuser --add "jsmith"
配置SSL/TLS¶
AEN 使用系统范围的 LDAP 设置,包括 SSL/TLS 支持。
- On Redhat/CentOS systems, these settings are located in the
/etc/openldap/ldap.conf
file. - On Ubuntu/Debian systems, these settings are located in the
/etc/ldap/ldap.conf
file.
通常,唯一需要的配置是更新要读取的文件:
TLS_CACERT /path/to/CA.cert
注意:CA.cert
是用于签署LDAP服务器SSL证书的证书颁发机构。在自签名SSL证书的情况下,这是SSL证书本身的路径。
测试LDAP配置¶
使用 flask-ldap-login-check
测试您的 LDAP 配置:
/opt/wakari/wakari-server/bin/flask-ldap-login-check \
wk_server.wsgi:app \
-u [username] \
-p [password]
注意:username
是有效用户的用户名,
password
是该用户的 BIND_AUTH 密码。