From nobody Tue Jun 01 01:19:28 2021 X-Original-To: ports-bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5ACA7D7F4BA for ; Tue, 1 Jun 2021 01:19:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FvDpS1sCXz3mbF for ; Tue, 1 Jun 2021 01:19:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2801B1A37B for ; Tue, 1 Jun 2021 01:19:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 1511JShu036040 for ; Tue, 1 Jun 2021 01:19:28 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1511JSW8036039 for ports-bugs@FreeBSD.org; Tue, 1 Jun 2021 01:19:28 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 256233] security/doas: target user's login class gets ignored Date: Tue, 01 Jun 2021 01:19:28 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: bugs.freebsd@scourger.nl X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: ports-bugs@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback+ X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Ports bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-ports-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports-bugs@freebsd.org X-BeenThere: freebsd-ports-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D256233 --- Comment #6 from bugs.freebsd@scourger.nl --- Calling doas with the keepenv flag should indeed keep the language settings from the caller intact. In the same vein, when a locale is explicitly provi= ded though the setenv flag, it should be used. We also seem to agree that the caller doesn't want 'unexpected' language changes. But this is where it gets murky: if no language is passed to doas (by keepe= nv or setenv), the language is going to change nonetheless. Without keepenv, I= see two possible outcomes: 1. The environment is cleared, and the command is executed using the "C" locale. This happens in the current situation (*). I'm not sure if this is = what most people would expect. 2. The language from the target user's login class gets used. This is what initially made more sense to me, because I wasn't expecting the C locale. (*) Initially, I thought it used the language defined in the default login class. In reality, it always seems to apply the C locale. Now that I have given all this a bit more thought, this whole conundrum ste= ms from the fact that specifying lang in login.conf is just a way to set a reg= ular environment variable. Conversely, doas clears virtually all environment variables by design. But some essential environment variables will allways = be set (regardless of keepenv and setenv), such as DOAS_USER, HOME, TERM, PATH= and SHELL. Now the big question is: should LANG also be in that list (i.e. considered essential)? The way it is now, you'd have to explicitly specify "setenv { LANG }" to ke= ep the caller's language or use "setenv { LANG=3Den_US.UTF-8 }" to match bob's language. When nothing is specified, you'll get the C locale. Consider if the same thing happened with HOME or SHELL. My guess is that mo= st people would argue those shouldn't be reset to the system default, but inst= ead use the target user's shell. Should or shouldn't LANG be handled in the same way as SHELL, TERM or HOME?= I'm not saying it should, but it would definitely make sense to me.=20 Another thing I noticed is that the default PATH is hardcoded in doas (on FreeBSD). I've checked how this is handled on OpenBSD, and there "doas -u b= ob printenv" yields the PATH as defined for bob's login class in /etc/login.co= nf. Do you know the reason why is's hardcoded on FreeBSD? When I look at the behaviour of the original doas on OpenBSD, it appears th= at the environment from the target login class is always applied (with the cav= eat that OpenBSD lets you specify less options in login.conf compared to FreeBS= D, "lang" being one of the missing ones). My guess is that the original design= of doas was to respect environment variables defined in login classes, except where it really doesn't make sense. Maybe is's a good idea to ask upstream about this? --=20 You are receiving this mail because: You are the assignee for the bug.=