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 {
16
16
BRANCH_LOWER = " ${ BRANCH_NAME.toLowerCase().replaceAll('/', '-')} "
17
17
// Software versions; OpenResty does not support Lua >= 5.2
18
18
OPENRESTY_VERSION = ' 1.19.9.1'
19
+ CROWDSEC_OPENRESTY_BOUNCER_VERSION = ' 0.1.7'
19
20
LUA_VERSION = ' 5.1.5'
20
21
LUAROCKS_VERSION = ' 3.3.1'
21
22
}
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ The following images are built:
22
22
** latest**
23
23
- OpenResty
24
24
- Lua
25
+ - [ Crowdsec Openresty Bouncer] ( https://github.com/crowdsecurity/cs-openresty-bouncer )
25
26
26
27
** certbot**
27
28
- Certbot
Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ RUN apt-get update \
57
57
tzdata \
58
58
unzip \
59
59
zlib1g \
60
+ gettext \
61
+ wget \
60
62
&& apt-get clean \
61
63
&& rm -rf /var/lib/apt/lists/* \
62
64
&& rm -rf /var/cache/* /var/log/* /tmp/* /var/lib/dpkg/status-old
@@ -72,16 +74,22 @@ COPY ./scripts/install-lua /tmp/install-lua
72
74
COPY --from=nginxbuilder /tmp/openresty /tmp/openresty
73
75
COPY ./scripts/install-openresty /tmp/install-openresty
74
76
77
+ # Copy crowdsec openresty bouncer install script
78
+ COPY ./scripts/install-crowdsec_openresty_bouncer /tmp/install-crowdsec_openresty_bouncer
79
+
75
80
ARG OPENRESTY_VERSION
81
+ ARG CROWDSEC_OPENRESTY_BOUNCER_VERSION
76
82
ENV 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}
78
85
79
86
# Install openresty, lua, then clean up file system
80
87
RUN apt-get update \
81
88
&& apt-get install -y gcc make socat git \
82
89
&& /tmp/install-lua \
83
90
&& /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 \
85
93
&& apt-get autoremove -y \
86
94
&& apt-get clean \
87
95
&& rm -rf /var/lib/apt/lists/* \
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ RESET='\E[0m'
9
9
DOCKER_IMAGE=nginxproxymanager/nginx-full
10
10
11
11
export OPENRESTY_VERSION=1.19.9.1
12
+ export CROWDSEC_OPENRESTY_BOUNCER_VERSION=0.1.7
12
13
export LUA_VERSION=5.1.5
13
14
export LUAROCKS_VERSION=3.3.1
14
15
@@ -18,6 +19,7 @@ echo -e "${BLUE}❯ ${CYAN}Building ${YELLOW}latest ${CYAN}...${RESET}"
18
19
docker build \
19
20
--pull \
20
21
--build-arg OPENRESTY_VERSION \
22
+ --build-arg CROWDSEC_OPENRESTY_BOUNCER_VERSION \
21
23
--build-arg LUA_VERSION \
22
24
--build-arg LUAROCKS_VERSION \
23
25
-t ${DOCKER_IMAGE} :latest \
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ docker buildx build \
25
25
--build-arg OPENRESTY_VERSION \
26
26
--build-arg LUA_VERSION \
27
27
--build-arg LUAROCKS_VERSION \
28
+ --build-arg CROWDSEC_OPENRESTY_BOUNCER_VERSION \
28
29
$@ \
29
30
.
30
31
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}"
19
19
cd /
20
20
luarocks install lua-cjson
21
21
luarocks install lua-resty-openidc
22
+ luarocks install lua-resty-http
22
23
23
24
echo -e " ${BLUE} ❯ ${GREEN} OpenResty plugins install completed${RESET} "
You can’t perform that action at this time.
0 commit comments