0
0
mirror of https://github.com/openwrt/packages.git synced 2025-02-12 03:28:07 +00:00
packages/lang/lua-cs-bouncer/files/lua-cs-bouncer.defaults
Kerma Gérald 846df82a84 lua-cs-bouncer: initial package
Lua Crowdsec Bouncer module
  Lua module to allow ip (or not) from CrowdSec API.
  https://github.com/crowdsecurity/lua-cs-bouncer

  required for crowdsec-nginx-bouncer

Signed-off-by: Kerma Gérald <gandalf@gk2.net>
2022-02-14 17:26:16 -08:00

14 lines
348 B
Bash

#!/bin/sh
CONFIG=/usr/lib/lua/crowdsec/crowdsec.conf
## Gen&ConfigApiKey
if grep -q "{API_KEY}" "$CONFIG"; then
SUFFIX=`tr -dc A-Za-z0-9 </dev/urandom | head -c 8`
API_KEY=`/usr/bin/cscli bouncers add lua-cs-bouncer-${SUFFIX} -o raw`
sed -i "s,^\(\s*API_KEY\s*=\s*\).*\$,\1$API_KEY," $CONFIG
else
echo API key already registered...
fi
exit 0