You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
348 B

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