From owner-freebsd-hackers@freebsd.org Sun Dec 16 11:15:55 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 448401322033 for ; Sun, 16 Dec 2018 11:15:55 +0000 (UTC) (envelope-from srs0=8zba=oz=vega.codepro.be=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C246983346 for ; Sun, 16 Dec 2018 11:15:54 +0000 (UTC) (envelope-from srs0=8zba=oz=vega.codepro.be=kp@codepro.be) Received: from vega.codepro.be (unknown [172.16.1.3]) by venus.codepro.be (Postfix) with ESMTP id 8BE0012909; Sun, 16 Dec 2018 12:15:46 +0100 (CET) Received: by vega.codepro.be (Postfix, from userid 1001) id 695523D1C2; Sun, 16 Dec 2018 12:15:46 +0100 (CET) Date: Sun, 16 Dec 2018 12:15:46 +0100 From: Kristof Provost To: Hubert Hauser Cc: freebsd-hackers@freebsd.org Subject: Re: Unable to open /dev/pf device inside the jail Message-ID: <20181216111545.GD49515@vega.codepro.be> References: <17e9f383-95bd-37c2-6bfe-0dc17424624f@autisticstory.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <17e9f383-95bd-37c2-6bfe-0dc17424624f@autisticstory.net> X-Checked-By-NSA: Probably User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: C246983346 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.977,0] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2018 11:15:55 -0000 On 2018-12-16 01:23:21 (+0100), Hubert Hauser wrote: > I'm trying to set TransPort setting in the torproxy jail but when I try > to start Tor inside the jail I'm giving errors: > > |root@torproxy:~ # service tor restart Stopping tor. Waiting for PIDS: > 95355. Starting tor. Dec 16 00:23:07.760 [notice] Tor 0.3.4.9 > (git-4ac3ccf2863b86e7) running on FreeBSD with Libevent 2.1.8-stable, > OpenSSL 1.0.2o-freebsd, Zlib 1.2.11, Liblzma 5.2.3, and Libzstd 1.3.5. > Dec 16 00:23:07.760 [notice] Tor can't help you if you use it wrong! > Learn how to be safe at > https://www.torproject.org/download/download#warning Dec 16 00:23:07.760 > [notice] Read configuration file "/usr/local/etc/tor/torrc". Dec 16 > 00:23:07.774 [notice] Scheduler type KISTLite has been enabled. Dec 16 > 00:23:07.774 [notice] Opening Socks listener on 127.0.1.1:9050 Dec 16 > 00:23:07.774 [notice] Opening DNS listener on 127.0.1.1:9053 Dec 16 > 00:23:07.774 [notice] Opening Transparent pf/netfilter listener on > 127.0.0.1:9040 Dec 16 00:23:07.774 [warn] open("/dev/pf") failed: No > such file or directory Dec 16 00:23:07.774 [notice] Closing > partially-constructed Socks listener on 127.0.1.1:9050 Dec 16 > 00:23:07.774 [notice] Closing partially-constructed DNS listener on > 127.0.1.1:9053 Dec 16 00:23:07.774 [notice] Closing > partially-constructed Transparent pf/netfilter listener on > 127.0.0.1:9040 Dec 16 00:23:07.775 [warn] Failed to parse/validate > config: Unable to open /dev/pf for transparent proxy. Dec 16 > 00:23:07.775 [err] Reading config failed--see warnings above. > /usr/local/etc/rc.d/tor: WARNING: failed to start tor| > > I've created this jail using ezjail-admin tool. Could anyone tell me why > I'm unable to change host pf settings and how can I do it inside the jail? > Assuming that you've got a vnet jail that is possible, but you'll need to tweak your devfs configuration to give the jail the pf device node. I edited /etc/defaults/devfs.rules to add 'add path pf unhide' to the '[devfsrules_jail=4]' section. It's probably cleaner to do that in /etc/devfs.rules though. Regards, Kristof