Files
cs-firewall-bouncer/debian/crowdsec-firewall-bouncer-iptables.postinst
2023-04-24 22:54:15 +02:00

26 lines
607 B
Bash
Executable File

#!/bin/sh
systemctl daemon-reload
#shellcheck source=./scripts/_bouncer.sh
. "/usr/lib/$DPKG_MAINTSCRIPT_PACKAGE/_bouncer.sh"
START=1
if [ "$1" = "configure" ]; then
if need_api_key; then
if ! set_api_key; then
START=0
fi
fi
fi
systemctl --quiet is-enabled "$SERVICE" || systemctl unmask "$SERVICE" && systemctl enable "$SERVICE"
set_local_port
if [ "$START" -eq 0 ]; then
echo "no api key was generated, you can generate one on your LAPI server by running 'cscli bouncers add <bouncer_name>' and add it to '$CONFIG'" >&2
else
systemctl start "$SERVICE"
fi