2016-07-18 46 views
0

我正在使用可插入驗證模塊(PAM)在MySQL上安裝AD驗證(安裝在RHEL 6.6上)。MySQL 5.7(RHEL6.6)使用AD的PAM驗證

到目前爲止,我的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,什麼是失敗,系統錯誤被拋出。

回答

0

嗯,我明白了。

首先,我在PAM後啓用了調試日誌 - https://serverfault.com/questions/249671/switch-on-pam-debugging-to-syslog

當我這樣做,我發現,每次我試圖驗證我收到以下錯誤: PAM audit_open()失敗:權限被拒絕

這一現象的根本原因是SELinux的被強制執行。所以我禁用了SELinux並重新啓動了系統,這解決了這個問題。我現在可以使用我的AD憑據登錄到Linux,然後使用mysql命令並對mysql進行身份驗證!