Skip to content

Commit b4804e6

Browse files
committed
Install Crowdsec OpenResty Bouncer directly into the docker image.
Config files and templates are saved in /defaults/crowdsec A script in the main docker image will handle deployment.
1 parent ac76802 commit b4804e6

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The following images are built:
2222
**latest**
2323
- OpenResty
2424
- Lua
25+
- [Crowdsec Openresty Bouncer](https://github.com/crowdsecurity/cs-openresty-bouncer)
2526

2627
**certbot**
2728
- Certbot

docker/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ COPY --from=nginxbuilder /tmp/openresty /tmp/openresty
7373
COPY ./scripts/install-openresty /tmp/install-openresty
7474

7575
ARG OPENRESTY_VERSION
76+
ARG CROWDSEC_OPENRESTY_BOUNCER_VERSION
7677
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
77-
OPENRESTY_VERSION=${OPENRESTY_VERSION}
78+
OPENRESTY_VERSION=${OPENRESTY_VERSION} \
79+
CROWDSEC_OPENRESTY_BOUNCER_VERSION=${CROWDSEC_OPENRESTY_BOUNCER_VERSION}
7880

7981
# Install openresty, lua, then clean up file system
8082
RUN apt-get update \

local-build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RESET='\E[0m'
99
DOCKER_IMAGE=nginxproxymanager/nginx-full
1010

1111
export OPENRESTY_VERSION=1.19.9.1
12+
export CROWDSEC_OPENRESTY_BOUNCER_VERSION=0.1.1
1213
export LUA_VERSION=5.1.5
1314
export LUAROCKS_VERSION=3.3.1
1415

@@ -18,6 +19,7 @@ echo -e "${BLUE}❯ ${CYAN}Building ${YELLOW}latest ${CYAN}...${RESET}"
1819
docker build \
1920
--pull \
2021
--build-arg OPENRESTY_VERSION \
22+
--build-arg CROWDSEC_OPENRESTY_BOUNCER_VERSION \
2123
--build-arg LUA_VERSION \
2224
--build-arg LUAROCKS_VERSION \
2325
-t ${DOCKER_IMAGE}:latest \
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash -e
2+
3+
BLUE='\E[1;34m'
4+
CYAN='\E[1;36m'
5+
YELLOW='\E[1;33m'
6+
GREEN='\E[1;32m'
7+
RESET='\E[0m'
8+
9+
echo -e "${BLUE}${CYAN}Installing Crowdsec OpenResty Bouncer ${YELLOW}${CROWDSEC_OPENRESTY_BOUNCER_VERSION}...${RESET}"
10+
11+
cd /tmp
12+
#Offical Crowdsec download location is currently blocked due to two pull requests waiting to be added for full support for Docker installs
13+
#weg "https://github.com/crowdsecurity/cs-openresty-bouncer/releases/download/v${CROWDSEC_OPENRESTY_BOUNCER_VERSION}/crowdsec-openresty-bouncer.tgz"
14+
wget "https://github.com/LePresidente/cs-openresty-bouncer/releases/download/v${CROWDSEC_OPENRESTY_BOUNCER_VERSION}/crowdsec-openresty-bouncer.tgz"
15+
mkdir -p /tmp/crowdsec
16+
tar -xzf --strip 1 crowdsec-openresty-bouncer.tgz -C /tmp/crowdsec
17+
cd /tmp/crowdsec
18+
19+
bash ./install.sh --NGINX_CONF_DIR=/etc/nginx/conf.d --LIB_PATH=/etc/nginx/lualib --CONFIG_PATH=/defaults/crowdsec --DATA_PATH=/defaults/crowdsec --docker
20+
sed-patch 's|ENABLED=.*|ENABLED=false|' /defaults/crowdsec/crowdsec-openresty-bouncer.conf
21+
22+
echo -e "${BLUE}${GREEN}OpenResty plugins install completed${RESET}"

0 commit comments

Comments
 (0)