在 pf.conf 中使用类似“include”的语句来包含来自其他文件的某些部分

在 pf.conf 中使用类似“include”的语句来包含来自其他文件的某些部分

我希望能够从其他文件集中包含我的 pf.conf 的某些部分。

例如,我将在另一个文件中包括“set timeout”与类似的语句。

使用锚点和“从文件加载锚点”语句不会有帮助,因为锚点不能容纳这样的全局选项。

答案1

一种方法是使用米4作为生成最终 pf.conf 的预处理器。或者,您甚至可以将 pf.conf 分成几部分,然后让简单的“预处理器” cat 这些部分 > /etc/pf.conf。

答案2

根据 pf.conf 手册页:

Comments can be put anywhere in the file using a hash mark (`#'), and
     extend to the end of the current line.  Additional configuration files
     can be included with the include keyword, for example:

       include "/etc/pf/sub.filter.conf"

来源:https://www.freebsd.org/cgi/man.cgi?query=pf.conf&apropos=0&sektion=0&manpath=FreeBSD+9.0-RELEASE

相关内容