From owner-freebsd-current Tue Nov 5 6: 1: 7 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 04A0637B401 for ; Tue, 5 Nov 2002 06:01:06 -0800 (PST) Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 46A5743E75 for ; Tue, 5 Nov 2002 06:01:05 -0800 (PST) (envelope-from des@ofug.org) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 0DFF9534E; Tue, 5 Nov 2002 15:01:03 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Markus Friedl Cc: Alexander Leidinger , current@freebsd.org, openssh@openbsd.org Subject: Re: ssh-agent broken with pam_ssh for xdm (+ fix for ssh-agent.c) References: <20021103204902.3c6b3705.Alexander@Leidinger.net> <20021104092329.GA1677@folly> From: Dag-Erling Smorgrav Date: Tue, 05 Nov 2002 15:01:02 +0100 In-Reply-To: <20021104092329.GA1677@folly> (Markus Friedl's message of "Mon, 4 Nov 2002 10:23:29 +0100") Message-ID: Lines: 16 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386--freebsd) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Markus Friedl writes: > yes, geteuid() could work, too, but why is ssh-agent running > with a privileged user id? shouldn't both the real and > effective user id be the uid of the user? ssh-agent is started by pam_ssh which is run under xdm's uid (i.e. 0). It switches to the user's egid and euid before starting ssh-agent. FreeBSD's execve() does not change the real user id (I don't think POSIX allows it) so ssh-agent has real user-id 0. It should do setuid(geteuid()) early on to guard against this. Alternatively, pam_ssh could use a home-grown privilege-dropping popen() instead of libc's popen() to start ssh-agent. DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message