Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debian 11 (bullseye) - crowdsec-nginx-bouncer (0.0.7) - missing envsubst #16

Closed
erdoukki opened this issue Sep 22, 2021 · 2 comments · Fixed by #18
Closed

Debian 11 (bullseye) - crowdsec-nginx-bouncer (0.0.7) - missing envsubst #16

erdoukki opened this issue Sep 22, 2021 · 2 comments · Fixed by #18

Comments

@erdoukki
Copy link

sudo apt install crowdsec-nginx-bouncer

...
Setting up crowdsec-nginx-bouncer (0.0.7) ...
cscli is /usr/bin/cscli
cscli/crowdsec is present, generating API key
API Key : f8f59946a13b3a6f0f69f41e9a5289ef
/var/lib/dpkg/info/crowdsec-nginx-bouncer.postinst: 26: envsubst: not found
Restart nginx to enable the crowdsec bouncer : systemctl restart nginx
...

Some verifications:

admin@myREVERSE:~$ cat /etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf 

envsubst is missing from Debian !

Some possible workarounds and/or resolutions:

  1. gettext-base dependencie
admin@myREVERSE:~$ sudo apt install gettext-base
admin@myREVERSE:~$ envsubst --version
envsubst (GNU gettext-runtime) 0.21
Copyright (C) 2003-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Bruno Haible.
  1. envsubst in go
    https://github.com/a8m/envsubst
    It is the planned solution for OpenWrt...
    PR porposed envsubst: initial package v1.2.0 openwrt/packages#16664

  2. replace envsubst with sed patterns
    It is the actual workaround used in Crowdsec PR for OpenWrt

## Gen&ConfigApiKey
SUFFIX=`tr -dc A-Za-z0-9 </dev/urandom | head -c 8`
API_KEY=`/usr/bin/cscli bouncers add cs-firewall-bouncer-${SUFFIX} -o raw`
sed -i "s,^\(\s*api_key\s*:\s*\).*\$,\1$API_KEY," $CONFIG

and

 	sed -i "s,^\(\s*mode\s*:\s*\).*\$,\1$BACKEND," $VARCONFIG

from : https://github.com/openwrt/packages/pull/16244/files

@erdoukki
Copy link
Author

For (more) information:
sudo dpkg-reconfigure crowdsec-nginx-bouncer
do not help to fix
sudo apt install crowdsec-nginx-bouncer --reinstall
do not help to fix

sudo apt purge crowdsec-nginx-bouncer
sudo apt install crowdsec-nginx-bouncer

fixed the installation (with envsubst added manually by sudo apt install gettext-base)

admin@myREVERSE:~$ cat /etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf 
API_URL=http://127.0.0.1:8080
API_KEY= 2aa9ca638b5eeec97cff173c42a9cb8b
LOG_FILE=/var/log/crowdsec_lua_bouncer.log
LOG_LEVEL=INFO
CACHE_EXPIRATION=1
CACHE_SIZE=1000

@buixor
Copy link
Contributor

buixor commented Sep 22, 2021

Hello @erdoukki !

Seen the issue, nice spotting.
Adding it to the deps right now 👍

@erdoukki erdoukki changed the title Debian 11 (bulleyes) - crowdsec-nginx-bouncer (0.0.7) - missing envsubst Debian 11 (bullseye) - crowdsec-nginx-bouncer (0.0.7) - missing envsubst Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants