Must NEAppProxyProvider be used with MDM/VPN?

Hi, Qinn


Can it be used just by itself?


The purpose is to monitor/modify traffic from my app. But MDM is not an option for the app.


According to Apple document:


The

NEAppProxyProvider
class provides access to flows of network data in the form of
NEAppProxyFlow
objects. Each
NEAppProxyFlow
object corresponds to a socket opened by an app that matches the app rules specified in the current App Proxy configuration.


But looks like App Proxy configuration can only be done by configure file (through MDM) ...


Thanks,

Rao

Replies

Must NEAppProxyProvider be used with MDM/VPN?

Yes, assuming we’re talking about production code on iOS. Per-app VPN is limited to apps installed via MDM because you need to use MDM to set the app’s

VPNUUID
attribute to match up with the
VPNUUID
of your per-app VPN configuration.

For testing purposes you can use the

NETestAppMapping
key in your
Info.plist
to set up this mapping, as discussed in the Testing Per-App VPN section of the NETunnelProviderManager class reference. However, this won’t work for production code.

But looks like App Proxy configuration can only be done by configure file (through MDM) ...

This restriction doesn’t just apply to app proxy providers; it’s also per-app packet tunnel providers.

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"

Thank you for the clarification, Quinn.


The purpose here is to find out the 3g/4g network usage for our app, like on iPhone, in Settings -> Cellular, it shows the data usage for each individual app.


Any suggestion is appreciated.

The purpose here is to find out the 3g/4g network usage for our app …

Your app in production? Or just in testing?

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"

The app will be in production/App Store.


Thanks,

Rao

You won’t be able to use per-app VPN in an App Store app. As I mentioned above, per-app VPN requires MDM deployment of the targeted apps, and MDM is restricted to enterprise use only (both technically and, IIRC, via its legal agreement).

The system does maintain per-app network traffic statistics but there’s no public API to get at that information. My recommendation here is that you file an enhancement request for a public way to get at those statistics for your own app (a request for the statistics for other apps is likely to get rejected on security grounds). Please post your bug number, just for the record.

In terms of what’s available today, I can think of a couple of options that might interest you:

  • If you’re working with NSURLSession, you can get a lot of information about the requests you issued via the NSURLSessionTaskMetrics API we added in iOS 10. It does not, alas, include any byte counts but, again, that’d make a fine enhancement request.

  • If you’re working at the BSD Sockets layer (or at any layer that allows you to get access to the socket for the connection), you can get information about the connection via the

    TCP_CONNECTION_INFO
    socket option. See
    getsockopt
    and for details.

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"

Thank you Quinn.


The pain point is that we do not have all the control - the app is kind of legacy and uses many third party libraries some of which use lower level socket.


Will weigh you suggestion and post bug number if decide to file.


Best regards,

Rao

I have some questions:

First: How can create MDM profile which contain VPNUUID and com.apple.vpn.managed.applayer? AppleConfigurator2 has already installed in my Mac,but i can not find VPNUUID,which attributes should be config into MDM Profile,i can not find a Clear description


Second: How can MyApp launch NEAppPrixy Extension, how can i use NEAppProxyProviderManager?