Questo è sicuramente possibile. Vedi qui: https://www.percona.com/blog/2017/04/21/how-to-setup-and-troubleshoot-percona-pam-with-ldap-for-external-authentication/
Nel mio ambiente, non ho configurato Samba o NSS/SSS e non mi sono unito al dominio di Windows. Tratto semplicemente il server AD come endpoint LDAP. Quindi ho iniziato dal passaggio 9 nelle direzioni sopra.
EDIT: aggiungere istruzioni dall'alto collegamento come suggerito da AfroThundr
Installare il plugin Percona PAM:
mysql> INSTALL PLUGIN auth_pam SONAME 'auth_pam.so';
Query OK, 0 rows affected (0.01 sec)
mysql> INSTALL PLUGIN auth_pam_compat SONAME 'auth_pam_compat.so';
Query OK, 0 rows affected (0.00 sec)
Configura Percona PAM per l'autenticazione LDAP con la creazione di /etc/pam.d/ mysqld con questo contenuto:
auth required pam_ldap.so
account required pam_ldap.so
Creare un utente MySQL che l'autenticazione tramite auth_pam:
mysql> CREATE USER [email protected]'%' IDENTIFIED WITH auth_pam;
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON testdb.* TO [email protected]'%';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
login come questo utente e controllare sovvenzioni:
[[email protected] ~]# mysql -u user
Password: <your LDAP/AD password>
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 22
Server version: 5.7.17-13 Percona Server (GPL), Release 13, Revision fd33d43
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> SHOW GRANTS;
+-----------------------------------------------------+
| Grants for [email protected]% |
+-----------------------------------------------------+
| GRANT USAGE ON *.* TO 'user'@'%' |
| GRANT ALL PRIVILEGES ON `testdb`.* TO 'user'@'%' |
+---------------------------------------------------
attenzione anche di AppArmor - bloccherà il tentativo di autenticazione.Si può visualizzare messaggi di errore fuorvianti in /var/log/auth.log
:
Feb 12 13:37:36 mysqld[15164]: PAM _pam_init_handlers: no default config /etc/pam.d/other
Feb 12 13:37:36 mysqld[15164]: PAM error reading PAM configuration file
Feb 12 13:37:36 mysqld[15164]: PAM pam_start: failed to initialize handlers
è necessario aggiungere quanto segue a /etc/apparmor.d/local/usr.sbin.mysqld
:
#include <abstractions/authentication>
e ricaricare AppArmor:
service apparmor restart
(Grazie a https://bugs.launchpad.net/ubuntu/+source/squid/+bug/1608984 per avermi condotto alla parte AppArmor)
Sei alla ricerca di una soluzione rigorosamente MySQL o puoi affrontare questo problema dal lato dell'applicazione (come nel programma l'uscita dal problema) – Hugoware
Preferisco non programmare la mia uscita a meno che non sia necessario. Preferirei che l'autenticazione fosse gestita in modo nativo. Ho pensato semplicemente a "autenticare" tramite l'app in LDAP e creare utenti nel DB degli utenti MySQL e collegarli ... ma ciò richiede che l'app abbia grandi credenziali con il server MySQL. – snicker
Il proxy MySQL (come menzionato da qualcuno sotto) sarebbe la mia prima scelta –