mirror of
https://github.com/crowdsecurity/cs-firewall-bouncer.git
synced 2024-08-19 01:18:49 +03:00
26 lines
607 B
Bash
Executable File
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
|