mirror of
https://github.com/openwrt/packages.git
synced 2025-02-12 03:28:07 +00:00
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>
14 lines
348 B
Bash
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
|