Evilham
fefe90e9c9
__pf_apply the way it exists on cdist is not really useful and __pf_ruleset does not take advantage of other types as it should, being instead overly complex and not as reliable. The new __pf_ruleset is compatible with the previous one, and __pf_apply_anchors allows for a simple and powerful way of managing pf anchors. The functionality previously provided by __pf_apply is still possible out of the box in __pf_ruleset. These patches were mostly contributed by Kamila Součková and made fit for upstreaming by Evilham.
33 lines
1 KiB
Bash
Executable file
33 lines
1 KiB
Bash
Executable file
#!/bin/sh -e
|
|
#
|
|
# 2016 Kamila Součková (coding at kamila.is)
|
|
#
|
|
# This file is part of cdist.
|
|
#
|
|
# cdist is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# cdist is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
#
|
|
# Apply pf(4) ruleset on *BSD
|
|
#
|
|
|
|
ANCHORS_DIR="/etc/pf.d"
|
|
|
|
if [ -f "${__object}/parameter/anchor_name" ]; then
|
|
anchor_name="$(cat "${__object}/parameter/anchor_name")"
|
|
else
|
|
anchor_name="${__object_id}"
|
|
fi
|
|
anchor_file="${ANCHORS_DIR}/${anchor_name}"
|
|
|
|
echo "pfctl -a \"${anchor_name}\" -f \"${anchor_file}\""
|