Files
docker-nginx-full/scripts/install-crowdsec_openresty_bouncer
T
Brian Munro b98785006c Add extra check for environment variable
Fix rm command for folders.
2022-03-17 06:04:51 +02:00

29 lines
1.0 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash -e
BLUE='\E[1;34m'
CYAN='\E[1;36m'
YELLOW='\E[1;33m'
GREEN='\E[1;32m'
RED='\E[1;31m'
RESET='\E[0m'
echo -e "${BLUE} ${CYAN}Installing Crowdsec OpenResty Bouncer ${YELLOW}${CROWDSEC_OPENRESTY_BOUNCER_VERSION:-}...${RESET}"
if [ "${CROWDSEC_OPENRESTY_BOUNCER_VERSION:-}" = "" ]; then
echo -e "${RED} ERROR: CROWDSEC_OPENRESTY_BOUNCER_VERSION environment variable is not set!${RESET}"
exit 1
fi
cd /tmp
wget "https://github.com/crowdsecurity/cs-openresty-bouncer/releases/download/v${CROWDSEC_OPENRESTY_BOUNCER_VERSION}/crowdsec-openresty-bouncer.tgz"
mkdir -p /tmp/crowdsec
tar xzf crowdsec-openresty-bouncer.tgz --strip 1 -C /tmp/crowdsec
rm -rf /tmp/crowdsec-openresty-bouncer.tgz
cd /tmp/crowdsec
bash ./install.sh --NGINX_CONF_DIR=/etc/nginx/conf.d --LIB_PATH=/etc/nginx/lualib --CONFIG_PATH=/defaults/crowdsec --DATA_PATH=/defaults/crowdsec --docker
sed -i 's|ENABLED=.*|ENABLED=false|' /defaults/crowdsec/crowdsec-openresty-bouncer.conf
rm -rf /tmp/crowdsec
echo -e "${BLUE} ${GREEN}OpenResty plugins install completed${RESET}"