File tree Expand file tree Collapse file tree 7 files changed +44
-2
lines changed Expand file tree Collapse file tree 7 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ pipeline {
1616 BRANCH_LOWER = " ${ BRANCH_NAME.toLowerCase().replaceAll('/', '-')} "
1717 // Software versions; OpenResty does not support Lua >= 5.2
1818 OPENRESTY_VERSION = ' 1.19.9.1'
19+ CROWDSEC_OPENRESTY_BOUNCER_VERSION = ' 0.1.7'
1920 LUA_VERSION = ' 5.1.5'
2021 LUAROCKS_VERSION = ' 3.3.1'
2122 }
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ RUN apt-get update \
5757 tzdata \
5858 unzip \
5959 zlib1g \
60+ gettext \
61+ wget \
6062 && apt-get clean \
6163 && rm -rf /var/lib/apt/lists/* \
6264 && rm -rf /var/cache/* /var/log/* /tmp/* /var/lib/dpkg/status-old
@@ -72,16 +74,22 @@ COPY ./scripts/install-lua /tmp/install-lua
7274COPY --from=nginxbuilder /tmp/openresty /tmp/openresty
7375COPY ./scripts/install-openresty /tmp/install-openresty
7476
77+ # Copy crowdsec openresty bouncer install script
78+ COPY ./scripts/install-crowdsec_openresty_bouncer /tmp/install-crowdsec_openresty_bouncer
79+
7580ARG OPENRESTY_VERSION
81+ ARG CROWDSEC_OPENRESTY_BOUNCER_VERSION
7682ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
77- OPENRESTY_VERSION=${OPENRESTY_VERSION}
83+ OPENRESTY_VERSION=${OPENRESTY_VERSION} \
84+ CROWDSEC_OPENRESTY_BOUNCER_VERSION=${CROWDSEC_OPENRESTY_BOUNCER_VERSION}
7885
7986# Install openresty, lua, then clean up file system
8087RUN apt-get update \
8188 && apt-get install -y gcc make socat git \
8289 && /tmp/install-lua \
8390 && /tmp/install-openresty \
84- && apt-get remove -y make gcc git \
91+ && /tmp/install-crowdsec_openresty_bouncer \
92+ && apt-get remove -y make gcc git wget gettext \
8593 && apt-get autoremove -y \
8694 && apt-get clean \
8795 && rm -rf /var/lib/apt/lists/* \
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ RESET='\E[0m'
99DOCKER_IMAGE=nginxproxymanager/nginx-full
1010
1111export OPENRESTY_VERSION=1.19.9.1
12+ export CROWDSEC_OPENRESTY_BOUNCER_VERSION=0.1.7
1213export LUA_VERSION=5.1.5
1314export LUAROCKS_VERSION=3.3.1
1415
@@ -18,6 +19,7 @@ echo -e "${BLUE}❯ ${CYAN}Building ${YELLOW}latest ${CYAN}...${RESET}"
1819docker 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 \
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ docker buildx build \
2525 --build-arg OPENRESTY_VERSION \
2626 --build-arg LUA_VERSION \
2727 --build-arg LUAROCKS_VERSION \
28+ --build-arg CROWDSEC_OPENRESTY_BOUNCER_VERSION \
2829 $@ \
2930 .
3031
Original file line number Diff line number Diff line change 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+ RED=' \E[1;31m'
8+ RESET=' \E[0m'
9+
10+ echo -e " ${BLUE} ❯ ${CYAN} Installing Crowdsec OpenResty Bouncer ${YELLOW}${CROWDSEC_OPENRESTY_BOUNCER_VERSION:- } ...${RESET} "
11+
12+ if [ " ${CROWDSEC_OPENRESTY_BOUNCER_VERSION:- } " = " " ]; then
13+ echo -e " ${RED} ❯ ERROR: CROWDSEC_OPENRESTY_BOUNCER_VERSION environment variable is not set!${RESET} "
14+ exit 1
15+ fi
16+
17+ cd /tmp
18+ wget " https://github.com/crowdsecurity/cs-openresty-bouncer/releases/download/v${CROWDSEC_OPENRESTY_BOUNCER_VERSION} /crowdsec-openresty-bouncer.tgz"
19+ mkdir -p /tmp/crowdsec
20+ tar xzf crowdsec-openresty-bouncer.tgz --strip 1 -C /tmp/crowdsec
21+ rm -rf /tmp/crowdsec-openresty-bouncer.tgz
22+ cd /tmp/crowdsec
23+
24+ bash ./install.sh --NGINX_CONF_DIR=/etc/nginx/conf.d --LIB_PATH=/etc/nginx/lualib --CONFIG_PATH=/defaults/crowdsec --DATA_PATH=/defaults/crowdsec --docker
25+ sed -i ' s|ENABLED=.*|ENABLED=false|' /defaults/crowdsec/crowdsec-openresty-bouncer.conf
26+ rm -rf /tmp/crowdsec
27+
28+ echo -e " ${BLUE} ❯ ${GREEN} OpenResty plugins install completed${RESET} "
Original file line number Diff line number Diff line change @@ -19,5 +19,6 @@ echo -e "${BLUE}❯ ${CYAN}Installing OpenResty plugins...${RESET}"
1919cd /
2020luarocks install lua-cjson
2121luarocks install lua-resty-openidc
22+ luarocks install lua-resty-http
2223
2324echo -e " ${BLUE} ❯ ${GREEN} OpenResty plugins install completed${RESET} "
You can’t perform that action at this time.
0 commit comments