[Bug 823484] New: pam_ssh stays as user if no session tty
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c0 Summary: pam_ssh stays as user if no session tty Classification: openSUSE Product: openSUSE 12.3 Version: Final Platform: i586 OS/Version: openSUSE 12.3 Status: NEW Severity: Normal Priority: P5 - None Component: Network AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: jimc@math.ucla.edu QAContact: qa-bugs@suse.de Found By: Community User Blocker: --- Versions: OpenSuSE 12.3 (final) pam_ssh-1.97-23.1.1.i586 and x86_64 xdm-1.1.10-14.6.1.i586 and x86_64 Also seen with: OpenSuSE 11.4 dated 2011-03-02 pam_ssh-1.97-11.14.1.i586 xorg-x11-7.6-43.46.1.i586 (for /usr/bin/xdm) How to reproduce: Execute as a user having SSH keys, i.e. ~/.ssh/id_rsa and friends. Users lacking SSH keys do not experience the bug. Configure the server's PAM session script to include: session optional pam_ssh.so debug ("debug" does not affect the bug but helps debugging.) Set up XDM on the server to accept XDMCP queries, remote or local. Start an X-server that makes a XDMCP query, for example: /usr/bin/Xvnc -inetd -port 177 -query localhost -once -geometry 1024x768 -depth 16 SecurityTypes=None It fails equally with Xephyr and with XMing on Windows. What result is expected: XDM puts up a greeter, the user authenticates, XDM runs /etc/X11/xdm/Xsession, and the user gets a session. What actually happens: XDM puts up a greeter, the user authenticates, and the session ends at that point. These messages are seen on syslog: (snip) Jun 2 10:53:43 iris xdm[4896]: pam_krb5[4896]: authentication succeeds for 'jimc' (jimc@CFT.CA.US) Jun 2 10:53:43 iris pam_ssh[4896]: init authentication module Jun 2 10:53:44 iris pam_ssh[4896]: auth successful for key id_rsa Jun 2 10:53:44 iris pam_ssh[4896]: auth successful for key id_rsa_mathroot Jun 2 10:53:44 iris pam_ssh[4896]: open session Jun 2 10:53:44 iris pam_ssh[4909]: exec /usr/bin/ssh-agent Jun 2 10:53:44 iris pam_ssh[4896]: session has no tty Jun 2 10:53:44 iris .ca[4896]: pam_lastlog(xdm:session): unable to open /var/lo g/lastlog: Permission denied Jun 2 10:53:44 iris .ca[4896]: PAM audit_log_acct_message() failed: Operation n ot permitted Jun 2 10:53:44 iris dbus-daemon[784]: dbus[784]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.43" (uid=500 pid=4911 comm="-iris.cft.ca ") interface="org.freedesktop.login1.Manager" member="ReleaseSession" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=696 comm="/usr/lib/systemd/systemd-logind ") Jun 2 10:53:44 iris dbus[784]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.43" (uid=500 pid=4911 comm="-iris.cft.ca ") interface="org.freedesktop.login1.Manager" member="ReleaseSession" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=696 comm="/usr/lib/systemd/systemd-logind ") Jun 2 10:53:44 iris .ca[4911]: pam_systemd(xdm:session): Failed to release session: Access denied Jun 2 10:53:44 iris .ca[4911]: pam_mail(xdm:session): pam_putenv: delete non-existent entry; MAIL Jun 2 10:53:44 iris dbus-daemon[784]: dbus[784]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.44" (uid=500 pid=4896 comm="-iris.cft.ca ") interface="org.freedesktop.login1.Manager" member="ReleaseSession" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=696 comm="/usr/lib/systemd/systemd-logind ") Jun 2 10:53:44 iris dbus[784]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.44" (uid=500 pid=4896 comm="-iris.cft.ca ") interface="org.freedesktop.login1.Manager" member="ReleaseSession" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=696 comm="/usr/lib/systemd/systemd-logind ") Jun 2 10:53:44 iris .ca[4896]: pam_systemd(xdm:session): Failed to release session: Access denied Strace reveals that XDM's session shepherd sets eUID to the user and puts it back to root, several times, but finally sets eUID to the user, forks and starts the agent, writes into ~/.ssh/agent-$HOST, sends to syslog a message beginning with "pam_ssh", and doesn't set eUID back to root. Subsequent steps fail because the user lacks permission to do them. How to fix: In pam_ssh.c, pam_sm_authenticate and pam_sm_close_session call openpam_borrow_cred but all ways out of the subroutines include openpam_restore_cred. However in pam_sm_open_session there are two points where you can escape without callling openpam_restore_cred: if you can read the agent file but can't stat it, and if you're about to link $HOME/.ssh/agent-$HOST-$TTY but there is no tty. The latter is my case. The included patch plugs both these escape routes, and the user can now get a session. More suggestions from the developers: Other display managers like LightDM do not trigger this bug. Do you suppose they pre-emptively set eUID back to root, knowing that PAM modules sometimes fail to do it? Such a defensive strategy might be a good idea for XDM. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c1 --- Comment #1 from James Carter <jimc@math.ucla.edu> 2013-06-05 23:12:49 UTC --- Created an attachment (id=542884) --> (http://bugzilla.novell.com/attachment.cgi?id=542884) Patch sets eUID back to root in the 2 cases that it wasn't done. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c2 --- Comment #2 from James Carter <jimc@math.ucla.edu> 2013-06-05 23:24:41 UTC --- Created an attachment (id=542886) --> (http://bugzilla.novell.com/attachment.cgi?id=542886) Spec file that applies the above patch If someone is having this problem and wants to rebuild the package immediately: 1. Obtain the source RPM from the SuSE Build Service, 2. Install (rpm -i pam_ssh-1.97-23.1.1.src.rpm), 3. Install the build prerequisites (see the spec file), 4. Put the patch in /usr/src/packages/SOURCES/pam_ssh-1.97-no_tty_stay_as_user.patch , 5. Put this spec file in /usr/src/packages/SPECS/pam_ssh.spec , 6. Compile by rpmbuild -bb /usr/src/packages/SPECS/pam_ssh.spec . It tells you where it wrote the binary RPM. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c Ye Yuan <yyuan@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yyuan@suse.com AssignedTo|bnc-team-screening@forge.pr |anicka@suse.com |ovo.novell.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c Vitezslav Cizek <vcizek@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |vcizek@suse.com AssignedTo|anicka@suse.com |vcizek@suse.com -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c3 --- Comment #3 from Bernhard Wiedemann <bwiedemann@suse.com> 2013-06-11 04:00:09 CEST --- This is an autogenerated message for OBS integration: This bug (823484) was mentioned in https://build.opensuse.org/request/show/178458 Maintenance / -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c4 --- Comment #4 from Vitezslav Cizek <vcizek@suse.com> 2013-06-11 04:04:08 CEST --- Thanks for your patch, James. An update will start soon. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c5 --- Comment #5 from James Carter <jimc@math.ucla.edu> 2013-06-11 17:21:02 UTC --- Upstream ( http://sourceforge.net/projects/pam-ssh/ ) say the patch will be included in pam_ssh-1.99. commit d744c1cda9e5d87598167f71333fcc230734c3c9 Author: Jim Carter <jimc@math.ucla.edu> Date: Tue Jun 11 09:15:33 2013 +0200 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c Swamp Workflow Management <swamp@suse.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status Whiteboard| |maint:planned:update -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c8 Vitezslav Cizek <vcizek@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #8 from Vitezslav Cizek <vcizek@suse.com> 2013-06-13 07:04:23 CEST --- Resolved for now. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c9 --- Comment #9 from Swamp Workflow Management <swamp@suse.de> 2013-06-17 06:05:43 UTC --- openSUSE-RU-2013:1021-1: An update that has one recommended fix can now be installed. Category: recommended (low) Bug References: 823484 CVE References: Sources used: openSUSE 12.3 (src): pam_ssh-1.97-23.4.1 openSUSE 12.2 (src): pam_ssh-1.97-20.4.1 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=823484 https://bugzilla.novell.com/show_bug.cgi?id=823484#c10 --- Comment #10 from Swamp Workflow Management <swamp@suse.de> 2013-06-17 11:04:33 UTC --- openSUSE-RU-2013:1035-1: An update that has two recommended fixes can now be installed. Category: recommended (low) Bug References: 727246,823484 CVE References: Sources used: openSUSE 11.4 (src): pam_ssh-1.97-22.1 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com