Skip to content

Commit

Permalink
Merge pull request #3 from szaimen/enh/noid/fix-details
Browse files Browse the repository at this point in the history
  • Loading branch information
szaimen authored Oct 4, 2023
2 parents 7f6eb43 + 3f241ba commit b009cf8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
25 changes: 24 additions & 1 deletion Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@
auto_https disable_redirects

storage file_system {
root /data
root /data/caddy
}

log {
level ERROR
}
}

(GEOFILTER) {
@geofilter {
not maxmind_geolocation {
db_path "/data/GeoLite2-Country.mmdb"
allow_countries $ALLOW_CONTRIES
}
not remote_ip private_ranges
}
respond @geofilter 403
}

https://{$NC_DOMAIN}:443 {
# import GEOFILTER
reverse_proxy nextcloud-aio-apache:{$APACHE_PORT}

# TLS options
tls {
issuer acme {
disable_http_challenge
}
}
}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ RUN set -ex; \
adduser -u 33 -D -S -G www-data www-data; \
apk del shadow; \
apk add --no-cache tzdata bash bind-tools netcat-openbsd util-linux-misc; \
mkdir /data; \
mkdir -p /data/caddy; \
chown 33:33 -R /data; \
chmod 770 -R /data

VOLUME /data

COPY --from=go /go/caddy /usr/local/bin/caddy
COPY --chmod=775 start.sh /start.sh
COPY --chmod=664 Caddyfile /Caddyfile
COPY --chown=33:33 Caddyfile /Caddyfile

USER www-data
ENTRYPOINT [ "/start.sh" ]
29 changes: 0 additions & 29 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,6 @@ if [ -f "/nextcloud/admin/files/nextcloud-aio-caddy/GeoLite2-Country.mmdb" ]; th
FILE_THERE=1
fi

if [ "$FILTER_SET" = 1 ] && [ "$FILE_THERE" = 1 ]; then
cat << CADDY >> /Caddyfile
(GEOFILTER) {
@geofilter {
not maxmind_geolocation {
db_path "/data/GeoLite2-Country.mmdb"
allow_countries $ALLOW_CONTRIES
}
not remote_ip private_ranges
}
respond @geofilter 403
}
CADDY
fi

cat << CADDY >> /Caddyfile
https://{\$NC_DOMAIN}:443 {
# import GEOFILTER
reverse_proxy nextcloud-aio-apache:{\$APACHE_PORT}
# TLS options
tls {
issuer acme {
disable_http_challenge
}
}
}
CADDY

if [ -n "$(dig A +short nextcloud-aio-vaultwarden)" ]; then
cat << CADDY >> /Caddyfile
https://bw.{\$NC_DOMAIN}:443 {
Expand Down

0 comments on commit b009cf8

Please sign in to comment.