Variables substitution in jail.conf

Niklaas Baudet von Gersdorff stdin at niklaas.eu
Wed Mar 30 19:37:43 UTC 2016


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.


More information about the freebsd-questions mailing list