From owner-freebsd-questions@freebsd.org Thu Dec 24 16:22:18 2020 Return-Path: Delivered-To: freebsd-questions@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 DC2994C9ED8 for ; Thu, 24 Dec 2020 16:22:18 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from mailout.qeng-ho.org (mailout.qeng-ho.org [217.155.128.244]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4D1wMY6m4Pz4kHx for ; Thu, 24 Dec 2020 16:22:17 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from arthur.home.qeng-ho.org (unknown [IPv6:2a02:8010:64c9:1::2]) by mailout.qeng-ho.org (Postfix) with ESMTP id 73D51341F4; Thu, 24 Dec 2020 16:22:16 +0000 (GMT) Subject: Re: Network namespaces in FreeBSD To: Ihor Antonov , freebsd-questions@freebsd.org References: <20201223182227.da6c11d3604eb07bb4f18ce5@sohara.org> <2581038e-fa0f-231d-ae33-1b42d50c8600@antonovs.family> <25fbf315-7aec-853c-cf69-a805805bd06e@antonovs.family> From: Arthur Chance Message-ID: <9a80d70b-3f37-09ac-825f-c87e2c3e4925@qeng-ho.org> Date: Thu, 24 Dec 2020 16:22:14 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <25fbf315-7aec-853c-cf69-a805805bd06e@antonovs.family> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D1wMY6m4Pz4kHx X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@qeng-ho.org designates 217.155.128.244 as permitted sender) smtp.mailfrom=freebsd@qeng-ho.org X-Spamd-Result: default: False [-3.30 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[217.155.128.244:from]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:217.155.128.240/29]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[qeng-ho.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; SPAMHAUS_ZRD(0.00)[217.155.128.244:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:13037, ipnet:217.155.0.0/16, country:GB]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[freebsd-questions]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2020 16:22:19 -0000 On 24/12/2020 16:14, Ihor Antonov wrote: > On 12/24/20 1:07 AM, Arthur Chance wrote: >> On 23/12/2020 18:40, Ihor Antonov wrote: >>> On 12/23/20 10:32 AM, Kristof Provost wrote: >>>> On 23 Dec 2020, at 19:22, Steve O'Hara-Smith wrote: >>>>> On Wed, 23 Dec 2020 16:48:11 +0000 >>>>> Ameya Deshpande via freebsd-questions >>>>> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I am new to FreeBSD. I was wondering if there is concept like Network >>>>>> Namespaces in FreeBSD, like it is in Linux? >>>>> >>>>>      There is something similar see man setfib for details. >>>>> >>>> I’ve only briefly played with linux network namespaces, but aren’t >>>> vnet jails much closer to that? >>> >>> I have more experience with Linux than with FreeBSD, so I don't know for >>> sure what setfib is about. >>> >>> VNET jails is the closest thing that comes to mind when comparing to >>> Linux network namespaces. Unlike Linux, in a jail you will get all other >>> namespaces separated too (e.g. mount, pid etc.) >>> >>> Unfortunately I don't know if it is possible to get exactly same >>> behavior as in Linux - share all other namespaces except for network >>> stack. I imagine you can get something like this with Capsicum, but it >>> would require making changes to the app. >> >> Wouldn't a VNET jail rooted at / effectively be that? >> > > Last time I played with jails setting jail's root to '/' was not allowed > for some reason. I don't remember exact error message though. I think that must have changed. Using a jail rooted at / used to be the recommended way of preventing rpcbind's wildcard listen from being a security loophole. I do remember that you can't nullfs mount / under itself. > I remember that I ended up null-mounting every directory in / (like bin, > sbin, etc,) to jail's root directory, and that was quite painful to do > manually. I'm increasingly thinking that the file system layout needs a rethink to be able to handle jails and minimal app style devices like firewalls. Sadly inertia (and standards) will prevent that from happening. -- The number of people predicting the demise of Moore's Law doubles every 18 months.