FS#67636 - [pam] Can't login using pam 1.4 with certain .pam_environment contents
Attached to Project:
Arch Linux
Opened by Bitwave (bitwave) - Wednesday, 19 August 2020, 09:53 GMT
Last edited by Doug Newgard (Scimmia) - Saturday, 14 November 2020, 11:47 GMT
Opened by Bitwave (bitwave) - Wednesday, 19 August 2020, 09:53 GMT
Last edited by Doug Newgard (Scimmia) - Saturday, 14 November 2020, 11:47 GMT
|
Details
Description:
After upgrading pam to pam-1.4.0-3 and pambase to pambase 20200721.1-2 I was unable to login. Aug 19 10:58:27 moritz-arch systemd[1]: Starting User Manager for UID 1000... Aug 19 10:58:27 moritz-arch dbus-daemon[455]: [system] Activating via systemd: service name='org.freedesktop.home1' unit='dbus-org.freedesktop.ho> Aug 19 10:58:27 moritz-arch dbus-daemon[455]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.home1.service': Unit dbus-org> Aug 19 10:58:27 moritz-arch systemd[2488]: pam_systemd_home(systemd-user:account): Failed to query user record: Unit dbus-org.freedesktop.home1.s> Aug 19 10:58:27 moritz-arch audit[2488]: USER_ACCT pid=2488 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting grantors=pam_access,pam_u> Aug 19 10:58:27 moritz-arch audit[2488]: CRED_ACQ pid=2488 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:setcred grantors=? acct="moritz" exe=> Aug 19 10:58:27 moritz-arch systemd[2488]: pam_warn(systemd-user:setcred): function=[pam_sm_setcred] flags=0x8002 service=[systemd-user] terminal> Aug 19 10:58:27 moritz-arch systemd[2488]: pam_unix(systemd-user:session): session opened for user moritz(uid=1000) by (uid=0) Aug 19 10:58:27 moritz-arch audit[2488]: USER_START pid=2488 uid=0 auid=1000 ses=14 msg='op=PAM:session_open grantors=? acct="moritz" exe="/usr/l> Aug 19 10:58:27 moritz-arch systemd[2488]: PAM failed: Critical error - immediate abort Aug 19 10:58:27 moritz-arch systemd[2488]: user@1000.service: Failed to set up PAM session: Operation not permitted Aug 19 10:58:27 moritz-arch systemd[2488]: user@1000.service: Failed at step PAM spawning /usr/lib/systemd/systemd: Operation not permitted Aug 19 10:58:27 moritz-arch systemd[1]: user@1000.service: Main process exited, code=exited, status=224/PAM Aug 19 10:58:27 moritz-arch systemd[1]: user@1000.service: Failed with result 'exit-code'. Aug 19 10:58:27 moritz-arch systemd[1]: Failed to start User Manager for UID 1000. Steps to reproduce: - upgrade to earlier mentioned version via normal pacman -Syu - expected: login after restart works - login does not work - after downgrading pam and pambase to previous version pam-1.3.1-2 and pambase-20190105.1-2 login works again. |
This task depends upon
Closed by Doug Newgard (Scimmia)
Saturday, 14 November 2020, 11:47 GMT
Reason for closing: Fixed
Additional comments about closing: pam 1.5.0-1
Saturday, 14 November 2020, 11:47 GMT
Reason for closing: Fixed
Additional comments about closing: pam 1.5.0-1
What is the contents of /etc/pam.d/systemd-user
-rw-r--r-- 1 root root 160 23. Jul 20:39 chfn
-rw-r--r-- 1 root root 103 15. Jul 22:15 chgpasswd
-rw-r--r-- 1 root root 174 15. Jul 22:15 chpasswd
-rw-r--r-- 1 root root 160 23. Jul 20:39 chsh
-rw-r--r-- 1 root root 87 16. Jul 12:43 cups
-rw-r--r-- 1 root root 160 15. Jul 22:15 groupadd
-rw-r--r-- 1 root root 160 15. Jul 22:15 groupdel
-rw-r--r-- 1 root root 103 15. Jul 22:15 groupmems
-rw-r--r-- 1 root root 160 15. Jul 22:15 groupmod
-rw-r--r-- 1 root root 171 7. Jul 20:05 i3lock
-rw-r--r-- 1 root root 220 23. Jul 20:39 login
-rw-r--r-- 1 root root 174 15. Jul 22:15 newusers
-rw-r--r-- 1 root root 274 13. Nov 2019 other
-rw-r--r-- 1 root root 198 15. Jul 22:15 passwd
-rw-r--r-- 1 root root 155 3. Aug 09:49 polkit-1
-rw-r--r-- 1 root root 87 21. Jun 12:42 postgresql
-rw-r--r-- 1 root root 500 13. Nov 2019 rlogin
-rw-r--r-- 1 root root 425 13. Nov 2019 rsh
-rw-r--r-- 1 root root 76 23. Jul 20:39 runuser
-rw-r--r-- 1 root root 76 23. Jul 20:39 runuser-l
-rw-r--r-- 1 root root 27 6. Feb 2020 screen
-rw-r--r-- 1 root root 160 15. Jul 22:15 shadow
-rw-r--r-- 1 root root 232 16. Jul 22:16 sshd
-rw-r--r-- 1 root root 366 23. Jul 20:39 su
-rw-r--r-- 1 root root 97 22. Jul 16:15 sudo
-rw-r--r-- 1 root root 366 23. Jul 20:39 su-l
-rw-r--r-- 1 root root 441 13. Nov 2019 system-auth
-rw-r--r-- 1 root root 132 19. Aug 10:05 systemd-user
-rw-r--r-- 1 root root 143 13. Nov 2019 system-local-login
-rw-r--r-- 1 root root 713 13. Nov 2019 system-login
-rw-r--r-- 1 root root 143 13. Nov 2019 system-remote-login
-rw-r--r-- 1 root root 260 13. Nov 2019 system-services
-rw-r--r-- 1 root root 160 15. Jul 22:15 useradd
-rw-r--r-- 1 root root 160 15. Jul 22:15 userdel
-rw-r--r-- 1 root root 160 15. Jul 22:15 usermod
-rw-r--r-- 1 root root 124 14. Aug 14:24 vlock
Doesn't seem so.
cat /etc/pam.d/systemd-user
# Used by systemd --user instances.
account include system-login
session required pam_loginuid.so
session include system-login
However, in my case I noticed that system-login.pacnew was created.
Investigating the differences, it turns out that in my case
auth required pam_tally2.so
caused the issue.
Removed the module solved the login problem, without having to downgrade.
Maybe this helps
It was removed in pam 1.4.0.
I have to say I use a vanilla pam configuration without any custom modifications except for ones installed by packages.
grep tally /etc/pam.d/*
[0]: https://github.com/linux-pam/linux-pam/commit/f49166c7d8f3ae2c9d337154f7e5dc50d41ab6bf
I had to merge `/etc/pam.d/system-login`. I tested with the version of the package, my old version or the merged version. No change between the three.
``` bash
Aug 19 16:57:35 gdm-password][1636]: pam_systemd_home(gdm-password:auth): Failed to query user record: Unit dbus-org.freedesktop.home1.service not found.
Aug 19 16:57:40 gdm-password][1640]: PAM unable to dlopen(/usr/lib/security/pam_tally2.so): /usr/lib/security/pam_tally2.so: Ne peut ouvrir le fichier d'o>
Aug 19 16:57:40 gdm-password][1640]: PAM adding faulty module: /usr/lib/security/pam_tally2.so
Aug 19 16:58:03 gdm-password][1640]: gkr-pam: unable to locate daemon control file
Aug 19 16:58:09 gdm-password][1710]: PAM unable to dlopen(/usr/lib/security/pam_tally2.so): /usr/lib/security/pam_tally2.so: Ne peut ouvrir le fichier d'o>
Aug 19 16:58:09 gdm-password][1710]: PAM adding faulty module: /usr/lib/security/pam_tally2.so
```
And indeed I didn't have libs like `pam_tally2.so` or others (whose names I don't have anymore) in `/usr/lib/security/`.
Aug 19 10:58:27 moritz-arch systemd[2488]: pam_unix(systemd-user:session): session opened for user moritz(uid=1000) by (uid=0)
grep -r pam_warn.so /etc/pam.d/
/etc/pam.d/other:auth required pam_warn.so
/etc/pam.d/other:account required pam_warn.so
/etc/pam.d/other:password required pam_warn.so
/etc/pam.d/other:session required pam_warn.so
Try adding to /etc/pam.d/systemd-user
auth required pam_permit.so
password required pam_permit.so
Aug 19 18:36:33 moritz-arch audit[102821]: USER_AUTH pid=102821 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:authentication grantors=pam_securetty,pam_shells,pam_faillock,pam_permit,pam_faillock acct="moritz" exe="/usr/bin/login" hostname=moritz-arch addr=? terminal=tty3 res=success'
Aug 19 18:36:33 moritz-arch dbus-daemon[455]: [system] Activating via systemd: service name='org.freedesktop.home1' unit='dbus-org.freedesktop.home1.service' requested by ':1.1986' (uid=0 pid=102821 comm="/bin/login -p -- ")
Aug 19 18:36:33 moritz-arch dbus-daemon[455]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.home1.service': Unit dbus-org.freedesktop.home1.service not found.
Aug 19 18:36:33 moritz-arch login[102821]: pam_systemd_home(login:account): Failed to query user record: Unit dbus-org.freedesktop.home1.service not found.
Aug 19 18:36:33 moritz-arch audit[102821]: USER_ACCT pid=102821 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_permit,pam_time acct="moritz" exe="/usr/bin/login" hostname=moritz-arch addr=? terminal=tty3 res=success'
Aug 19 18:36:33 moritz-arch audit[102821]: CRED_ACQ pid=102821 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:setcred grantors=pam_securetty,pam_shells,pam_faillock,pam_permit,pam_faillock acct="moritz" exe="/usr/bin/login" hostname=moritz-arch addr=? terminal=tty3 res=success'
Aug 19 18:36:33 moritz-arch login[102821]: pam_unix(login:session): session opened for user moritz(uid=1000) by LOGIN(uid=0)
Aug 19 18:36:33 moritz-arch systemd-logind[459]: New session 43 of user moritz.
Aug 19 18:36:33 moritz-arch systemd[1]: Started Session 43 of user moritz.
Aug 19 18:36:33 moritz-arch audit[102821]: USER_START pid=102821 uid=0 auid=1000 ses=43 msg='op=PAM:session_open grantors=? acct="moritz" exe="/usr/bin/login" hostname=moritz-arch addr=? terminal=tty3 res=failed'
Aug 19 18:36:33 moritz-arch audit[102821]: CRED_DISP pid=102821 uid=0 auid=1000 ses=43 msg='op=PAM:setcred grantors=pam_securetty,pam_shells,pam_faillock,pam_permit,pam_faillock acct="moritz" exe="/usr/bin/login" hostname=moritz-arch addr=? terminal=tty3 res=success'
Aug 19 18:36:33 moritz-arch login[102821]: Critical error - immediate abort
Does pacman -Qkk detect any changed or missing files in /etc/pam.d ?
/e/pam.d> sudo pacman -Qkk (pacman -Qo * | awk { print \$4 } | sort | uniq)
Warnung: cups: /etc/cups/classes.conf (Berechtigungen stimmen nicht überein)
Sicherungs-Datei: cups: /etc/cups/classes.conf (Zeit der Veränderung stimmt nicht überein)
Sicherungs-Datei: cups: /etc/cups/classes.conf (Größen stimmen nicht überein)
Warnung: cups: /etc/cups/printers.conf (Berechtigungen stimmen nicht überein)
Sicherungs-Datei: cups: /etc/cups/printers.conf (Zeit der Veränderung stimmt nicht überein)
Sicherungs-Datei: cups: /etc/cups/printers.conf (Größen stimmen nicht überein)
Warnung: cups: /etc/cups/subscriptions.conf (Berechtigungen stimmen nicht überein)
Sicherungs-Datei: cups: /etc/cups/subscriptions.conf (Zeit der Veränderung stimmt nicht überein)
Sicherungs-Datei: cups: /etc/cups/subscriptions.conf (Größen stimmen nicht überein)
cups: 874 Dateien gesamt, 3 veränderte Dateien
i3lock: 13 Dateien gesamt, 0 veränderte Dateien
inetutils: 56 Dateien gesamt, 0 veränderte Dateien
kbd: 775 Dateien gesamt, 0 veränderte Dateien
openssh: 59 Dateien gesamt, 0 veränderte Dateien
pambase: 8 Dateien gesamt, 0 veränderte Dateien
polkit: 201 Dateien gesamt, 0 veränderte Dateien
postgresql: 2807 Dateien gesamt, 0 veränderte Dateien
screen: 38 Dateien gesamt, 0 veränderte Dateien
Warnung: shadow: /usr/bin/newgidmap (Berechtigungen stimmen nicht überein)
Warnung: shadow: /usr/bin/newuidmap (Berechtigungen stimmen nicht überein)
shadow: 558 Dateien gesamt, 2 veränderte Dateien
Sicherungs-Datei: sudo: /etc/sudoers (Zeit der Veränderung stimmt nicht überein)
Sicherungs-Datei: sudo: /etc/sudoers (Größen stimmen nicht überein)
sudo: 223 Dateien gesamt, 0 veränderte Dateien
Sicherungs-Datei: systemd: /etc/pam.d/systemd-user (Zeit der Veränderung stimmt nicht überein) Change time doesnt match
Sicherungs-Datei: systemd: /etc/pam.d/systemd-user (Größen stimmen nicht überein) filesize doesnt match
Sicherungs-Datei: systemd: /etc/systemd/journald.conf (Zeit der Veränderung stimmt nicht überein)
Sicherungs-Datei: systemd: /etc/systemd/journald.conf (Größen stimmen nicht überein)
Warnung: systemd: /var/log/journal (GID stimmt nicht überein)
systemd: 1820 Dateien gesamt, 1 veränderte Datei
util-linux: 506 Dateien gesamt, 0 veränderte Dateien
If this works the issue is in the pambase changes not the pam 1.4 update.
If it does please upgrade pambase and replace system-auth with the one attached. The attached one removes pam-systemd-homed support.
Aug 19 19:36:33 moritz-arch audit[121989]: USER_AUTH pid=121989 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:authentication grantors=pam_secu>
Aug 19 19:36:33 moritz-arch audit[121989]: USER_ACCT pid=121989 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting grantors=pam_access,p>
Aug 19 19:36:33 moritz-arch audit[121989]: CRED_ACQ pid=121989 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:setcred grantors=pam_securetty,pa>
Aug 19 19:36:33 moritz-arch login[121989]: pam_unix(login:session): session opened for user moritz(uid=1000) by LOGIN(uid=0)
Aug 19 19:36:33 moritz-arch systemd-logind[459]: New session 48 of user moritz.
Aug 19 19:36:33 moritz-arch systemd[1]: Started Session 48 of user moritz.
Aug 19 19:36:33 moritz-arch audit[121989]: USER_START pid=121989 uid=0 auid=1000 ses=48 msg='op=PAM:session_open grantors=? acct="moritz" exe="/u>
Aug 19 19:36:33 moritz-arch audit[121989]: CRED_DISP pid=121989 uid=0 auid=1000 ses=48 msg='op=PAM:setcred grantors=pam_securetty,pam_shells,pam_>
Aug 19 19:36:33 moritz-arch login[121989]: Critical error - immediate abort
And I don't understand why /etc/pam.d/system-login on my laptop uses pam_tally2 while my netbook does not .I don't remember changing anything. Never mind, this is not the real problem.
FS#67641. You also have an issue caused by pam_env.so?Normally all errors are not a problem, because you can still login, see what the problem is and solve it.
But this time it cost me one hour to figure it all out.
[1] https://wiki.archlinux.org/index.php/System_maintenance#Deal_promptly_with_new_configuration_files
[2] https://lists.archlinux.org/pipermail/arch-general/2020-August/048061.html
[3] https://lists.archlinux.org/pipermail/arch-general/2020-August/048062.html
Unfortunately downgrade for some reason made it worse, it didn't even let me log in as root anymore, it just said "login incorrect" for both root and my user with no 10 minute cooldown like i get on the latest version.
SSH_AUTH_SOCK DEFAULT="${XDG_RUNTIME_DIR}/ssh-agent.socket"
Possibly caused by [3]
@thirstyshark you can use faillock --user $USERNAME --reset to clear the faillock, you can also change the lockout options in /etc/security/faillock.conf
[1] https://bbs.archlinux.org/viewtopic.php?id=258324
[2] https://bbs.archlinux.org/viewtopic.php?id=258320
[3] https://github.com/linux-pam/linux-pam/commit/563d21d6dbb6d64613919ccb1cc939bae546baab
For those affected does `grep -Pa '\x00' .pam_environment` produce any output?
contens are:
$ cat .pam_environment
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
Thx for the explanation.
My problem is probably pamac: https://gitlab.manjaro.org/applications/pamac/-/issues/877
Still I would recommend to put the explanation about .pacnew somewhere where everyone surely reads it, like a page "Important Notes" or something.
Because even though I read through all these pages, I must have somehow read over this.
https://wiki.archlinux.org/index.php/System_maintenance#Deal_promptly_with_new_configuration_files
.pacnew files are also explicitly mentioned in the `pacman` man page, https://www.archlinux.org/pacman/pacman.8.html#_handling_config_files_a_id_hcf_a
session required pam_env.so debug user_readenv=1
There should be more output in the journal.
@bitwave what if you change the XMODIFIERS entry to:
XMODIFIERS=\@im=fcitx
And since this bug completely locks someone out of its computer (requiring a LiveUSB or another computer if you don't have one ready), it really shouldn't be a "Low" severity bug.
Since it seems to only affect modified config (which I can verify), it may not be very high priority...
But please. This is not "Low" severity.
I am aware of .pacnew and I make the necessary changes systematically. But this is clearly not enough. Having to downgrade the package from a LiveUSB shouldn't be a low severity!
By the way, for people who have followed the recommendations on this page: https://wiki.archlinux.org/index.php/Security, have necessarily these files (system-login passwd) or modified. So it must (or will) happen to many people who keep their Arch Linux up to date.
Fair warning for everyone: continued hijacking will result in accounts being disabled.
I don't know how this could have been avoided... perhaps something like a merge tool for important config files, built into pacman, would be cool :)
@JDWUP thank you very much for the rescue mode hint, it saved my day.
FS#67641I had a `$HOME/.pam_environment` file. Once I removed it everything worked correctly again.
I was able to login through lxdm but had no dbus server, no user systemd, no pulseaudio, etc.
That `.pam_environment` file was recommended by the SSH-agent wiki page: https://wiki.archlinux.org/index.php/SSH_keys#Start_ssh-agent_with_systemd_user
I reverted to setting that variable in my bash config until what has to be done is a bit more clear
I don't know if that's important, but I am using old Kernel 4.15.8-1-ARCH.
Edit:
Reverting [2] and I can no longer reproduce the issue.
[1] https://github.com/linux-pam/linux-pam/issues
[2] https://github.com/linux-pam/linux-pam/commit/563d21d6dbb6d64613919ccb1cc939bae546baab
Edit2:
https://github.com/linux-pam/linux-pam/issues/263
Will report in git.
[1] https://github.com/linux-pam/linux-pam/commit/12824dd648b0668968231044ed805d1f3b212d7e