From owner-freebsd-arch@freebsd.org Wed Sep 30 08:09:37 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FCEBA0BBDB; Wed, 30 Sep 2015 08:09:37 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D204A13AC; Wed, 30 Sep 2015 08:09:36 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by iofh134 with SMTP id h134so39033812iof.0; Wed, 30 Sep 2015 01:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:cc:content-type; bh=HY9hLiYrMJCVpyojuE5TkhUJDUwfZcvowP5agcgl89E=; b=iWMOUBOeSz/Knz/m4Vlc1F8D86veAlwCp7xHVTyjQECetK5JHHjd9XN9MdZqpVArCF Siq7gRQwtrHEFgM6l37EWwfWtfLnYKGVQStsR1FGQUr3m1xJ73Vq6XX0t2Loyddb8GRf D0i5VQeOf4HP4kkhh/fL1aG6NdCTpjAEbbilLOLAaVx2Wsd7x8mEJLfviRLKY+AOq00F fNY6R7WXEz2SWiF09ZQoZswD74aJuZkYhFJwpKMSpelfwo2Snn4tdxq5UA1dGh3od9e6 rN51P7YozeZ6zKQvo4v/MTz9mZBOMiG6sNa4f/UV9+K4UznK3Utv72qGAsAqq2UKFAZa Mz0w== X-Received: by 10.107.165.140 with SMTP id o134mr2730401ioe.29.1443600576324; Wed, 30 Sep 2015 01:09:36 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.158.75 with HTTP; Wed, 30 Sep 2015 01:09:16 -0700 (PDT) From: Ed Maste Date: Wed, 30 Sep 2015 08:09:16 +0000 X-Google-Sender-Auth: fBx4eSroNdXqCRbg9OOSZlz82XQ Message-ID: Subject: 1-week reminder: Call for FreeBSD 2015Q3 (July-September) Status Reports To: FreeBSD Current , "freebsd-hackers@freebsd.org" , "freebsd-arch@freebsd.org" Cc: "monthly@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 08:09:37 -0000 Dear FreeBSD Community, This is a reminder that the deadline for the next FreeBSD Quarterly Status update is October 7, 2015, for work done in July through September. Thank you to those who have sent in reports already. For others there is still time to submit a report and highlight your work for the rest of FreeBSD community. Status report submissions do not have to be very long. They may be about anything happening in the FreeBSD project and community, and provide a great way to inform FreeBSD users and developers about what you're working on. Submission of reports is not restricted to committers. Anyone doing anything interesting and FreeBSD-related can -- and should -- write one! The preferred and easiest submission method is to use the XML generator [1] with the results emailed to the status report team at monthly at freebsd.org . There is also an XML template [2] which can be filled out manually and attached if preferred. For the expected content and style, please study our guidelines on how to write a good status report [3]. You can also review previous issues [4][5] for ideas on the style and format. We are looking forward to all of your 2015Q3 reports! Thanks, Ed (on behalf of monthly@) [1] http://www.freebsd.org/cgi/monthly.cgi [2] http://www.freebsd.org/news/status/report-sample.xml [3] http://www.freebsd.org/news/status/howto.html [4] http://www.freebsd.org/news/status/report-2015-01-2015-03.html [5] http://www.freebsd.org/news/status/report-2015-04-2015-06.html From owner-freebsd-arch@freebsd.org Thu Oct 1 18:59:00 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E152FA0D36C for ; Thu, 1 Oct 2015 18:58:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id C64DB1EDE for ; Thu, 1 Oct 2015 18:58:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id BF5221A3C for ; Thu, 1 Oct 2015 18:58:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 4F93414284 for ; Thu, 1 Oct 2015 18:58:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id n7DBhAsmHqNw for ; Thu, 1 Oct 2015 18:58:57 +0000 (UTC) To: freebsd-arch@FreeBSD.org DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com BD49B1427F From: Bryan Drewery Subject: login -f changing session getlogin(2) Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc X-Enigmail-Draft-Status: N1110 Organization: FreeBSD Message-ID: <560D826D.7000302@FreeBSD.org> Date: Thu, 1 Oct 2015 11:58:53 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NmnlDEdgGU4JG0JOmDpl1tPPuDsQNbsP9" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 18:59:00 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NmnlDEdgGU4JG0JOmDpl1tPPuDsQNbsP9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This issue has bothered me forever. As root running 'login -f someuser' and then exit, logname(1) and getlogin(2) will forever return that user's name, rather than root. The issue is that login(1) uses setlogin(2) without ever restoring the login from the parent when it exits. This is easily fixed by something like: Index: usr.bin/login/login.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- usr.bin/login/login.c (revision 288456) +++ usr.bin/login/login.c (working copy) @@ -166,6 +166,7 @@ gid_t egid; char *term; char *p, *ttyn; + char oldlogname[MAXLOGNAME]; char tname[sizeof(_PATH_TTY) + 10]; char *arg0; const char *tp; @@ -545,6 +546,9 @@ } pam_session_established =3D 1; + if (getlogin_r(oldlogname, sizeof(oldlogname)) !=3D 0) + oldlogname[0] =3D '\0'; + /* * We must fork() before setuid() because we need to call * pam_close_session() as root. @@ -567,6 +571,8 @@ (void)sigprocmask(SIG_SETMASK, &omask, NULL); waitpid(pid, &status, 0); (void)sigprocmask(SIG_BLOCK, &mask, NULL); + if (oldlogname[0] !=3D '\0') + setlogin(oldlogname); bail(NO_SLEEP_EXIT, 0); } I'm not sure this is the right way though. My initial instinct was to use setsid(2) in the child but that clobbers the terminal. It makes me wonder if there's bigger architectural issues here that need addressing with session and login. Perhaps login -f is just a special case though. Thanks, Bryan Drewery --NmnlDEdgGU4JG0JOmDpl1tPPuDsQNbsP9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJWDYJzAAoJEDXXcbtuRpfPJEAIALFb3CcBqgRH3lodHOeyu2S+ K8ABbLaz2jybHg85YD3ACvlSt0dilWcjhbxxI9x98URKLZ9Clu9XWrykXnL5xr7h dkt4RmD9wVRKCpis4bXIHLpNrT9Zw4CAWkXxKt7a2EVkX+Y1gZSpGokrll5xLM7j ks4LqrxbboLPqDeqMZ+1/9oD5PqJ62OpEzPWzlh8u0OVtSrI7yKisYpr6EGvLdAA j1Z9cwRdB43K1aESWU+b/RuGehXK/HoJ6Icr7WoLhQAI7g+VLk3w+EkZ3iFyu5rc oC6kYgJIfNtdQ89Qf8+uTQH1fXR4CiOkDJw4W047QyVkiFYfkqBsf0xUIHHKhxE= =ECmn -----END PGP SIGNATURE----- --NmnlDEdgGU4JG0JOmDpl1tPPuDsQNbsP9-- From owner-freebsd-arch@freebsd.org Thu Oct 1 20:34:40 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B667EA0EF65 for ; Thu, 1 Oct 2015 20:34:40 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 81FD81085; Thu, 1 Oct 2015 20:34:40 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 43F273592E4; Thu, 1 Oct 2015 22:34:37 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 0121728494; Thu, 1 Oct 2015 22:34:36 +0200 (CEST) Date: Thu, 1 Oct 2015 22:34:36 +0200 From: Jilles Tjoelker To: Bryan Drewery Cc: freebsd-arch@FreeBSD.org Subject: Re: login -f changing session getlogin(2) Message-ID: <20151001203436.GA22737@stack.nl> References: <560D826D.7000302@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <560D826D.7000302@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 20:34:40 -0000 On Thu, Oct 01, 2015 at 11:58:53AM -0700, Bryan Drewery wrote: > This issue has bothered me forever. > As root running 'login -f someuser' and then exit, logname(1) and > getlogin(2) will forever return that user's name, rather than root. > The issue is that login(1) uses setlogin(2) without ever restoring the > login from the parent when it exits. > This is easily fixed by something like: > [snip] > I'm not sure this is the right way though. > My initial instinct was to use setsid(2) in the child but that clobbers > the terminal. > It makes me wonder if there's bigger architectural issues here that need > addressing with session and login. Perhaps login -f is just a special > case though. I don't think login -f should be used like that. For that use case, su -l looks more appropriate. In either case, the two login sessions are strangely intertwined. Using ssh to localhost provides two normal login sessions. Resetting the login name also affects processes started by the logged in user that still run (as long as they have not created a new session). This may confuse applications and hinders traceability. This breakage would also affect normal login sessions on terminals. I think the supposed use case for login -f is a remote login daemon that handles authentication by itself but wants to delegate account and session functionality. Indeed, sshd has UseLogin, but it is rarely used and discouraged. -- Jilles Tjoelker From owner-freebsd-arch@freebsd.org Thu Oct 1 21:21:27 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24114A0E2B7 for ; Thu, 1 Oct 2015 21:21:27 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 0A94B1C3C for ; Thu, 1 Oct 2015 21:21:27 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: by mailman.ysv.freebsd.org (Postfix) id 0997CA0E228; Thu, 1 Oct 2015 21:21:27 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 092B6A0E227 for ; Thu, 1 Oct 2015 21:21:27 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (wollman-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:ccb::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C12051C38 for ; Thu, 1 Oct 2015 21:21:26 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.14.9/8.14.9) with ESMTP id t91LLKeS025118; Thu, 1 Oct 2015 17:21:20 -0400 (EDT) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.14.9/8.14.4/Submit) id t91LLJ9h025117; Thu, 1 Oct 2015 17:21:19 -0400 (EDT) (envelope-from wollman) Date: Thu, 1 Oct 2015 17:21:19 -0400 (EDT) From: Garrett Wollman Message-Id: <201510012121.t91LLJ9h025117@hergotha.csail.mit.edu> To: jilles@stack.nl Subject: Re: login -f changing session getlogin(2) In-Reply-To: References: <20151001203436.GA22737@stack.nl> <560D826D.7000302@FreeBSD.org> Organization: none Cc: arch@freebsd.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (hergotha.csail.mit.edu [127.0.0.1]); Thu, 01 Oct 2015 17:21:20 -0400 (EDT) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hergotha.csail.mit.edu X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 21:21:27 -0000 In article <20151001203436.GA22737@stack.nl>, jilles@stack.nl writes: >I think the supposed use case for login -f is a remote login daemon that >handles authentication by itself but wants to delegate account and >session functionality. Indeed, sshd has UseLogin, but it is rarely used >and discouraged. Historically, as I remember it, "login" was a shell built-in that was effectively an alias for "exec login". It may still be that way in antique csh. The assumption from time immemorial is that if login exits, the parent process will not distinguish it from any other logout, so login is permitted to overwrite persistent session state. -GAWollman From owner-freebsd-arch@freebsd.org Thu Oct 1 22:02:22 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38B41A0E4BD for ; Thu, 1 Oct 2015 22:02:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 1B0BA1ED6; Thu, 1 Oct 2015 22:02:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 0F9131018; Thu, 1 Oct 2015 22:02:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id B52DE147E1; Thu, 1 Oct 2015 22:02:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 812IzODIspzv; Thu, 1 Oct 2015 22:02:16 +0000 (UTC) Subject: Re: login -f changing session getlogin(2) DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 5B6A5147DC To: Jilles Tjoelker References: <560D826D.7000302@FreeBSD.org> <20151001203436.GA22737@stack.nl> Cc: freebsd-arch@FreeBSD.org From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc X-Enigmail-Draft-Status: N1110 Organization: FreeBSD Message-ID: <560DAD6D.7050007@FreeBSD.org> Date: Thu, 1 Oct 2015 15:02:21 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151001203436.GA22737@stack.nl> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="61OirB5TTt3m23TUFLQbPuFDolenGrRRH" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 22:02:22 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --61OirB5TTt3m23TUFLQbPuFDolenGrRRH Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 10/1/2015 1:34 PM, Jilles Tjoelker wrote: > On Thu, Oct 01, 2015 at 11:58:53AM -0700, Bryan Drewery wrote: >> This issue has bothered me forever. >=20 >> As root running 'login -f someuser' and then exit, logname(1) and >> getlogin(2) will forever return that user's name, rather than root. >=20 >> The issue is that login(1) uses setlogin(2) without ever restoring the= >> login from the parent when it exits. >=20 >> This is easily fixed by something like: >=20 >> [snip] >=20 >> I'm not sure this is the right way though. >=20 >> My initial instinct was to use setsid(2) in the child but that clobber= s >> the terminal. >=20 >> It makes me wonder if there's bigger architectural issues here that ne= ed >> addressing with session and login. Perhaps login -f is just a special >> case though. >=20 > I don't think login -f should be used like that. For that use case, su > -l looks more appropriate. In either case, the two login sessions are > strangely intertwined. Using ssh to localhost provides two normal login= > sessions. >=20 > Resetting the login name also affects processes started by the logged i= n > user that still run (as long as they have not created a new session). > This may confuse applications and hinders traceability. This breakage > would also affect normal login sessions on terminals. >=20 > I think the supposed use case for login -f is a remote login daemon tha= t > handles authentication by itself but wants to delegate account and > session functionality. Indeed, sshd has UseLogin, but it is rarely used= > and discouraged. >=20 Well, none of that is documented or its use discouraged. It has been quite surprising, for example, to find mails sent as the wrong user weeks after doing a 'login -f' out of habit from root. Can't we use something like forkpty(3) for the child to avoid the issues you mention? It calls setsid(2) via login_tty(3). And actually, 'su -l' NOT calling setlogin(2) is another surprise. I have used 'login -f' precisely because it simulates a real login and sets up the environment as the user. If I am dropping into a user's shell I expect things like 'mail' to have their FROM not root or wherever I came from in my session. --=20 Regards, Bryan Drewery --61OirB5TTt3m23TUFLQbPuFDolenGrRRH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJWDa1tAAoJEDXXcbtuRpfPNCsIAK31zYGtil31ajCYPdIMiu+O zoYefgi23feBtNSMIDygm2ypPCu+0ShKG8akwjfRVRGFgZD8nDMT9CViDX2NAsVV 0AqBSKL5CiGZPgFxL7wSF24G9sCFT3c6cGevAZ6+k7a/Sh81St/DVkL4S04h6Sh0 Wbvu+9GnfoUM9cMs9ze6o3vvMLyB63GdckTfJ5rs+daVcfyFzfodTvyBp3UbcEHQ ZJXcDRrfSb9a0Tt3WkHVEHzF55fe/NJKImFz9YR7FbZt3kOMCE8LvsMNUMbfBZ0y gFwr6Zuo8tQs9K5yvNVi/EURpD1rydFAyH8hbP/WMapXjylIsSM46lB+DXTkKW4= =ARdx -----END PGP SIGNATURE----- --61OirB5TTt3m23TUFLQbPuFDolenGrRRH-- From owner-freebsd-arch@freebsd.org Sat Oct 3 17:13:01 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 385D6A0F513 for ; Sat, 3 Oct 2015 17:13:01 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0102.outbound.protection.outlook.com [65.55.169.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DCAC197B; Sat, 3 Oct 2015 17:12:59 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from BLUPR05CA0057.namprd05.prod.outlook.com (10.141.20.27) by BY1PR0501MB1384.namprd05.prod.outlook.com (10.160.107.142) with Microsoft SMTP Server (TLS) id 15.1.286.20; Sat, 3 Oct 2015 17:12:52 +0000 Received: from BL2FFO11FD045.protection.gbl (2a01:111:f400:7c09::190) by BLUPR05CA0057.outlook.office365.com (2a01:111:e400:855::27) with Microsoft SMTP Server (TLS) id 15.1.286.20 via Frontend Transport; Sat, 3 Oct 2015 17:12:51 +0000 Authentication-Results: spf=softfail (sender IP is 66.129.239.18) smtp.mailfrom=juniper.net; freebsd.org; dkim=none (message not signed) header.d=none;freebsd.org; dmarc=none action=none header.from=juniper.net; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.18 as permitted sender) Received: from p-emfe01b-sac.jnpr.net (66.129.239.18) by BL2FFO11FD045.mail.protection.outlook.com (10.173.161.207) with Microsoft SMTP Server (TLS) id 15.1.286.14 via Frontend Transport; Sat, 3 Oct 2015 17:12:51 +0000 Received: from magenta.juniper.net (172.17.27.123) by p-emfe01b-sac.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Sat, 3 Oct 2015 10:12:50 -0700 Received: from chaos.jnpr.net (chaos.jnpr.net [172.21.16.28]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id t93HCnD08499; Sat, 3 Oct 2015 10:12:49 -0700 (PDT) (envelope-from sjg@juniper.net) Received: from chaos (localhost [IPv6:::1]) by chaos.jnpr.net (Postfix) with ESMTP id 42473580A9; Sat, 3 Oct 2015 10:12:49 -0700 (PDT) To: Bryan Drewery CC: Jilles Tjoelker , , Subject: Re: login -f changing session getlogin(2) In-Reply-To: <560DAD6D.7050007@FreeBSD.org> References: <560D826D.7000302@FreeBSD.org> <20151001203436.GA22737@stack.nl> <560DAD6D.7050007@FreeBSD.org> Comments: In-reply-to: Bryan Drewery message dated "Thu, 01 Oct 2015 15:02:21 -0700." From: "Simon J. Gerraty" X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 24.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16813.1443892369.1@chaos> Date: Sat, 3 Oct 2015 10:12:49 -0700 Message-ID: <28007.1443892369@chaos> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD045; 1:YbXRm26aXi0J53CHPFvFtSgHOTzpT8LEUDq9axOttgqzjKvuTJYB7wBlA+yLtfF+IKS9EGZnXiUulF3d9xZxhZvcSGWU4uyfVrLhQJDENOmti1do+ULT0KzEj8UJJPRIOuKehtMwLl324aiHcj2PajaJpIaqUqf/keIpL4aupzdmX20/fqvydG4dNxEpEeBx2g1RfGSrH5811wOe8FCUHfMuR7k4UYDrLk9UdT6eJq+h7yyWoJSY5RBgeuutqp40M10zEwx7vcQ5DS+haHuIRVK8yC/nbYQ/1XCSswGX11pnkOfdwOtr87qRVu3dqlNYHeoRTxkY9/ftZYaL+gnT4Q== X-Forefront-Antispam-Report: CIP:66.129.239.18; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(189002)(199003)(50226001)(4001540100001)(6806005)(189998001)(50466002)(87936001)(5001960100002)(5007970100001)(107886002)(117636001)(76506005)(11100500001)(110136002)(57986006)(5008740100001)(46406003)(69596002)(46102003)(92566002)(47776003)(5001830100001)(86362001)(97736004)(23726002)(81156007)(77096005)(97756001)(5001860100001)(68736005)(106466001)(2950100001)(76176999)(33716001)(50986999)(105596002)(77156002)(62966003)(64706001)(4001430100001)(42262002)(62816006); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0501MB1384; H:p-emfe01b-sac.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0501MB1384; 2:fvrmWTaIoT1kZE1rBjSuJmQYlZa567p51wJRmFLSPppF8DylfRA8zUi2DNRQcD+o5eQ066IOP3mWlzCsgxwSxbRKGXX1baYkliTi1LGrbZNDQNw5XfwmsiiT4MOZOtZdfDapopE7vxk+5rSO4Pzsb3GeqQ25H0kXAgz/mOTBbOE=; 3:qmqVOYDGb8Cfyhbp/AcNwJvo6FxzhzirepsM8D+yva/p4Ql87bnzHt9Ukv4cBRxCu2KmEqzQDC1z9XY93oER+j559Gs+PieQoMj4ML8OUExy1aSM/JlHmsD5vC7Lyeh9OW/g4Ge9bPVHi+Rm9/jT1p/KcQgtGrjai5VkjLLSeD5Hn2H8Dm1KJt7KwfQd2SeuaE/KZZ8yFhGCIX0vzivmprPv/FlOXGxcLL1yib9a0f8=; 25:czNTUs5/4J+RDOmRHHDStsK2IlZ/SRiFcHzbym5zq3BrCVgGoV0n27lJ5LfUF4SWmzoVrHuxr509+hgIZ5YrhovfPmAVY+S73BETHFCtC7AOryNk4Yt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7nRG8wd9DICyQqLI6VMwyUQAPyQ9ARXXrjJp7F0NBA4axE5VPKQRXp9e8vV+RHK1cU58Eqyd7s= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001); SRVR:BY1PR0501MB1384; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0501MB1384; X-Forefront-PRVS: 0718908305 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0501MB1384; 23:7p7xsgrXF5OSsRvfydJLImYXpnC9+3CUC2tJeV8?= =?us-ascii?Q?6kIB1GwPpJskSH0w8d8LBLyGtEwOxKxqG6vSrkYjnJC18F/FBEsEeN1jfUiD?= =?us-ascii?Q?9HmMADsyXkvk3jUMkr+iXCf2NjajHftTxhECn+rIOYbleQORNA17ID0+lxKL?= =?us-ascii?Q?Mj+BFAKDibGY0e/dkkJnMDNUp7ufjxmFuE4N73Ju0STVTJqn0bENStMN+rLN?= =?us-ascii?Q?uLM4m4HqamjfiYT9n9iGxjvXTOUtNpb8V9j1CwnOc7SaiVK+UpR5X6RnwWNh?= =?us-ascii?Q?6wDGCnFLoYvoFg57YWZFQOhFp9Piuj9zM3RQvTqQJzd+X3IIVzRf0MNx0WS1?= =?us-ascii?Q?OgcLWLry5zdML9DT/sA5M/qf6MgA6iryPp9KYKxa4M/hhdTjPNBWfGGsIXgb?= =?us-ascii?Q?lZHemDqUBxMJwd25dAWiAYxsGe4V0MlUW2ONUYiiUPoNyz79YKJRIGvaO8tq?= =?us-ascii?Q?dagz0X19xTGagkNa5vkOI1xtd4DQucH+x2PYnegH88tIhHBnfzg+tidKJLKs?= =?us-ascii?Q?lLs8LxT0+CV7WQ8A9pmmdnmajna4++B0wGVAmuVEof0I+zALj9pu8zQdGH87?= =?us-ascii?Q?PM0EMhTeCmGvu5yhcmx6ZQEsDsOsJaMhL8F2PBa75tallGwlA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roblbmiHOwWiCyGQozUsSgHRymunoEiFxdGrmG1rF45dxcFQ== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2015 17:12:51.3063 (UTC) X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.18]; Helo=[p-emfe01b-sac.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0501MB1384 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:13:01 -0000 Hi Bryan > >> It makes me wonder if there's bigger architectural issues here that need > >> addressing with session and login. Perhaps login -f is just a special > >> case though. As others have indicated your use of 'login -f' is "unexpected". > Well, none of that is documented or its use discouraged. It has been People document what they expect others need to know - and that is framed by their own expectations of usage. Thus lack of a documented admonition against every possible usage, does not constitute a guarantee of support. When eventually someone uses something in an "unexpected" way, and encounters problems, there are basically three options. 1/ document that that should not be done, or that problems may arise 2/ prevent it being done 3/ make it work > And actually, 'su -l' NOT calling setlogin(2) is another surprise. I > have used 'login -f' precisely because it simulates a real login and > sets up the environment as the user. If I am dropping into a user's > shell I expect things like 'mail' to have their FROM not root or > wherever I came from in my session. Masquerading as another user to that extent, sounds somewhat disturbing actually, and not something that should really be optimized for. So I'd guess in this case that #1 is the correct option. From owner-freebsd-arch@freebsd.org Sat Oct 3 17:28:04 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 598CCA0FE0C for ; Sat, 3 Oct 2015 17:28:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 3DB5F1012; Sat, 3 Oct 2015 17:28:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 3692315B1; Sat, 3 Oct 2015 17:28:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id DBA9B14610; Sat, 3 Oct 2015 17:28:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id ec_H4RP1IAbE; Sat, 3 Oct 2015 17:28:01 +0000 (UTC) Subject: Re: login -f changing session getlogin(2) DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 9FD7714602 To: "Simon J. Gerraty" References: <560D826D.7000302@FreeBSD.org> <20151001203436.GA22737@stack.nl> <560DAD6D.7050007@FreeBSD.org> <28007.1443892369@chaos> Cc: Jilles Tjoelker , freebsd-arch@freebsd.org From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <56101026.7060206@FreeBSD.org> Date: Sat, 3 Oct 2015 10:28:06 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <28007.1443892369@chaos> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nkGgVw4RAIAwg0A75rEiDIW8A5Ww39wpH" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:28:04 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --nkGgVw4RAIAwg0A75rEiDIW8A5Ww39wpH Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 10/3/2015 10:12 AM, Simon J. Gerraty wrote: > Hi Bryan >=20 >>>> It makes me wonder if there's bigger architectural issues here that = need >>>> addressing with session and login. Perhaps login -f is just a specia= l >>>> case though. >=20 > As others have indicated your use of 'login -f' is "unexpected". >=20 >> Well, none of that is documented or its use discouraged. It has been >=20 > People document what they expect others need to know - and that is > framed by their own expectations of usage. > Thus lack of a documented admonition against every possible usage, does= > not constitute a guarantee of support. >=20 > When eventually someone uses something in an "unexpected" way, > and encounters problems, there are basically three options. >=20 > 1/ document that that should not be done, or that problems may arise >=20 > 2/ prevent it being done >=20 > 3/ make it work >=20 >> And actually, 'su -l' NOT calling setlogin(2) is another surprise. I >> have used 'login -f' precisely because it simulates a real login and >> sets up the environment as the user. If I am dropping into a user's >> shell I expect things like 'mail' to have their FROM not root or >> wherever I came from in my session. >=20 > Masquerading as another user to that extent, sounds somewhat disturbing= > actually, and not something that should really be optimized for. >=20 > So I'd guess in this case that #1 is the correct option. >=20 This still ignores that 'su -l' does the opposite. Sometimes sysadmins need to masquerade as users for support. Having a user hand over their SSH password, or adding a password to a service user that should NOT have remote access, is not the answer. There needs to be a way to login fully as a user for debugging issues as that user. --=20 Regards, Bryan Drewery --nkGgVw4RAIAwg0A75rEiDIW8A5Ww39wpH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJWEBAmAAoJEDXXcbtuRpfPQIcH/3uaBz3eumhuewPLDyxEDIjc gPaFyXy9ALSjMIvbI8n0MN2HG15sNC4IXhnLW2daONlp9LR3m43pOOvE5PjWk585 1mkIYNKNQ8p+GDUbZexaBxtTReSXM5RmUypYk9Hm3A5SfSs85wCXuyL9/HX8XzTP 1KCIyCDjx7bO8KJiTs87yNaiFar/FfrY1rm/PxhLiIx6vJSjnZziQ8FgsL/jzrCR va/mnBXx42ipp5MBLxfuz1xXmn6eUZmkJXnFrpRaWy3gFCxKuCdMFueLhzqQvzOs 7I9p06Rl0uYJvTTMc+6oGgmIWfEdKDBl02N24ncatYMISRViswXOIGvOyF2ytrg= =LQl1 -----END PGP SIGNATURE----- --nkGgVw4RAIAwg0A75rEiDIW8A5Ww39wpH-- From owner-freebsd-arch@freebsd.org Sat Oct 3 19:52:10 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2BDBA0F9C1 for ; Sat, 3 Oct 2015 19:52:10 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bbn0108.outbound.protection.outlook.com [157.56.111.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2047F1D54; Sat, 3 Oct 2015 19:52:09 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from BY2PR05CA049.namprd05.prod.outlook.com (10.141.250.39) by BLUPR05MB054.namprd05.prod.outlook.com (10.255.210.149) with Microsoft SMTP Server (TLS) id 15.1.286.20; Sat, 3 Oct 2015 19:52:01 +0000 Received: from BY2FFO11FD050.protection.gbl (2a01:111:f400:7c0c::162) by BY2PR05CA049.outlook.office365.com (2a01:111:e400:2c5f::39) with Microsoft SMTP Server (TLS) id 15.1.286.20 via Frontend Transport; Sat, 3 Oct 2015 19:52:00 +0000 Authentication-Results: spf=softfail (sender IP is 66.129.239.18) smtp.mailfrom=juniper.net; FreeBSD.org; dkim=none (message not signed) header.d=none;FreeBSD.org; dmarc=none action=none header.from=juniper.net; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.18 as permitted sender) Received: from p-emfe01b-sac.jnpr.net (66.129.239.18) by BY2FFO11FD050.mail.protection.outlook.com (10.1.15.187) with Microsoft SMTP Server (TLS) id 15.1.274.4 via Frontend Transport; Sat, 3 Oct 2015 19:51:59 +0000 Received: from magenta.juniper.net (172.17.27.123) by p-emfe01b-sac.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Sat, 3 Oct 2015 12:51:49 -0700 Received: from chaos.jnpr.net (chaos.jnpr.net [172.21.16.28]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id t93JpHD47379; Sat, 3 Oct 2015 12:51:17 -0700 (PDT) (envelope-from sjg@juniper.net) Received: from chaos (localhost [IPv6:::1]) by chaos.jnpr.net (Postfix) with ESMTP id A9D1A580A9; Sat, 3 Oct 2015 12:51:17 -0700 (PDT) To: Bryan Drewery CC: Jilles Tjoelker , , Subject: Re: login -f changing session getlogin(2) In-Reply-To: <56101026.7060206@FreeBSD.org> References: <560D826D.7000302@FreeBSD.org> <20151001203436.GA22737@stack.nl> <560DAD6D.7050007@FreeBSD.org> <28007.1443892369@chaos> <56101026.7060206@FreeBSD.org> Comments: In-reply-to: Bryan Drewery message dated "Sat, 03 Oct 2015 10:28:06 -0700." From: "Simon J. Gerraty" X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 24.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1039.1443901877.1@chaos> Date: Sat, 3 Oct 2015 12:51:17 -0700 Message-ID: <16315.1443901877@chaos> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD050; 1:9QcokQo7kL3ygAtUZVvxXe6oB5YQx+fMy14EP/NuyBVh4Rgi9YHZCOxVZERpgbUbKoEDRWT72cEQBKL1jpsMMZ5BQJIRcm9KnRztYDeEhEk1vknBSvs/DLnMZfxhyspdNDtal/g3ho+Cfndrw19dG6OTt0W7qa/N9kGisGoDVAC09xmCxOavrMUPt7GarQGAbrqbhEhlBettiLxAWgVZ4ac9gqfUogP3QMjO7q4FIM1oB7+iorERZGB9sk+aBUqP1FviUp0a17djn2SQcek7AGLM5Qp6N5M0jrr25TFABHRPT0abDdSgZizFeazA/Q4IajL6axp83NvudM3drSNlfw== X-Forefront-Antispam-Report: CIP:66.129.239.18; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(24454002)(189002)(199003)(86362001)(87936001)(2950100001)(64706001)(97756001)(50226001)(23726002)(50466002)(117636001)(50986999)(19580405001)(76176999)(47776003)(69596002)(92566002)(19580395003)(5001960100002)(551544002)(107886002)(77156002)(76506005)(57986006)(110136002)(105596002)(106466001)(62966003)(5008740100001)(33716001)(46102003)(77096005)(93886004)(97736004)(81156007)(6806005)(4001540100001)(5001860100001)(68736005)(5001830100001)(5007970100001)(189998001)(46406003)(4001430100001)(42262002)(62816006); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR05MB054; H:p-emfe01b-sac.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB054; 2:E7zmHG+sJzWshFWelE/Ka+9dHCw160aGqzitj0xbFCZPvGPpf53wjUQyzqHYvzSOzGhHG2suirIm4F+GkPo1YdMUdcj/NZMt7cqvQdsb8oDnLTbdUkF8cCEWouZBmGR16mc74E3XQ+4uxEQyUbpNF0fIt+/63WSDMZ4bBJA58ak=; 3:MwfHrY8+2b7mF8fdIDtV/BMgcjhkTkujXNlPbtaKEEAeMiWJcU1l7qM+x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JuOqx6daQPjeicqmj4WLMd5Ya01/J6k+De0B+kD1ANjlTraqC1O2ixUG1GiyNc/K+ODl0wba2WmL8BbcrRYBJ/YGrmpLPpT0oqeQ4bilbgroxmEr22OzSWR82eQFBJ4ev0UDja2JFUK4X73BE45Z059iZJCSDFjWg4ptcIpXfH3HLg1bL4oXGQzlFKsF3t1TEYACEPB3upcF6+sGNcG2ddYnhrugkQBlNZAeiQqm/wlHBct8Z6EcowN6uxmuwei2AO+0lVmWGfSRjSGz3CTGWyCz8hURF/2ODiHTcQOT1Tb2vh6g2GuoLdT76SlFuhF2Llp+RV3bVYx2KF6RG1WgzlYo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(3002001); SRVR:BLUPR05MB054; BCL:0; PCL:0; RULEID:; SRVR:BLUPR05MB054; X-Forefront-PRVS: 0718908305 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB054; 23:UKXuJ+6fvSJCUjkRXMcrl8TEaxkRZUD4my4aReEQvg?= =?us-ascii?Q?/0CNtxviiYZzd3x+TkJwqK8feu9CbrqgjYW3P/WApYP2gZZpYylUeqVhqQJ5?= =?us-ascii?Q?BWY/zWKPD/bdUf9Ysgdtar32RxZ6GnarjNfKa5RI6Bs4nf3KxRXgO/X7fnIh?= =?us-ascii?Q?une9EL+z8qnRMfFhNlJUHvlXvVLrRqVwptEnjzQ+2RFDwfnvmbWRZfxC2K6/?= =?us-ascii?Q?KjZmuUTdiGSJI1m0qj92Nv+KkpJo6e/Up3f9t2bI3s1NBWrFXjZ4OlazXXc4?= =?us-ascii?Q?p6HSbucCqYgfVv6bJ7M/VDHXuAJrDB1PjoQbp1q0x3y3WA+mQIuSUuyi8LCi?= =?us-ascii?Q?qwkQFOMVHDkZ/mOHq1xNPHlp9PNLeohGlfAe/2It9/fEKSEc+iN8gAOhrxqe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r5p67XDyOm97QHru9BB3Oc/mP5Z6X?= =?us-ascii?Q?5/MTmVO7VNlV+9eCe76DE=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB054; 5:Zn8bQEV40rwmjmlFkZYdSk4pBVRpWjtST+bb+gSUby+SxuV9MCE6EQ2E826QQ/zWq1mUkyKf8Ighxc3CcRfxPkby2IYMXHZRUs4iga1xOGTyTRbA52N0hR6U12Vgcz3axh7yCCRjdKGzm7LTPS82Vg==; 24:pIPV32q7ACsDVVqGvFN6Pt4bK6WY34JJlZo31GTXaCHS5+QJMDtX4ZbqpjpZvGl19mUDOKf2rERbndFn2ZcqhuVNEoVjvAg3w6KRmKQIsfk=; 20:1M6hCIgH/QrT5jPPaklnq5LZBn9I1IizmsUXRXachQW0cCWMB+DsAnfBdHLkNjAXNDnA1RzkuduV/huqzv6LIw== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2015 19:51:59.9996 (UTC) X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.18]; Helo=[p-emfe01b-sac.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB054 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 19:52:10 -0000 Bryan Drewery wrote: > This still ignores that 'su -l' does the opposite. The opposite of what? fwiw I'm not sure I'd want su - calling setlogin() but then I'm never trying to really masquerade as someone else to the extent that would matter. > Sometimes sysadmins need to masquerade as users for support. Having a > user hand over their SSH password, or adding a password to a service > user that should NOT have remote access, is not the answer. There needs > to be a way to login fully as a user for debugging issues as that user. There are many ways to skin that cat (eg append your pub key to their .ssh/authorized_keys) The easiest is to just use 'login -f' as you are doing, and when finished logout completely. I don't think anyone said you cannot use 'login -f', just that your use isn't what it was intended for. Adding a BUG/NOTE to the man page to warn anyone using it in this way to fully logout afterwards is a simple "solution". From owner-freebsd-arch@freebsd.org Sat Oct 3 20:14:35 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D76FA0EA82 for ; Sat, 3 Oct 2015 20:14:35 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 227681868; Sat, 3 Oct 2015 20:14:35 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 1A1E5132A; Sat, 3 Oct 2015 20:14:35 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id B9A7714B19; Sat, 3 Oct 2015 20:14:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id FtnhYrHvqvsA; Sat, 3 Oct 2015 20:14:27 +0000 (UTC) Subject: Re: login -f changing session getlogin(2) DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com C235D14B12 To: "Simon J. Gerraty" References: <560D826D.7000302@FreeBSD.org> <20151001203436.GA22737@stack.nl> <560DAD6D.7050007@FreeBSD.org> <28007.1443892369@chaos> <56101026.7060206@FreeBSD.org> <16315.1443901877@chaos> Cc: Jilles Tjoelker , freebsd-arch@FreeBSD.org From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <56103728.5060008@FreeBSD.org> Date: Sat, 3 Oct 2015 13:14:32 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <16315.1443901877@chaos> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tUNxucJfQ7HSpul61VGCumJ8gE7rgAJ1q" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 20:14:35 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tUNxucJfQ7HSpul61VGCumJ8gE7rgAJ1q Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 10/3/2015 12:51 PM, Simon J. Gerraty wrote: > Bryan Drewery wrote: >> This still ignores that 'su -l' does the opposite. >=20 > The opposite of what? > fwiw I'm not sure I'd want su - calling setlogin() > but then I'm never trying to really masquerade as someone else to the > extent that would matter. I said this in another mail. su -l does not change logname, so things like 'mail' send the mail as 'root' rather than the user. su.1 claims to set USER to the target user. It does, but lacking the documentation for a kernel implementation detail of logname it does not convey that setting USER is not the full story. So both login and su have unexpected behavior no matter how you look at i= t. >=20 >> Sometimes sysadmins need to masquerade as users for support. Having a >> user hand over their SSH password, or adding a password to a service >> user that should NOT have remote access, is not the answer. There nee= ds >> to be a way to login fully as a user for debugging issues as that user= =2E >=20 > There are many ways to skin that cat (eg append your pub key to their > .ssh/authorized_keys) > The easiest is to just use 'login -f' as you are doing, and when > finished logout completely. Why does SSH need to even be involved here? This is what I mean by bigger issues. --=20 Regards, Bryan Drewery --tUNxucJfQ7HSpul61VGCumJ8gE7rgAJ1q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJWEDcoAAoJEDXXcbtuRpfPnWgH/R7hl/zFj+yKotIaTB+GYAhT nt6o2rsW/9rpsvNXSrBcHds3c5jA9vUZNUANju6j8TueHpgDsKnaowcEnhwQpKNd O26onp7ZfFtPeHoa8uG+AsEZj/YR8nFLuHD6WzLGdzh5l5nygmj3S2CBwOVFph6a lPuSbIVRqDKqTUovgnEhJNZzTnMA1wGLgKt82EKjiW+JAe5mCeXgjFFcElKWndoF VmgT2PkS0Rlzo4WflHffXzp7MycCWAsY9u27DH/WVrF9B+vOaWDVmrcWSyrBRqJ7 tJv+vryRsFXVkYDQ18RX1FviFcyz0wnr+BaIV/jLT3gOvZyPnTIkRAdccwaDXzU= =vigG -----END PGP SIGNATURE----- --tUNxucJfQ7HSpul61VGCumJ8gE7rgAJ1q-- From owner-freebsd-arch@freebsd.org Sat Oct 3 21:09:01 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88BD6A0F52E for ; Sat, 3 Oct 2015 21:09:01 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 55A771A12; Sat, 3 Oct 2015 21:09:01 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id A3E6DB801F; Sat, 3 Oct 2015 23:08:57 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 8D84628494; Sat, 3 Oct 2015 23:08:57 +0200 (CEST) Date: Sat, 3 Oct 2015 23:08:57 +0200 From: Jilles Tjoelker To: Bryan Drewery Cc: freebsd-arch@FreeBSD.org Subject: Re: login -f changing session getlogin(2) Message-ID: <20151003210857.GA57303@stack.nl> References: <560D826D.7000302@FreeBSD.org> <20151001203436.GA22737@stack.nl> <560DAD6D.7050007@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <560DAD6D.7050007@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 21:09:01 -0000 On Thu, Oct 01, 2015 at 03:02:21PM -0700, Bryan Drewery wrote: > Can't we use something like forkpty(3) for the child to avoid the issues > you mention? It calls setsid(2) via login_tty(3). This would make sense for a special impersonation tool or for a paranoid version of su, but not for a normal login. You can do this right now using script(1), for example script /dev/null login -f SOMEUSER -- Jilles Tjoelker