From owner-freebsd-questions@freebsd.org Mon Aug 8 16:10:50 2016 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 C8E13BB2E9F; Mon, 8 Aug 2016 16:10:50 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 88D9D175F; Mon, 8 Aug 2016 16:10:49 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 2D39E25D3857; Mon, 8 Aug 2016 16:10:41 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 4B4D2D1F80E; Mon, 8 Aug 2016 16:10:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id TTaw63xz81jh; Mon, 8 Aug 2016 16:10:38 +0000 (UTC) Received: from [10.248.105.13] (fresh-tun0-ula.sbone.de [IPv6:fde9:577b:c1a9:4920:2ef0:eeff:fe03:ee34]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 1050AD1F7F9; Mon, 8 Aug 2016 16:10:37 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Niklaas Baudet von Gersdorff" Cc: freebsd-questions@freebsd.org, freebsd-pf@freebsd.org Subject: Re: Firewalling jails and lo0 Date: Mon, 08 Aug 2016 16:10:36 +0000 Message-ID: <474892D3-A01C-43B2-AF07-E383CD81188E@lists.zabbadoz.net> In-Reply-To: <20160808081910.GA27370@box-hlm-03.niklaas.eu> References: <20160806155411.GA5289@len-t420.klaas> <3C1C4822-17C2-42D9-A9BE-C3549B9B6F25@lists.zabbadoz.net> <20160807082651.GA87754@box-hlm-03.niklaas.eu> <57A743A8.10005@gmail.com> <20160807152347.GA9178@len-t420.klaas> <57A76DF6.6090905@gmail.com> <20160808081910.GA27370@box-hlm-03.niklaas.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate (2.0BETAr6043) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2016 16:10:50 -0000 On 8 Aug 2016, at 8:19, Niklaas Baudet von Gersdorff wrote: > Ernie Luzar [2016-08-07 13:20 -0400] : > >>> Aha. So once I assigned those traffic from/to jails should go >>> through lo1 solely? >> >> YES. > > Thank you for clarifying that and your help. So, I attached > additional IP addresses on the jail host side accordingly: … > My issue can be reduced to the question: When using jails, to > secure network traffic as best as I can, do I have to enable the > firewall on lo0 or is enabling it on the interface they are > attached to (in my case lo1) enough? > > And: What do I need to do to restrict jails from using lo0? The problem I think is that the routes (see one of your earlier emails) for the jail loopback IP addresses are pointing to lo0 and not lo1. If you’d manually issue a route change -host -inet6 fd16:dcc0:f4cc:3::2:1 -iface lo1 Hmm probably not… root@rabbit4:~ # ifconfig lo1 create lo1: bpf attached root@rabbit4:~ # ifconfig lo1 inet6 fd16:dcc0:f4cc:3::2:1/128 alias root@rabbit4:~ # route get -inet6 fd16:dcc0:f4cc:3::2:1 route to: fd16:dcc0:f4cc:3::2:1 destination: fd16:dcc0:f4cc:3::2:1 fib: 0 interface: lo0 flags: recvpipe sendpipe ssthresh rtt,msec mtu weight expire 0 0 0 0 16384 1 0 root@rabbit4:~ # route change -host -inet6 fd16:dcc0:f4cc:3::2:1 -iface lo1 change host fd16:dcc0:f4cc:3::2:1: gateway lo1 fib 0 root@rabbit4:~ # route get -inet6 fd16:dcc0:f4cc:3::2:1 route to: fd16:dcc0:f4cc:3::2:1 destination: fd16:dcc0:f4cc:3::2:1 fib: 0 interface: lo0 flags: recvpipe sendpipe ssthresh rtt,msec mtu weight expire 0 0 0 0 16384 1 0 Still points to lo0. That is interesting. I think at this point you have to assume packets go over lo0 and firewall there. I wonder if this is a bug or a feature … /bz