Bug 33155

Summary: [PATCH] sshd can leave hanging processes
Product: Base System Reporter: peter.jeremy <peter.jeremy>
Component: binAssignee: Dag-Erling Smørgrav <des>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.5-PRERELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description peter.jeremy 2001-12-24 22:20:01 UTC
	When processing an incoming connection, sshd forks to creat a child
	to manage the specific connection.  That child forks a second time
	with the second child used to manage PAM authentication.  If OPIE
	authentication is being used and the client aborts the authentication
	process then the second child will never terminate.  Any further
	attempt to log in as that user will fail because of the presence
	of the hanging process and lock file.

	Note that the process never times out - LoginGraceTime has no
	effect on the second child because the interval timer is not
	inherited across the fork (see separate PR to be written).

Fix: When the sshd process forks to manage PAM authentication, the
	parent and child share 3 pipes for IPC.  Neither the parent nor
	child close the unused ends of the pipe so that the child does
	not detect the parent's death.  The following patch closes
	the unused ends of the pipes.
How-To-Repeat: 	Configure /etc/pam.conf as follows:
sshd    auth    required        pam_opie.so
sshd    auth    required        pam_unix.so                     try_first_pass
sshd    account required        pam_unix.so
sshd    password required       pam_permit.so
sshd    session required        pam_permit.so
csshd   auth    required        pam_opie.so

	Create an OPIE key for a user and insert into /etc/opiekeys.
	Log into the host as that user:
$ slogin -l user -oTISAuthentication=yes hostname
	At the password prompt, enter Ctrl-C (or otherwise kill the client).
	On the server, a stray sshd process and /var/spool/opielocks/user
	file will be left behind.  Further attempts to log in will always
	result in failure.
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2002-01-09 14:35:42 UTC
Responsible Changed
From-To: freebsd-bugs->green

Over to the OpenSSH maintainer.
Comment 2 Brian Feldman freebsd_committer freebsd_triage 2003-07-13 05:23:05 UTC
Responsible Changed
From-To: green->des

ssh over to DES
Comment 3 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2003-07-14 11:27:06 UTC
State Changed
From-To: open->closed

OBE