configure saslauthd with PAM
I'm trying to configure saslauthd with PAM. I created a user test
with password test
using useradd
and passwd
and I checked that I can login with su - test
.
[arch@vps-5220ce87 ~]$ systemctl status saslauthd
● saslauthd.service - Cyrus SASL authentication daemon
Loaded: loaded (/usr/lib/systemd/system/saslauthd.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-12-19 21:57:28 UTC; 43min ago
Process: 932358 ExecStart=/usr/sbin/saslauthd $SASLAUTHD_OPTS (code=exited, status=0/SUCCESS)
Main PID: 932360 (saslauthd)
Tasks: 5 (limit: 4585)
Memory: 1.8M
CGroup: /system.slice/saslauthd.service
├─932360 /usr/sbin/saslauthd -a pam
├─932361 /usr/sbin/saslauthd -a pam
├─932362 /usr/sbin/saslauthd -a pam
├─932363 /usr/sbin/saslauthd -a pam
└─932364 /usr/sbin/saslauthd -a pam
[arch@vps-5220ce87 ~]$ cat /etc/conf.d/saslauthd
SASLAUTHD_OPTS="-a pam"
[arch@vps-5220ce87 ~]$ cat /etc/pam.d/smtp
#%PAM-1.0
auth required pam_unix.so
account required pam_unix.so
[arch@vps-5220ce87 ~]$ testsaslauthd -u test -p test
0: NO "authentication failed"
[arch@vps-5220ce87 ~]$ sudo journalctl -ru saslauthd -n 3
-- Logs begin at Mon 2020-11-16 09:26:47 UTC, end at Sat 2020-12-19 22:44:52 UTC. --
Dec 19 22:41:23 vps-5220ce87 saslauthd[932364]: : auth failure: [user=test] [service=imap] [realm=] [mech=pam] [reason=PAM auth error]
Dec 19 22:41:23 vps-5220ce87 saslauthd[932364]: DEBUG: auth_pam: pam_authenticate failed: Authentication failure
Dec 19 22:41:23 vps-5220ce87 saslauthd[932364]: pam_warn(imap:auth): function=[pam_sm_authenticate] flags=0x8000 service=[imap] terminal=[<unknown>] user=[t>
Sorry, it was simple. My pam configuration was for service smtp
.
[arch@vps-5220ce87 ~]$ testsaslauthd -u test -p test -s smtp
0: OK "Success."