File tree Expand file tree Collapse file tree 6 files changed +38
-2
lines changed
docker/rootfs/etc/s6-overlay/s6-rc.d Expand file tree Collapse file tree 6 files changed +38
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /command/with-contenv bash
2
+
3
+ set -e # Exit immediately if a command exits with a non-zero status.
4
+
5
+ mkdir -p /data/crowdsec/templates
6
+ echo " Deploy Crowdsec Openresty Bouncer.."
7
+ sed -i ' s|/defaults/crowdsec|/data/crowdsec|' /etc/nginx/conf.d/crowdsec_openresty.conf
8
+
9
+ if [ -f /data/crowdsec/crowdsec-openresty-bouncer.conf ]; then
10
+ echo " Patch crowdsec-openresty-bouncer.conf .."
11
+ sed " s/=.*//g" /data/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec.conf.raw
12
+ sed " s/=.*//g" /defaults/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec-openresty-bouncer.conf.raw
13
+ if grep -vf /tmp/crowdsec.conf.raw /tmp/crowdsec-openresty-bouncer.conf.raw ; then
14
+ grep -vf /tmp/crowdsec.conf.raw /tmp/crowdsec-openresty-bouncer.conf.raw > /tmp/config.newvals
15
+ cp /data/crowdsec/crowdsec-openresty-bouncer.conf /data/crowdsec/crowdsec-openresty-bouncer.conf.bak
16
+ grep -f /tmp/config.newvals /defaults/crowdsec/crowdsec-openresty-bouncer.conf >> /data/crowdsec/crowdsec-openresty-bouncer.conf
17
+ fi
18
+ else
19
+ echo " Deploy new crowdsec-openresty-bouncer.conf .."
20
+ cp /defaults/crowdsec/crowdsec-openresty-bouncer.conf /data/crowdsec/crowdsec-openresty-bouncer.conf
21
+ fi
22
+ # Make sure the config location is where we get the config from instead of /default/
23
+ sed -i ' s|/defaults/crowdsec|/data/crowdsec|' /data/crowdsec/crowdsec-openresty-bouncer.conf
24
+ echo " Deploy Crowdsec Templates .."
25
+ # Make sure we only copy files that don't exist in /data/crowdsec.
26
+ cd /defaults/crowdsec/templates/
27
+ for file in * .html
28
+ do
29
+ if [ ! -e " /data/crowdsec/templates/${file} " ]
30
+ then
31
+ cp -r " /defaults/crowdsec/templates/${file} " " /data/crowdsec/templates/"
32
+ fi
33
+ done
Original file line number Diff line number Diff line change
1
+ oneshot
Original file line number Diff line number Diff line change
1
+ # shellcheck shell=bash
2
+ /etc/s6-overlay/s6-rc.d/cs-crowdsec-bouncer/script.sh
Original file line number Diff line number Diff line change 1
- #! /usr/bin /with-contenv bash
1
+ #! /command /with-contenv bash
2
2
3
3
set -e # Exit immediately if a command exits with a non-zero status.
4
4
21
21
fi
22
22
# Make sure the config location is where we get the config from instead of /default/
23
23
sed -i ' s|/defaults/crowdsec|/data/crowdsec|' /data/crowdsec/crowdsec-openresty-bouncer.conf
24
- echo " Deploy Templates .."
24
+ echo " Deploy Crowdsec Templates .."
25
25
# Make sure we only copy files that don't exist in /data/crowdsec.
26
26
cd /defaults/crowdsec/templates/
27
27
for file in * .html
You can’t perform that action at this time.
0 commit comments