[MXS-3964] Provide PAM authentication For Maxscale GUI Login Created: 2022-01-27  Updated: 2022-04-18  Resolved: 2022-01-31

Status: Closed
Project: MariaDB MaxScale
Component/s: N/A
Affects Version/s: None
Fix Version/s: N/A

Type: New Feature Priority: Major
Reporter: Naresh Chandra Assignee: Todd Stoffel (Inactive)
Resolution: Incomplete Votes: 0
Labels: None

Attachments: PNG File screenshot-1.png    

 Description   

Provide PAM authentication(AD Integration) for Maxscale GUI Login, so that it will be easy to manage the users in the Maxscale.



 Comments   
Comment by markus makela [ 2022-01-27 ]

Would the PAM options that currently exist be able to solve this problem?

Comment by Naresh Chandra [ 2022-01-27 ]

Hi Markus,

We are expecting the logins for the below screenshot.

Comment by markus makela [ 2022-01-28 ]

The PAM authentication should work with the GUI users as well, they use the same REST API mechanism. Have you tried it out already or do you know of any problems with it?

Comment by Naresh Chandra [ 2022-01-28 ]

Hi Markus,

For DB we have done it but GUI users not done yet. Can you please give us some steps so that I will try for GUI login as well.

Comment by markus makela [ 2022-01-28 ]

I think all you need to do is to put the PAM service you want to use in admin_pam_readwrite_service and then configure PAM authentication on the system like you'd normally do. Note that the current implementation only supports PAM modules that exchange a single password.

Comment by Naresh Chandra [ 2022-01-28 ]

Thank you Markus, let me check and update you once its done.

Comment by Naresh Chandra [ 2022-01-28 ]

Hi Markus,

I tried what you suggested but no luck, I am unable to login to the Maxscale GUI.

[maxscale]
threads = 4
admin_host = test1234
admin_port = 8989
auth_read_timeout = 10000s
auth_connect_timeout = 10000s
admin_secure_gui = false
log_info=1
syslog=1
log_debug=1
admin_pam_readwrite_service = 1

I have added the admin_pam_readwrite_service in the maxscale.cnf file and I have done the below steps.

1. yum install gcc pam-devel
2. wget https://raw.githubusercontent.com/MariaDB/server/10.4/plugin/auth_pam/mapper/pam_user_map.c
3. gcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so
4. sudo install --mode=0755 pam_user_map.so /lib64/security/
5. cat /etc/pam.d/maxscale
auth required pam_winbind.so
auth required pam_user_map.so debug
account required pam_permit.so
6. /etc/security/user_map.conf

Can you please help on this, anything I have missed here?

Comment by markus makela [ 2022-01-28 ]

You'll need to use a PAM service from /etc/pam.d/ as the argument for admin_pam_readwrite_service. I'm assuming the 1 is not a valid PAM service name.

For example, here's what I put into /etc/pam.d/maxscale:

auth            required        pam_unix.so
account         required        pam_unix.so

It uses the local UNIX account as the authentication method. Then I added admin_pam_readwrite_service=maxscale under the [maxscale] section and created a UNIX user called maxscale-admin and set the password to good-password. After this I was able to log in to the GUI with the credentials. Since this was done using pam_unix, the user running MaxScale must be able to read /etc/shadow to be able to authenticate the user logging in (I ran MaxScale as root).

As for other PAM services and their configuration, this isn't really something that can be explained in Jira comments.

Comment by Naresh Chandra [ 2022-01-29 ]

Hi Markus,

I am getting the below errors.

warning: PAM authentication of user 'aduser' to service 'maxscale' failed: 'Authentication failure'.
warning: Authentication failed for 'aduser', using password. Request: GET /auth

Can we have steps for this how to configure with AD user?

Comment by markus makela [ 2022-01-31 ]

Unfortunately that is not something I can help you with.

Comment by markus makela [ 2022-01-31 ]

I'll close this issue since the PAM authentication itself works with the GUI. If you'd like some improvements to be made to it to make AD work, please submit a feature request with those specific details included in it.

Comment by Naresh Chandra [ 2022-02-02 ]

Hi Markus,

Issue is resolved as I gave wrong user group in the /etc/security/user_map.conf file, now its working fine after changing the proper user group.

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