From owner-freebsd-questions@freebsd.org Wed Mar 30 19:37:43 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 BB7BCAE3948 for ; Wed, 30 Mar 2016 19:37:43 +0000 (UTC) (envelope-from stdin@niklaas.eu) Received: from box.niklaas.eu (unknown [IPv6:2a00:c98:2200:af07:6::1]) by mx1.freebsd.org (Postfix) with ESMTP id 8AA9E1292 for ; Wed, 30 Mar 2016 19:37:43 +0000 (UTC) (envelope-from stdin@niklaas.eu) Received: by box.niklaas.eu (Postfix, from userid 1001) id CD91C61FA9; Wed, 30 Mar 2016 21:37:41 +0200 (CEST) Date: Wed, 30 Mar 2016 21:37:41 +0200 From: Niklaas Baudet von Gersdorff To: freebsd-questions@freebsd.org Subject: Re: Variables substitution in jail.conf Message-ID: <20160330193741.GD1256@box.niklaas.eu> Mail-Followup-To: freebsd-questions@freebsd.org References: <7fbd35d23c23fb734bc10643a06f2d78@gritton.org> <859c4fbee2fd75910dcc4b85dd2c7f8e@gritton.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <859c4fbee2fd75910dcc4b85dd2c7f8e@gritton.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2016 19:37:43 -0000 James Gritton [2016-03-30 12:57 -0600] : > Sure, you've already got some custom variables in the jail definition, > $id and $network. You can also have some on the global side. > Something like: > > $addr4 = "10.15.$network.$id"; > $addr6 = "2a00:XXX:XXXX:XXXX:X::$network:$id"; > ip4.addr = "lo1|$addr4"; > ip6.addr = "vnet0|$addr6"; > > www { > $id = 1; > $network = 1; > exec.poststart = "pfctl -t www -T add $addr4 $addr6" > exec.poststop = "pfctl -t www -T delete $addr4 $addr6" > } > > I haven't tested that, so I'm not sure it's 100% correct, but something along > those lines should work. James, thanks. It's not my dollar-sign-day today. I forgot to add a $ in front of the variables in the preamble. No wonder it wasn't working. I will try your version. I'm sure it's going to work.