Comment on VPN protection: allow other VPN apps (WireGuard, NetBird, ...) as the VPN app (small patch)
Thanks @girish. I checked vpnAccessConfig in app-bridge.js, and I think it already works for any app, with nothing OpenVPN-specific:
- CLOUDRON_APP_BRIDGE_ORIGIN is set for every app container (docker.js), so any app can reach the endpoint.
- /vpn-access-config identifies the caller by its container IP (apps.getByIpAddress). Unknown IPs get 401, any app other than the selected vpnAppId gets an empty result, and only the selected app receives apps[].fqdn, domains, dashboardDomain and tunnelRouting.
- The handler never checks the manifest ID, and the patch doesn't change it. A NetBird or WireGuard app selected by the admin would call GET $CLOUDRON_APP_BRIDGE_ORIGIN/vpn-access-config just like the OpenVPN app does.
For NetBird, a separate routing-peer app (with net_admin, masquerading so traffic comes from its own container IP) would turn apps[].fqdn into NetBird domain resources and domains into DNS match domains. It would use an exit node for full and CIDR routes for custom.
So the question isn't really technical. Would you be OK documenting this endpoint and its response fields as a supported contract for VPN apps, perhaps marked experimental?
Two things I couldn't tell from the code: how should a VPN app learn about changes (polling, or a restart/notification when the config changes)? And how does the OpenVPN app use dashboardDomain?
If it helps, I can extend the app-bridge test so the selected caller is a non-OpenVPN net_admin app.
Currently, it's internal only because no other app supports it.
Currently, this is polled. dashboardDomain is used for display purposes. In the VPN app settings, there is a link to the Cloudron dashboard's app passwords settings.
Do you happen to have a package that might work with this change already? Might be interesting to consider this change.
@girish Thanks, that clears it up: an internal endpoint the VPN app polls, with
dashboardDomainfor display only.Yes, there's now a package that works with the change: https://github.com/marcusquinn/cloudron-netbird-router-app
It's a NetBird routing peer with
net_admin. Every 30 seconds it reads/vpn-access-configand keeps one NetBird network in step: itself as a masquerading router, plus one domain resource per protected FQDN (primary, secondary and alias). Who can reach them stays a normal NetBird access policy.Tested on a 10.1.6 Cloudron with the patch:
Two things I learned that matter for the patch:
apps.jscheck is needed. Stock 10.1.6 only refuses to make the OpenVPN app itself VPN access only, so it let me protect the selected router. The patch refuses it for whichever app is selected.CLOUDRONinput chain drops container-to-published-port traffic. The package works around it inside its own container. No change needed on your side, just mentioning it in case it matters for other VPN apps.The dashboard part (the
.vuechanges, so the selector listsnet_adminapps) I only tested through the API. Happy to rebase the patch onto whatever branch suits you.