VPN Management and App flow

Hello ,

I have the following setup.

App has to run on the local LAN only connected to a secure api, and once outside the local lan it needs to connect to a VPN in order to access the server.

Is there a way to manage vpn profiles and the app automatically detect the ip and ask or automatically connect to that vpn to allow app to run ?

Any ideas or code would be highly appreciated .

Targets IPadOS, and IOS

It looks like you should be able to do this with Apple’s Personal VPN capability which would require a bunch of declares, a custom dylib or a plugin to accomplish. At first glance, you may be able to just use declares as the callbacks I’ve seen are all on the main thread. I have not done an exhaustive search.

Apple’s docs say this however:

Before starting with Personal VPN, verify that the client is compatible with your VPN server. Use Apple Configurator to create a configuration profile with a VPN payload for your server. If you can connect using the VPN configuration from your configuration profile, you should be able to connect using Personal VPN.

Hi Greg,
I guess that might be a problem as the configurator knows only l2tp and in our case we are using openvpn but on the ios and Ipados we do have the the option to select the default profile and just start it or stop it with a change of a button.

Not sure if i understood well but there was an option on IOS something with vpn on demand or something like that where if you need vpn as you said you can handle the profile.

and apparently openvpn supports VPN on Demand

I guess this could be the documentation for the VPN part on Apple

I guess i need to check on apple api.