How to create a Per-App VPN in Mac app

Hi ,


I have a mac app which is shipped outside macappstore i want to implement a feature VPN which on selecting it by user vpn should connect only to my app not whole system.

I've searched about this but i found nothing so that i could start so help me from exactly where to start .

The standard way of implementing per-app VPN is via a NetworkExtension tunnel provider (typically an app proxy provider, but you can also use a packet tunnel provider in per-app VPN mode). These technologies can only be deployed via the Mac App Store.

Even if that weren’t the case, they probably wouldn’t meet your needs. This sort of per-app VPN is typically configured by the admin in a managed environment. Having an app configure its own per-app VPN would be tricky.

OTOH, as you control the code inside this app you can implement a per-app VPN solution entirely within your app. There’s two approaches you might use for this:

  • You could cut the ‘bottom’ of your networking code, replacing the low-level code that talks to the networking stack with code that talks to your per-app VPN layer.

  • If there’s no easy to way to separate your high- and low-level networking code, you could create a per-app VPN proxy server within your app. Your networking code would talk to that server, and the server would do what’s necessary to forward the connection across the VPN.

Neither of these tasks is easy. It would be much easier to solve this problem on the server side, that is, have the server admin put a server in their DMZ that proxies the connection on behalf of the client app, applying an appropriate security policy.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
How to create a Per-App VPN in Mac app
 
 
Q