【问题标题】:MariaDB LDAP PAM AuthenticationMariaDB LDAP PAM 身份验证
【发布时间】:2021-03-24 07:41:46
【问题描述】:

我的本​​地测试环境中有一个 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)

非常感谢。

【问题讨论】:

    标签: ldap mariadb pam


    【解决方案1】:

    我发现在 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多