__ungleich_nftables/manifest

53 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

initscript="$__type/files/nftables-init"
os=$(cat $__global/explorer/os)
os_version=$(cat "$__global/explorer/os_version")
2022-02-03 19:56:51 +00:00
conf=/etc/nftables.nft
2018-07-08 19:09:54 +00:00
if [ -f "$__object/parameter/config-from-stdin" ]; then
2018-07-08 19:02:03 +00:00
srcfile="$__object/stdin"
else
if [ ! -f "$__object/parameter/config" ]; then
echo "Need either config-from-stdin or config" >&2
exit 1
fi
2018-07-08 19:08:28 +00:00
config=$(cat "$__object/parameter/config")
2018-07-08 19:02:03 +00:00
srcfile="$__files/nftables/${config}.conf"
if [ ! -f "$srcfile" ]; then
echo "No such config ${config}. Aborting." >&2
exit 1
fi
fi
2021-06-22 20:29:12 +00:00
MONITORING_HOSTS="emonitor1.place5.ungleich.ch, emonitor1.place6.ungleich.ch, emonitor1.place7.ungleich.ch, emonitor1.place12.ungleich.ch, server1.place4.ungleich.ch, monitoring-v3.ungleich.ch"
mkdir "$__object/files"
srctmp="$__object/files/nftables.nft"
sed "s/MONITORING_HOSTS/$MONITORING_HOSTS/" "${srcfile}" > "$srctmp"
__package nftables
__file ${conf} --source "$srctmp" --mode 0644
case $os in
# Alpine actually has an init script, as opposed to everyone else
alpine)
:
;;
2020-08-13 17:01:19 +00:00
debian|devuan|ubuntu)
__file /etc/init.d/nftables --source "$initscript" --mode 0755
;;
*)
echo "Unsupported os: $os" >&2
exit 1
;;
esac
require="__package/nftables" __start_on_boot nftables