Skip to content

Commit 6a9cec9

Browse files
committed
add ipv6=off to resolver.conf so crowdsec captcha ban works
1 parent a747947 commit 6a9cec9

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

buildx-build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
3+
export DOCKER_ORG='lepresidente'
4+
export IMAGE='nginxproxymanager'
5+
export MAJOR_VERSION='2'
6+
export BUILD_VERSION=$(cat ./.version)
7+
export BUILD_COMMIT=''
8+
BUILDX_PUSH_TAGS="-t docker.io/${DOCKER_ORG}/${IMAGE}:latest"
9+
#Set Versions
10+
cat frontend/package.json | jq --arg BUILD_VERSION "${BUILD_VERSION}" '.version = $BUILD_VERSION' | sponge frontend/package.json
11+
cat backend/package.json | jq --arg BUILD_VERSION "${BUILD_VERSION}" '.version = $BUILD_VERSION' | sponge backend/package.json
12+
./scripts/ci/frontend-build
13+
#./scripts/build-backend
14+
docker run --rm -v "$(pwd)/backend:/app" -v "$(pwd)/global:/app/global" -w /app lepresidente/nginx-full:certbot-node sh -c "yarn install && yarn eslint . && rm -rf node_modules"
15+
docker build --pull --no-cache --squash --compress -t "${IMAGE}:ci-${BUILD_NUMBER}" -f docker/Dockerfile --build-arg TARGETPLATFORM=linux/amd64 --build-arg BUILDPLATFORM=linux/amd64 --build-arg BUILD_VERSION=${BUILD_VERSION} --build-arg BUILD_COMMIT=${BUILD_COMMIT} --build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" .
16+
./scripts/buildx --push ${BUILDX_PUSH_TAGS}
17+

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/00-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ fi
1616
. /etc/s6-overlay/s6-rc.d/prepare/50-ipv6.sh
1717
. /etc/s6-overlay/s6-rc.d/prepare/60-secrets.sh
1818
. /etc/s6-overlay/s6-rc.d/prepare/90-banner.sh
19+
. 99_crowdsec-openresty-bouncer.sh
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
# Create required folders
4+
mkdir -p /tmp/nginx/body \
5+
/run/nginx \
6+
/var/log/nginx \
7+
/data/nginx \
8+
/data/custom_ssl \
9+
/data/logs \
10+
/data/access \
11+
/data/nginx/default_host \
12+
/data/nginx/default_www \
13+
/data/nginx/proxy_host \
14+
/data/nginx/redirection_host \
15+
/data/nginx/stream \
16+
/data/nginx/dead_host \
17+
/data/nginx/temp \
18+
/var/lib/nginx/cache/public \
19+
/var/lib/nginx/cache/private \
20+
/var/cache/nginx/proxy_temp
21+
22+
touch /var/log/nginx/error.log && chmod 777 /var/log/nginx/error.log && chmod -R 777 /var/cache/nginx
23+
chown root /tmp/nginx
24+
25+
# Dynamically generate resolvers file, if resolver is IPv6, enclose in `[]`
26+
# thanks @tfmm
27+
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) ipv6=off valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
28+
29+
# Generate dummy self-signed certificate.
30+
if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]
31+
then
32+
echo "Generating dummy SSL certificate..."
33+
openssl req \
34+
-new \
35+
-newkey rsa:2048 \
36+
-days 3650 \
37+
-nodes \
38+
-x509 \
39+
-subj '/O=localhost/OU=localhost/CN=localhost' \
40+
-keyout /data/nginx/dummykey.pem \
41+
-out /data/nginx/dummycert.pem
42+
echo "Complete"
43+
fi
44+
45+
# Handle IPV6 settings
46+
/bin/handle-ipv6-setting /etc/nginx/conf.d
47+
/bin/handle-ipv6-setting /data/nginx
48+
49+
exec nginx

0 commit comments

Comments
 (0)