From owner-freebsd-questions@freebsd.org Tue Jun 27 08:48:21 2017 Return-Path: Delivered-To: freebsd-questions@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 6BC62DA5018 for ; Tue, 27 Jun 2017 08:48:21 +0000 (UTC) (envelope-from alphachi@mediaspirit.org) Received: from mail-ot0-x22b.google.com (mail-ot0-x22b.google.com [IPv6:2607:f8b0:4003:c0f::22b]) (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 3004182125 for ; Tue, 27 Jun 2017 08:48:20 +0000 (UTC) (envelope-from alphachi@mediaspirit.org) Received: by mail-ot0-x22b.google.com with SMTP id u13so17382254otd.2 for ; Tue, 27 Jun 2017 01:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mediaspirit-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KDuy4212ui3/LLsZiboWQ5ZBpC9sWwGGTsjbKI3nXsI=; b=Jsvilcz/CCex7Pt+cU8Bsueaiwg6kJoy0QFrmtIoDT9rar4xoGPwde+cL8QGeiFiHZ QleuJtWcfzt6h2SlpROdKaBJh+1fTYOUmLPK41nzVgY2VWFi5scKdoohD8etWsddeTUG WnyBCzEEy1d3JlR8yCnhR6GXujlWiAWTOzoCETVGymzWN2z2yDnVb0+wK9H3PjLgauLy f5vD9i6IgNxs44zv99VlfJS7VJ+j01Z7lTCd0W75jckSSpGLljWftTtALPvPCiPu0wju aUwM7nakq3GN8zPh4fXpRSnYvaMAd2xd1bGcBjW5c/qgXgY//wj1WBag+x28FVpjltMN +Wwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KDuy4212ui3/LLsZiboWQ5ZBpC9sWwGGTsjbKI3nXsI=; b=AZZin07WCqtybvpJ+cFDYB/QfgpcsmmyqVZPZzN2ARVqAQ8at3yPFmdxMFKxnFnrd7 YtvepbUn6TqkqnTnCKyPGyWuJ8w0klacv0aNa0DQphj99l9sBd9hPBUMYmUVPywwHPDe +A2OsoUBnmmPmIU7yj9P88uhYwcffl0JgHcjhi7FXqylI55RCtlWXShbwJiRvaybRz9c pWawINSfml+25KCzHjHJ7tr8YhEmuQabb/V6lq1rkqlcaGlUU/I8IzoGbCTrd9vWNfxw kPAjCVNOkKWtgpDjngVp5hSQQMxPamdRVaeCrbbjpo/P6Zw1kB0CPaqabkPxr9B/WoGm FEVg== X-Gm-Message-State: AKS2vOz3mALxHmJnNfI6Z4io2vRxTjMTAKuAjdjuQ8aqxQchaL6QwQAD 4tYklbrseewFHG1BSW8EySpkRoFW3DoL X-Received: by 10.157.46.65 with SMTP id c1mr2884443otd.190.1498553299534; Tue, 27 Jun 2017 01:48:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.44.82 with HTTP; Tue, 27 Jun 2017 01:48:18 -0700 (PDT) Received: by 10.74.44.82 with HTTP; Tue, 27 Jun 2017 01:48:18 -0700 (PDT) In-Reply-To: <20170627081354.bf6ae28e.freebsd@edvax.de> References: <20170627081354.bf6ae28e.freebsd@edvax.de> From: alphachi Date: Tue, 27 Jun 2017 16:48:18 +0800 Message-ID: Subject: Re: security/doas can't work with zsh alias To: Polytropon Cc: "list: freebsd" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jun 2017 08:48:21 -0000 So I think the simplest approach is: run "doas -s" and stay this shell for dealing alias requirements. Any other ideas? 2017=E5=B9=B46=E6=9C=8827=E6=97=A5 14:13=EF=BC=8C"Polytropon" =E5=86=99=E9=81=93=EF=BC=9A > On Mon, 26 Jun 2017 20:25:02 +0800, alphachi wrote: > > I'm preparing to migrate to doas and the following commands are my test= : > > > > % cat /usr/local/etc/doas.conf > > permit nopass keepenv fbsd as root > > permit nopass keepenv root as root > > % id -nu > > fbsd > > % doas id -nu > > root > > % echo $SHELL > > /usr/local/bin/zsh > > % doas echo $SHELL > > /usr/local/bin/zsh > > % alias > > vi=3Dvim > > % doas alias > > % > > > > As this shows, doas doesn't know this alias, so "doas vi" can't invoke > > installed vim. > > > > Is this reasonable or just my mistake? How to enable zsh alias for doas= ? > > A possible explanation is that the subshell that executes the > "alias" (internal) command provided through doas does not inherit > the environment that stored the alias for the user shell; in > such a case, root's environment (without the alias) will be > used while the doas shell is running, that's why the "vi=3Dvim" > setting is not in that environment. > > However, that exactly seems to conflict with the "keepenv" > option provided by doas.conf, except of course aliases are > being handled independently from environmental variables > (which the "env" in "keepenv" could refer to). > > > > -- > Polytropon > Magdeburg, Germany > Happy FreeBSD user since 4.0 > Andra moi ennepe, Mousa, ... >