[MDEV-19881] pam plugin from MariaDB 10.3 doesn't work with MariaDB 10.4 Created: 2019-06-27  Updated: 2022-08-04

Status: Open
Project: MariaDB Server
Component/s: Plugin - pam
Affects Version/s: 10.4.6
Fix Version/s: 10.3

Type: Bug Priority: Minor
Reporter: Geoff Montee (Inactive) Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 2
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-7032 new pam plugin with a suid wrapper Closed
is caused by MDEV-15473 Isolate/sandbox PAM modules, so that ... Closed
Relates
relates to MDEV-19876 pam v2: auth_pam_tool_dir and auth_pa... Closed
relates to MDEV-19877 pam v2: auth_pam_tool input format is... Open
relates to MDEV-19878 pam v2: pam password authentication d... Closed
relates to MDEV-19879 server can send empty error message t... Closed
relates to MDEV-19880 pam v1: pam password authentication d... Closed
relates to MDEV-19882 pam v2: auth_pam_tool truncates passw... Closed
relates to MDEV-19898 PAM plugin testing Stalled

 Description   

As a way to work around the numerous pam bugs in MariaDB 10.4.6, I tried to copy the pam plugins from MariaDB 10.3.16. This does not work, and it fails instantly without even asking for a password.

For example, copy the plugin from the 10,3 to the 10.4 server:

scp  /usr/lib64/mysql/plugin/auth_pam.so 172.30.0.123:/tmp/

Then move the existing one on the 10.4 server:

sudo mv /usr/lib64/mysql/plugin/auth_pam.so /usr/lib64/mysql/plugin/auth_pam.so.original

And then install the one from 10.3:

sudo install /tmp/auth_pam.so /usr/lib64/mysql/plugin/

Create a Unix user account and set a password for the user:

sudo useradd alice
sudo passwd alice

Create the PAM service configuration:

sudo tee /etc/pam.d/mariadb <<EOF
auth required pam_unix.so audit
account required pam_unix.so audit
EOF

Then in MariaDB, install the plugin:

INSTALL SONAME 'auth_pam';

And then create the user account:

CREATE USER 'alice'@'localhost' IDENTIFIED VIA pam USING 'mariadb';

And then you need to do the /etc/shadow workaround for pam_unix:

sudo groupadd shadow
sudo usermod -a -G shadow mysql
sudo chown root:shadow /etc/shadow
sudo chmod g+r /etc/shadow

And then restart MariaDB:

sudo systemctl restart mariadb

And then, try to authenticate as the Unix account (while using the workaround for MDEV-19807):

$ mysql -u alice --plugin-dir=/usr/lib64/mysql/plugin
ERROR 1045 (28000): Access denied for user 'alice'@'localhost' (using password: NO)

Unlike in MDEV-19880, the syslog doesn't even show a failed password check.



 Comments   
Comment by Sergei Golubchik [ 2019-06-30 ]

This is a bug in the 10.3 pam plugin that just didn't show up earlier

Generated at Thu Feb 08 08:55:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.