0

I'm trying to configure Percona with LDAP support via PAM including group mappings and restriction. My Percona authentication setup is as follows:

INSTALL PLUGIN pam SONAME 'auth_pam.so';

create user 'dba'@'%' IDENTIFIED WITH auth_pam AS 'mysql';
grant all privileges on *.* to 'dba'@'%' with grant option;

create user 'dbr'@'%' IDENTIFIED WITH auth_pam AS 'mysql';
grant select on *.* to 'dbr'@'%';

CREATE USER ''@'' IDENTIFIED WITH auth_pam AS 'mysql, sudo=dba, mysql=dbr';
GRANT PROXY ON 'dba'@'%' TO ''@'';
GRANT PROXY ON 'dbr'@'%' TO ''@'';

And in /etc/pam.d/mysql I have:

auth required pam_warn.so
auth required pam_ldap.so
account required pam_ldap.so
account required pam_succeed_if.so user ingroup mysql

With these in place, the following works:

  • Log in as an LDAP user in sudo (and mysql), gain privileges of dba.
  • Log in as an LDAP user in mysql, gain privileges of dbr.
  • Attempt login with invalid username and/or password, get no access.

And the following behaviors are incorrect (should be refused login entirely):

  • Log in as an LDAP user in sudo (but not mysql), still gain privileges of dba.
  • Log in as an LDAP user in neither group, gain access with no privileges.

It took quite a while to eventually figure out that the configuration in /etc/pam.d/mysql is having no effect. The behavior is the same even when that file is not present.

My understanding is that the first value in the string mysql, sudo=dba, mysql=dbr tells Percona to use the PAM configuration in a file named mysql, and all tutorials show the filename resolving to /etc/pam.d/mysql.

What am I missing?

HonoredMule
  • 187
  • 11
  • Perhaps this question should be moved over to http://dba.stackexchange.com? However, the mysql/percona-related portion of this setup seems pretty straightforward and I suspect the problem is rooted in PAM itself, not the application. – HonoredMule Dec 08 '16 at 22:05

1 Answers1

0

The issue turned out to be file permissions. When /etc/pam.d/mysql was changed from 0640 to 0644 (o+r), the PAM configuration started affecting login as expected.

HonoredMule
  • 187
  • 11