[MDEV-19877] pam v2: auth_pam_tool input format is not user friendly for debugging Created: 2019-06-27 Updated: 2021-08-16 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Plugin - pam |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Sergei Golubchik |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
In MariaDB 10.4, version 2 of the pam plugin is provided. This plugin forks a new process and executes the auth_pam_tool utility that is now bundled with the server. There are probably going to be cases where people need to execute this tool manually as a test. Unfortunately, the input format of this tool is not very user friendly. One method that can be used to construct the tool's input and run the tool for testing purposes is described below. Configuring PAMFirst we can configure PAM. Create a Unix user account and set a password for the user:
Create the PAM service configuration:
And then you might need to execute some commands to work around
Configuring MariaDBWe can configure MariaDB to use PAM authentication for this user account. Let's install the pam plugin:
And let's create the relevant user:
Constructing the InputNext we can construct the input for the auth_pam_tool tool. As far as I can tell, the input format of the data that needs to be passed to stdin is:
So let's say that we have the following values:
So that would make the stdin data:
Let's create input with a null-terminated password:
And let's also create input with a password that is not null-terminated:
And then confirm the contents of each file:
Running the ToolNext, we can run the auth_pam_tool tool and redirect the tool's stdin to the input files that we constructed. We can also attach strace to the process, so we can passwords the tool is reading and writing. First, run the tool with the good input:
The null-terminated password is properly read and passed to PAM:
Next, run the tool with the bad input:
The non-null-terminated password is properly read, but its last character is truncated when it is passed to PAM due to
Checking SyslogThe syslog (i.e. /var/log/secure on RHEL or /var/log/auth.log on Debian/Ubuntu) also shows an authentication failure, since the auth_pam_tool
|
| Comments |
| Comment by Sergei Golubchik [ 2019-06-28 ] | ||
|
Just to note that unix_chkpw also isn't easy to test manually. It reads some binary data from stdin, and also errors out if stdin is a terminal with
and sleep(10), as they say in the sources "to discourage and annoy the user" |