Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trust the nextcloud-aio gateway #19

Merged
merged 1 commit into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
root /data/caddy
}

servers {
trusted_proxies placeholder
}

log {
level ERROR
}
Expand Down
7 changes: 7 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ while ! [ -f /nextcloud/admin/files/nextcloud-aio-caddy/allowed-countries.txt ];
sleep 5
done

# Get ipv4-address of caddy
IPv4_ADDRESS="$(dig nextcloud-aio-caddy A +short +search | head -1)"
# Bring it in CIDR notation
# shellcheck disable=SC2001
IPv4_ADDRESS="$(echo "$IPv4_ADDRESS" | sed 's|[0-9]\+$|1/32|')"
sed -i "s|trusted_proxies.*|trusted_proxies static $IPv4_ADDRESS|" /Caddyfile

ALLOW_CONTRIES="$(head -n 1 /nextcloud/admin/files/nextcloud-aio-caddy/allowed-countries.txt)"
if echo "$ALLOW_CONTRIES" | grep -q '^[A-Z ]\+$'; then
FILTER_SET=1
Expand Down