forked from jlesage/docker-nginx-proxy-manager
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
488141f
commit 13b660d
Showing
4 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
set -e # Exit immediately if a command exits with a non-zero status. | ||
|
||
mkdir -p /config/crowdsec/templates | ||
echo "Deploy Crowdsec Openresty Bouncer.." | ||
sed -i 's|/defaults/crowdsec|/config/crowdsec|' /etc/nginx/conf.d/crowdsec_openresty.conf | ||
|
||
if [ -f /data/crowdsec/crowdsec-openresty-bouncer.conf ]; then | ||
echo "Patch crowdsec-openresty-bouncer.conf .." | ||
sed "s/=.*//g" /config/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec.conf.raw | ||
sed "s/=.*//g" /defaults/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec-openresty-bouncer.conf.raw | ||
if grep -vf /tmp/crowdsec.conf.raw /tmp/crowdsec-openresty-bouncer.conf.raw ; then | ||
grep -vf /tmp/crowdsec.conf.raw /tmp/crowdsec-openresty-bouncer.conf.raw > /tmp/config.newvals | ||
cp /config/crowdsec/crowdsec-openresty-bouncer.conf /config/crowdsec/crowdsec-openresty-bouncer.conf.bak | ||
grep -f /tmp/config.newvals /defaults/crowdsec/crowdsec-openresty-bouncer.conf >> /config/crowdsec/crowdsec-openresty-bouncer.conf | ||
fi | ||
else | ||
echo "Deploy new crowdsec-openresty-bouncer.conf .." | ||
cp /defaults/crowdsec/crowdsec-openresty-bouncer.conf /config/crowdsec/crowdsec-openresty-bouncer.conf | ||
fi | ||
#Make sure the config location is where we get the config from instead of /default/ | ||
sed -i 's|/defaults/crowdsec|/config/crowdsec|' /config/crowdsec/crowdsec-openresty-bouncer.conf | ||
echo "Deploy Crowdsec Templates .." | ||
#Make sure we only copy files that don't exist in /data/crowdsec. | ||
cd /defaults/crowdsec/templates/ | ||
for file in *.html | ||
do | ||
if [ ! -e "/config/crowdsec/templates/${file}" ] | ||
then | ||
cp -r "/defaults/crowdsec/templates/${file}" "/config/crowdsec/templates/" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
|
||
set -e # Exit immediately if a command exits with a non-zero status. | ||
set -u # Treat unset variables as an error. | ||
|
||
log() { | ||
echo ">>> $*" | ||
} | ||
|
||
CROWDSEC_OPENRESTY_BOUNCER_URL="${1:-}" | ||
|
||
ROOTFS=/tmp/crowdsec-openresty-bouncer-install | ||
|
||
if [ -z "$CROWDSEC_OPENRESTY_BOUNCER_URL" ]; then | ||
log "ERROR: bcrypt tool version missing." | ||
exit 1 | ||
fi | ||
|
||
# | ||
# Install required packages. | ||
# | ||
|
||
apk --no-cache add \ | ||
build-base \ | ||
gettext \ | ||
curl \ | ||
bash \ | ||
|
||
# | ||
# Build. | ||
# | ||
|
||
log "Downloading Crowdsec Openresty Bouncer package..." | ||
mkdir /tmp/crowdsec-openresty-bouncer | ||
curl -# -L "${CROWDSEC_OPENRESTY_BOUNCER_URL}" | tar xz --strip 1 -C /tmp/crowdsec-openresty-bouncer | ||
log "Deploy Crowdsec Openresty Bouncer..." | ||
cd /tmp/crowdsec-openresty-bouncer | ||
bash ./install.sh --NGINX_CONF_DIR=${ROOTFS}/etc/nginx/conf.d --LIB_PATH=${ROOTFS}/var/lib/nginx/lualib --CONFIG_PATH=${ROOTFS}/defaults/crowdsec/ --DATA_PATH=${ROOTFS}/defaults/crowdsec/ --SSL_CERTS_PATH=/etc/ssl/certs/ca-cert-GTS_Root_R1.pem --docker | ||
sed -i 's|/tmp/crowdsec-openresty-bouncer-install||g' ${ROOTFS}/etc/nginx/conf.d/crowdsec_openresty.conf | ||
sed -i 's|ENABLED=.*|ENABLED=false|' ${ROOTFS}/defaults/crowdsec/crowdsec-openresty-bouncer.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters