ldap - MariaDB LDAP PAM 身份验证
问题描述
我的本地测试环境中有一个 Active Directory 和一个 MariaDB 服务器。现在我想让在 MariaDB 下使用 AD 用户登录成为可能。
我已经看过一些教程,这里几乎所有关于它的主题。
我的 /etc/nslc.conf:
uid nslcd
gid nslcd
uri ldap://172.29.210.219/
base dc=saptest,dc=local
ldap_version 3
binddn CN=bind,CN=Users,DC=SAPTEST,DC=LOCAL
bindpw supersecurepassword
ssl off
filter passwd (objectClass=user)
map passwd uid sAMAccountName
我的 /etc/pam.d/mariadb
auth sufficient pam_ldap.so
account sufficient pam_ldap.so
我在 MariaDB 中的步骤
INSTALL SONAME 'auth_pam';
CREATE USER 'admin'@'%' IDENTIFIED VIA pam USING 'mariadb';
GRANT ALL ON *.* TO 'admin'@'%';
FLUSH PRIVILEGES;
EXIT;
当我执行“mysql -u admin -p”时,出现以下错误:
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: NO)
提前谢谢了。
解决方案
我发现在 SLES15SP3 上的 MariaDB 实例 10.5.12 上,pam.d 中的配置文件必须称为“mysql”,并且用户创建语句末尾的“USING”选项不起作用。
https://jira.mariadb.org/browse/MDEV-26876
CREATE USER 'admin'@'%' IDENTIFIED VIA pam;
/etc/pam.d/mysql
auth required pam_ldap.so
auth required pam_warn.so
account required pam_ldap.so
account required pam_warn.so
pam_warn 会将日志消息吐出到 syslog(在我的情况下为 Journal) https://www.docs4dev.com/docs/en/linux-pam/1.1.2/reference/sag-pam_warn.html
ldap 配置必须在 /etc/ldap.conf 中:
base dc=[redacted]
binddn cn=[redacted]
bindpw [redacted]
uri ldap://[redacted]:389
pam_login_attribute sAMAccountName
pam_filter objectclass=User
推荐阅读
- jquery - JSON Stringify 拆分每个结果
- mongodb - 如何直接更新mongodb并将数据发送到前端
- java - 变量可能尚未在二维数组中初始化
- dialogflow-es - 自定义 Google 琐事或个性测验
- javascript - 如何创建动态 HTML 标头
- angular - cors:从角度发送请求到springboot
- node.js - TypeDI @Inject() 不起作用,但 Container.get() 可以
- json - 解析 JSON 文件时获取行号
- reactjs - 在客户端进行排序和过滤。应该如何处理?
- ruby-on-rails - 发送带有所有子对象或子对象的外键对象