【问题标题】:MySQL 5.7 (RHEL6.6) PAM Authentication with ADMySQL 5.7 (RHEL6.6) 带有 AD 的 PAM 身份验证
【发布时间】:2016-07-18 12:53:22
【问题描述】:

我正在使用 Pluggable Authentication Modules (PAM) 在 MySQL(安装在 RHEL 6.6 上)上配置 AD 身份验证。

到目前为止,我的 AD 用户能够使用 AD 凭据登录 RHEL 框。但是当我尝试使用 PAM 插件登录 MySQL 时,我收到了 Access Denied 错误。 MySQL的PAM配置如下:

/etc/pam.d/mysql:
auth   required    pam_winbind.so
account required    pam_winbind.so

当我检查 MySQL 错误日志时,我看到方法 authenticate_pam() 中抛出了系统错误。以下是 mysqld 日志:

entering auth_pam_server 
entering auth_pam_next_token 
auth_pam_next_token:reading at [mysql, MySQLUsers=mysql_ad], sep=[,] 
auth_pam_next_token:state=PRESPACE, ptr=[mysql, MySQLUsers=mysql_ad], out=[] 
auth_pam_next_token:state=IDENT, ptr=[mysql, MySQLUsers=mysql_ad], out=[] 
auth_pam_next_token:state=AFTERSPACE, ptr=[, MySQLUsers=mysql_ad], out=[mysql] 
auth_pam_next_token:state=DELIMITER, ptr=[, MySQLUsers=mysql_ad], out=[mysql] 
auth_pam_next_token:state=DONE, ptr=[, MySQLUsers=mysql_ad], out=[mysql] 
leaving auth_pam_next_token on /export/home/pb2/build/sb_0-19016729-1464156482.79/rpm/BUILD/mysqlcom-pro-5.7.13/mysqlcom-pro-5.7.13/plugin/pam-authentication-plugin/src/parser.c:195 
auth_pam_server:password ******** received 
auth_pam_server:pam_start rc=0 
auth_pam_server:pam_set_item(PAM_RUSER,administrator) rc=0 
auth_pam_server:pam_set_item(PAM_RHOST,localhost) rc=0 
entering auth_pam_server_conv 
auth_pam_server_conv:PAM_PROMPT_ECHO_OFF [Password: ] received 
leaving auth_pam_server_conv on /export/home/pb2/build/sb_0-19016729-1464156482.79/rpm/BUILD/mysqlcom-pro-5.7.13/mysqlcom-pro-5.7.13/plugin/pam-authentication-plugin/src/authentication_pam.c:269 
**auth_pam_server:pam_authenticate rc=4 
auth_pam_server: rc=4 
PAM error: System error** 
leaving auth_pam_server on /export/home/pb2/build/sb_0-19016729-1464156482.79/rpm/BUILD/mysqlcom-pro-5.7.13/mysqlcom-pro-5.7.13/plugin/pam-authentication-plugin/src/authentication_pam.c:441 
2016-07-18T12:48:22.360536Z 122 [Note] Access denied for user 'administrator'@'localhost' (using password: YES) 

根据上述 PAM 配置,PAM 使用 winbind 在 AD 中查找用户凭据并进行身份验证,这与将 AD 用户身份验证到 Linux 框的过程相同。当我看到 winbind 日志时,我看到以下内容:

[2016/07/18 08:27:24.236701,  5] winbindd/winbindd_pam.c:1868(winbindd_dual_pam_auth)
  Plain-text authentication for user CORPAD\administrator returned NT_STATUS_OK (PAM: 0)

这告诉我,从 winbind 的身份验证工作正常,但是当 winbind 将控制权返回给 PAM 时,出现故障并引发系统错误。

【问题讨论】:

    标签: mysql authentication active-directory pam rhel6


    【解决方案1】:

    好吧,我想通了。

    首先,我在这篇文章之后启用了 PAM 上的调试日志 - https://serverfault.com/questions/249671/switch-on-pam-debugging-to-syslog

    当我这样做时,我发现每次我尝试进行身份验证时都会收到以下错误: PAM audit_open() 失败:权限被拒绝

    造成这种情况的根本原因是 SELinux 正在强制执行。所以我禁用了 SELinux 并重新启动了系统,从而解决了这个问题。我现在可以使用我的 AD 凭据登录 Linux,然后使用 mysql 命令和对 mysql 进行身份验证!

    【讨论】:

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