From owner-freebsd-jail@freebsd.org Sun Nov 29 14:58:18 2020 Return-Path: Delivered-To: freebsd-jail@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38AE94A4B28 for ; Sun, 29 Nov 2020 14:58:18 +0000 (UTC) (envelope-from me+freebsd@igalic.co) Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) (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 "protonmail.com", Issuer "SwissSign Server Gold CA 2014 - G22" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkWh82bSLz4kNb for ; Sun, 29 Nov 2020 14:58:15 +0000 (UTC) (envelope-from me+freebsd@igalic.co) Date: Sun, 29 Nov 2020 14:57:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igalic.co; s=protonmail2; t=1606661886; bh=bfbbYAibQBEsl2/vfHO6Scqu4dvvru/NjynuEq01R4c=; h=Date:To:From:Reply-To:Subject:From; b=BahEciGQYz5czLxnsEJugQC1IyJDBg1CAn4Uf0ygRnHJCvbpplsfxB1cR1ZukCQFW Vv+quGIdX20e6uKnxQDIl0ayla0QsX4tqhYiGor+2bXYu2y94JKlPSb5uSmxHASrH1 CR3OxqW4GworqcrRr6HHzDWq3swFxeG62hoZiO9Q8bUYm+Bi/9CG0aVDZNEDL6aaf2 buzy30FWoWpKvOSwlwFxIaMfZ+qCCVEtKaShH3hG092c7CWXjET+ZCMLGIoecms0XP LJ7GpjnXf3GS8/b0y2fOgPB183I33UAhk3zbxgIjlMa9Qa8HgWUqJjZ9Z+MP2g/sG/ Hose/it4UgNdA== To: freebsd-jail From: =?utf-8?Q?Mina_Gali=C4=87?= Reply-To: =?utf-8?Q?Mina_Gali=C4=87?= Subject: logging to the host's syslog Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch X-Rspamd-Queue-Id: 4CkWh82bSLz4kNb X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=igalic.co header.s=protonmail2 header.b=BahEciGQ; dmarc=none; spf=pass (mx1.freebsd.org: domain of me@igalic.co designates 185.70.40.134 as permitted sender) smtp.mailfrom=me@igalic.co X-Spamd-Result: default: False [-0.69 / 15.00]; HAS_REPLYTO(0.00)[me+freebsd@igalic.co]; R_SPF_ALLOW(-0.20)[+ip4:185.70.40.0/24]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[igalic.co:+]; MIME_BASE64_TEXT(0.10)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[185.70.40.134:from]; R_MIXED_CHARSET(0.71)[subject]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[freebsd]; ASN(0.00)[asn:62371, ipnet:185.70.40.0/24, country:CH]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[igalic.co:s=protonmail2]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[me]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; HAS_PHPMAILER_SIG(0.00)[]; DMARC_NA(0.00)[igalic.co]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[185.70.40.134:from:127.0.2.255]; NEURAL_SPAM_SHORT(1.00)[0.995]; NEURAL_HAM_LONG(-1.00)[-1.000]; RWL_MAILSPIKE_POSSIBLE(0.00)[185.70.40.134:from]; MAILMAN_DEST(0.00)[freebsd-jail] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 14:58:18 -0000 SGkgZm9sa3MsCgppIGNyZWF0ZWQgYSBwYXRjaCBmb3IgcmV2aWV3IGhlcmUgaHR0cHM6Ly9yZXZp ZXdzLmZyZWVic2Qub3JnL0QyNzQxMQp0byBidWlsZCBvbiB0b3Agb2Ygc3lzbG9nZCdzIGFsdGxv Z19wcm9nbGlzdCBhbmQgYWRkIGFsdGxvZ19qYWlsbGlzdCwgd2hpY2ggcHV0cyBhIGxvZyBhbmQg bG9ncHJpdiBzb2NrZXQgaW50byB0aGUgbGlzdGVkIGphaWxzJyAicGF0aCIgaW4gdmFyL3J1bi8K CnR3byBjYXZlYXRzOgoKLSBqdXN0IGxpa2UgYWx0bG9nX3Byb2dsaXN0LCB0aGlzIGlzbid0IGRv Y3VtZW50ZWQgeWV0LiBpIHRoaW5rIHN5c2xvZ2QoOCkgd291bGQgYmUgdGhlIGFwcHJvcHJpYXRl IHBsYWNlLCBidXQgaSB3b25kZXIgaG93IHdlIGNhbiBpbmNyZWFzZSB0aGUgY2hhbmNlIG9mIGJl aW5nIGRpc2NvdmVyZWQKCi0gdGhpcyB3aWxsIHJlcXVpcmUgYSByZXN0YXJ0IG9mIHN5c2xvZ2Qg YXQganVzdCB0aGUgcmlnaHQgdGltZSwgYW5kIGkgZG9uJ3Qga25vdyB3aGF0IHRoZSByaWdodCB0 aW1lIGlzIChhbmQgd2hlcmUgdG8gcHV0IHRoYXQgaW5mbykKCk1pbmEgR2FsacSHCgpXZWI6IGh0 dHBzOi8vaWdhbGljLmNvLw== From owner-freebsd-jail@freebsd.org Sun Nov 29 15:34:00 2020 Return-Path: Delivered-To: freebsd-jail@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3AEEF4A5693; Sun, 29 Nov 2020 15:34:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkXTN15Zbz4m7r; Sun, 29 Nov 2020 15:34:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 137BD24563; Sun, 29 Nov 2020 15:34:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f181.google.com with SMTP id k4so1821686qtj.10; Sun, 29 Nov 2020 07:34:00 -0800 (PST) X-Gm-Message-State: AOAM5332+zxGyKIYu64w8dxgq8bW6bN+ggzbZb+00g6HGEND69Gwxzqk dqw0FTdFCN4kWGFM0dv31OMZ3HFf3yZKpysi3Gs= X-Google-Smtp-Source: ABdhPJwt4wWA6TB+MdFxhKXGba9zwtDkH4LTSlpJZrGx6P8qjaDA4J65koWLHyQ1WBjROcwNHz3IwSCtkfDXUFAjezw= X-Received: by 2002:ac8:5345:: with SMTP id d5mr17864902qto.60.1606664039506; Sun, 29 Nov 2020 07:33:59 -0800 (PST) MIME-Version: 1.0 References: <06F654BB-B087-4AE5-8599-E5837A85A850@FreeBSD.org> <6BA03DAD-BDCD-4A53-A80A-4B7B476B803C@FreeBSD.org> In-Reply-To: From: Kyle Evans Date: Sun, 29 Nov 2020 09:33:48 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: RFC: Jail privsets To: "Bjoern A. Zeeb" Cc: James Gritton , freebsd-jail , "freebsd-arch@freebsd.org" , trustedbsd-discuss@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 15:34:00 -0000 On Sun, Nov 29, 2020 at 6:51 AM Bjoern A. Zeeb wrote: > > On 28 Nov 2020, at 14:39, Kyle Evans wrote: > > Hi, > > Cc: jamie explicitly as he might have thoughts as well. > > > Yeah, so jail sets are a little tricky, and to be honest I haven't > > really thought about how to cope with common jail sets. The > > complication arises because you have various allow flags that > > typically default to off and turn privileges on, but your common sets > > would have to include them. So, you'd probably end up with: > > > > privset 0: All privs available to the superuser (not considering > > superuser policy just yet) > > privset 1: All privs available to jails (assuming most permissive, all > > allow flags on and assuming a new vnet on VIMAGE systems) > > > > So jails would typically inherit privset 1, but they'd have to mask > > out based on vnet/allow flags out of necessity. Now, that's not > > terrible, but I think we'd have to do a couple more things to reduce > > maintenance burden on folks introducing privs: > > > > 1.) Clearly define a central table that maps pr_flags <-> privs where > > there's a 1:1 mapping (most common, though PRIV_VFS_*MOUNT* are a > > little more complicated) > > 2.) Walk said table when we're defining privs in privset 1 > > 3.) Walk said table when we're determining what to mask out > > > > I suspect the vnet set is large enough that we'd just have a separate > > kernel-internal mask for "vnet privs". In any event, for most people, > > there will be one of three places that you might touch when adding a > > new priv flag or pr_flag mapping to a priv, but it should still be > > obvious what you want: either you want a conditionally added flag, you > > want to influence the default jail policy, or you want to change the > > vnet policy. The latter two scenarios might even be a little easier, > > because you don't need to wade through these gigantic switch > > statements with a lot of cases to determine where you really want it > > to go. > > I think this is all terribly too complicated. > > If we=E2=80=99ll have manageable fine-grained priv system, them retire al= low and > vnet checks for PRIV_* checks and be done with it. If we need new PRIV_* > checks to accomplish that adding PRIV_* is semi-cheap to add. > > The big switch statements in kern_jail.c will go as the applied priv set > will do the right thing already, which means at this point we=E2=80=99d h= ave > a base-system-privset, a classic-jail-privset, a vnet-jail-privset by > default probably. > > If we want to keep allow* in jails we can probably make them compat code > to adjust PRIV_* but I am not sure I=E2=80=99d want jail to still do that= or a > separate priv command (a la cpuset). > > Means jails become simple again and a lot of the complicate logic can > drop out. > Sure- I'm not so sure about vnet, but all of the allow flags could get deprecated in favor of describing the privs available somewhere and letting admin make decisions. I think the vnet set still makes a lot of sense unless you're also proposing that we could just create new vnets if one of those privileges is turned on -- in which case, we'd still have to manage the set, but it wouldn't be used much beyond a hint mask that we need to create a vnet. > >> And yes, that would indeed simplify our jail and network stack (and so= me > >> other) > >> code quite a bit. > >> > >> I=E2=80=99d love this (step-by-step or in whole right away) :-) > >> > > > > :-) > > > > I'm looking to see if I can define a useful abstraction from > > cpuset/domainset that would limit the amount of duplication needed for > > this, then I'll post a v2 to Phabricator. > > There=E2=80=99s probably edge cases in which managing privsets will be a = priv as > well and we=E2=80=99ll probably need multiple cases: one that can still = =E2=80=9Cwiden=E2=80=9D > priv and one that can only copy-and-further-restrict-only. The latter > probably being the default. > True enough.