Bug 980 - sshd does not write the session leader pid to utmp when priv-separation is enabled
Summary: sshd does not write the session leader pid to utmp when priv-separation is en...
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 3.9p1
Hardware: All All
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-03 19:30 AEDT by Logu
Modified: 2019-06-29 00:09 AEST (History)
3 users (show)

See Also:


Attachments
pass session pid to monitor for login recording (4.06 KB, patch)
2005-02-04 00:22 AEDT, Darren Tucker
no flags Details | Diff
pass session pid to monitor for login recording, record session logout too (4.24 KB, patch)
2005-02-12 20:57 AEDT, Darren Tucker
no flags Details | Diff
Patch for logging,clearing shell pid during login and logout (9.33 KB, patch)
2005-05-16 23:38 AEST, senthilkumar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Logu 2005-02-03 19:30:05 AEDT
sshd when privilege separation is enabled and when a normal user logs in, writes
privileged sshd's pid to the utmp file instead of writing the session leader's
(shell)pid. As an effect this, the w command in linux shows that the user is
currectly executing sshd, when the user is idle.
Comment 1 Darren Tucker 2005-02-04 00:22:06 AEDT
Created attachment 802 [details]
pass session pid to monitor for login recording

Please try this patch.
Comment 2 Logu 2005-02-04 23:38:44 AEDT
The problem was some what different than I reported. The `w` command in linux
shows that the user is currectly executing sshd, when the user is switched to
another user using `su` command. The patch did not solve the problem. But it
writes the correct pid. This patch introduces another issue that when the user
logged out, it did not clear the wtmp and we get a "gone - no logout" when
`last` command is executed.

system: Fedora Core release 2
Kernel : linux-2.6.5-1.358 
Comment 3 senthilkumar 2005-02-09 15:38:45 AEDT
This fix (ID=802) fixes one problem in hpux. Previously, the logname command 
didn't worked in hpux, but now with this fix it is working. However even after 
the user logs out, the last command still displays that the user is "still 
logged in". This happens when privilegeseparation is enabled.
Comment 4 Darren Tucker 2005-02-12 20:57:48 AEDT
Created attachment 821 [details]
pass session pid to monitor for login recording, record session logout too
Comment 5 senthilkumar 2005-02-15 00:19:33 AEDT
Yes, the patch (id=821) works in hpux.
Comment 6 senthilkumar 2005-02-24 19:56:38 AEDT
Is this patch for login recording and logout will be in next release?
Comment 7 Darren Tucker 2005-02-25 10:23:50 AEDT
No, the patch has not been committed.  I don't think it's quite right either, I
think it writes the pid of the unprivileged sshd not the pid of the shell.
Comment 8 senthilkumar 2005-04-29 00:28:13 AEST
I tried passing SIGTERM to the sshd user process after applying the patch 
(id=821) and it is not cleaning up the wtmp entries. What would be needed in the 
patch additionaly so that proper pid is passed at the time of cleaning wtmp 
entries when SIGTERM is received.
Comment 9 senthilkumar 2005-04-29 00:37:48 AEST
What makes the difference between recording unprivileged sshd process and forked 
shell pid of this process in either utmp or wtmp and why it should be like that?

On what basis the getlogin() call works?. In base code, unprivileged sshd 
process pid is logged and getlogin() call fails on HP-UX. But with the patch (id 
821) the same unprivileged sshd process pid is logged and getlogin() call now 
succeeds. IS there any other information logging significant in this regard?.
Comment 10 senthilkumar 2005-04-29 15:40:44 AEST
A change for comment #9, with the patch id 821, it logs the same process id 0 
for login. As a result when the user logout in one session, all the entires 
related to the user or someother user in wtmp are cleaned for all sessions even 
when the users doesn't logout in other sessions.
Comment 11 senthilkumar 2005-05-16 23:38:26 AEST
Created attachment 916 [details]
Patch for logging,clearing shell pid during login and logout

The attached patch logs the shell pid to utmp/wtmp files during login if
privilegeseparation is enabled. It also clears the shell pid from these files
during logout with privilegeseparation enabled. I tested the patch and it works
fine. Let me know the comments on the patch.
Comment 12 krishna 2007-10-03 04:42:44 AEST
Is the bug related to this vulnerability:
http://secunia.com/advisories/22771/

I am new to the linux platform. I would like to know the steps to reproduce the bug.

thank you.
Comment 13 Tomas Mraz 2007-10-03 05:48:09 AEST
No, that was completely unrelated problem.
Comment 14 Castro B 2019-06-29 00:09:59 AEST
Hi does anyone know how to fix this? this was long time ago

Castro B.
http://internetvergelijken.nl