VPN Protection (internal apps)
-
I just enabled VPN Protection for Nextcloud. That is okay, since no public links are shared. Unfortunately, I noticed that access—or mutual access—between Euro Office and Nextcloud no longer works now. Unfortunately, I cannot add the Docker network IP as a whitelist IP. What do I need to do so that a VPN-protected app can still communicate with another internal app on Cloudron?
Cloudron 10.2 -
Going in the same direction: the external and internal IP of the server running Cloudron itself should always be exempted (or add an option for that); please bear in mind that this external IP (e.g. for home users) can be dynamic so it’s not a one time thing.
-
-
-
G girish has marked this topic as solved
-
-
-
After applying the patch, I still can't access a VPN-protected app from inside the server network.
For me, the following script works via cron (enter your correct values in the API_URL and the API_TOKEN; make surejqis installed):#!/usr/bin/env bash set -euo pipefail API_URL="https://REPLACE_WITH_YOUR_CLOUDRON_DOMAIN/api/v1/network/vpn_access_config" API_TOKEN="REPLACE_WITH_YOUR_CLOUDRON_API_TOKEN" MARKER_PREFIX="# AUTO-DYNAMIC-SERVER-IP" TIMESTAMP=$(date +%Y%m%d_%H%M) MARKER="${MARKER_PREFIX} ${TIMESTAMP}" # 1. Fetch current public IPv4 address using Cloudron's helper endpoint PUBLIC_IP=$(curl -fsS --max-time 10 https://ipv4.api.cloudron.io/api/v1/helper/public_ip | jq -r '.ip // empty') if [[ ! "$PUBLIC_IP" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Failed to retrieve a valid public IPv4 address: '$PUBLIC_IP'" >&2 exit 1 fi TARGET_IP="${PUBLIC_IP}/32" # 2. Fetch the current VPN access configuration from Cloudron TMP_CFG=$(mktemp) TMP_RESP=$(mktemp) trap 'rm -f "$TMP_CFG" "$TMP_RESP"' EXIT curl -fsS --max-time 10 -H "Authorization: Bearer ${API_TOKEN}" "${API_URL}" > "$TMP_CFG" # 3. Build payload: remove any previous auto-managed block and append the current timestamp + IP PAYLOAD=$(jq --arg prefix "$MARKER_PREFIX" --arg marker "$MARKER" --arg ip "$TARGET_IP" ' ((.allowlist // "") | split("\n")) as $lines | ( reduce range(0; $lines | length) as $i ( {out: [], skip_next: false}; if .skip_next then .skip_next = false elif ($lines[$i] | startswith($prefix)) then .skip_next = true else .out += [$lines[$i]] end ) | .out | join("\n") | gsub("^\\n+|\\n+$"; "") ) as $cleaned | { enabled: true, vpnAppId: .vpnAppId, tunnelRouting: .tunnelRouting, allowlist: ( [ $cleaned, ($marker + "\n" + $ip) ] | map(select(length > 0)) | join("\n") ) } ' < "$TMP_CFG") # 4. Push the updated configuration to the Cloudron API HTTP_CODE=$(printf '%s' "$PAYLOAD" | curl -sS --max-time 15 -o "$TMP_RESP" -w "%{http_code}" \ -X POST "${API_URL}" \ -H "Authorization: Bearer ${API_TOKEN}" \ -H "Content-Type: application/json" \ -d @-) if [[ "$HTTP_CODE" == "200" ]]; then logger -t cloudron-vpn-ip "Updated VPN allowlist to ${TARGET_IP} (${TIMESTAMP})" echo "Successfully updated: ${TARGET_IP} (${TIMESTAMP})" else logger -t cloudron-vpn-ip "Failed to update VPN allowlist (HTTP $HTTP_CODE): $(cat "$TMP_RESP")" echo "API error (HTTP $HTTP_CODE): $(cat "$TMP_RESP")" >&2 exit 1 fiThe script fetches the current public IPv4 from ipv4.api.cloudron.io, reads the existing VPN configuration via the Cloudron API (
/api/v1/network/vpn_access_config), replaces only its own marked block (# AUTO-DYNAMIC-SERVER-IP <YYYYMMDD_HHMM>+<IP>/32), and writes the updated configuration back viaPOST. Any manually maintained allowlist entries remain untouched, and the timestamp in the comment lets you see directly in the dashboard when the last update ran. -
-
Sorry, what is the "VPN checkbox"? There's no checkbox under "Network" --> "VPN protection". Or do you mean I have to disable / enable VPN for each app (if so, that doesn't work)?
BTW: I LOVE this feature in general!!
-
@necrevistonnezr I meant the https://docs.cloudron.io/apps#require-vpn "Require VPN" checkbox (App -> Access) .
-
@necrevistonnezr I meant the https://docs.cloudron.io/apps#require-vpn "Require VPN" checkbox (App -> Access) .
@necrevistonnezr I meant the https://docs.cloudron.io/apps#require-vpn "Require VPN" checkbox (App -> Access) .
This did not make a difference, as stated. I'll just wait for the next release and use my script until then. Again, this is a great feature!
-
-
-
I fixed it to allow the public IP and also be in sync with the dynamic dns (when that feature is enabed). However, this didn't help my network situation. I use hairpin NAT and when the browser connects to the public IP, it comes back to the Cloudron as the internal network IP. So, I have to put
192.168.2.0/24explicitly in the allow list and then it works.So @necrevistonnezr I think if you have a situation like mine, you can update to 10.2.1 and then put your internal network in the VPN allow list.
-
I fixed it to allow the public IP and also be in sync with the dynamic dns (when that feature is enabed). However, this didn't help my network situation. I use hairpin NAT and when the browser connects to the public IP, it comes back to the Cloudron as the internal network IP. So, I have to put
192.168.2.0/24explicitly in the allow list and then it works.So @necrevistonnezr I think if you have a situation like mine, you can update to 10.2.1 and then put your internal network in the VPN allow list.
I fixed it to allow the public IP and also be in sync with the dynamic dns (when that feature is enabed). However, this didn't help my network situation. I use hairpin NAT and when the browser connects to the public IP, it comes back to the Cloudron as the internal network IP. So, I have to put
192.168.2.0/24explicitly in the allow list and then it works.So @necrevistonnezr I think if you have a situation like mine, you can update to 10.2.1 and then put your internal network in the VPN allow list.
I’m on 10.2.1, followed your instructions - but when whitelisting
192.168.1.0/24in my case, it’s still blocked. Whitelisting the external IP works.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login

Will get a patch release out once we accumulate some more fixes. You can also manually apply
I completely skipped passed your messages. So, the fix was primarily for the Euro office issue which was accessing internally via Docker network. Your issue is separate and also valid. I have to make it work with the dynamic DNS also. Fixing.