6
votes

We have an app wherein certain functionality needs to work only when the user is connected to a router associated with his account (we have some information about user accounts and home routers). However, it is possible for the user to set up a VPN connection to his home router via any public wifi/3g network. We want to block certain functionality if that is the case.

Any ideas as to how it can be detected using any of the existing iphone/ipad apis?

Thanks, Hetal

2
What's wrong with VPN from a public hotspot? The whole point of VPN is that you're protected on insecure networks like that. - ceejayoz
We have a requirement from the powers that be that certain functionality needs to only work on home router and not when you are connected via any public wifi or 3g. - Hetal Vora
Might be worth notifying the powers that be that VPN from a public hotspot is massively more secure than non-VPN from a home hotspot. - ceejayoz
Its not just about security. It is about having that functionality being accessible "from any network" can run them into other issues. - Hetal Vora
If they're VPNed into their home network, they're on the same network as if they were right there physically at home. That's the whole point of it. - ceejayoz

2 Answers

6
votes

There is a flag in the reachability API called kSCNetworkReachabilityFlagsTransientConnection. It is true when you are connected via a VPN and false if you are not connected via a VPN. We used this flag value to check for our conditions.

1
votes

There's no iOS API (public at least) that is going to give you information on whether you're running on a home router or public WiFi connection. You can only determine that you're on a WiFi connection vs. 3G. (for example, see the Reachability sample)

You might be able to do some sort of lookup based on the device's current IP address. You'd have to have each user register their router's IP address and have your application validate it before running, etc. But still, there'd be no guarantee that user's home router is secured. In other words, it could be just as wide open as a public WiFi.