IdeCable wroteI've been trying to get VPN On Demand working on IOS with a vpn user enabled for Auto Connect.
Glad you got your CA issued fixed. I too was surprised that \n really meant "\n".
I wanted to chime in and share my On Demand settings for iOS. I've spent literally two months (when not working) trying to get iOS 7's on demand feature to work as well as iOS 6's. I'm already typing up a start-to-finish tutorial but this tidbit doesn't seem to be
explained anywhere. Apple was forced to change the way on demand connections worked due to a lawsuit and it's been painful recreating the behavior. There are now three ways to invoke on demand connections and iOS 6 and 7 respond differently to each. The link aMakUzr shared explained the what, but not the why.
iOS 7 allows us to use one or more of many different dictionaries and keys to invoke the VPN. There are two classes of triggers though. One is "network change" and the other is "per connection".
The network change method uses keys DNSDomainMatch, DNSServerAddress-Match, InterfaceTypeMatch, SSIDMatch, and URLStringProbe. It has been my experience that these network change keys are nearly useless in starting the VPN. For example, a change will only happen once (e.g. WiFi to cellular) compared to how likely you are to actually need the VPN. Let's say you leave the house (and naturally the WiFi network) then try to use a domain listed in the profile. The change from WiFi to cellular will trigger the check and the VPN starts. Once the screen locks then the VPN drops due to timeouts, etc. The VPN won't start when the device is unlocked and the VPN resource is needed again. The trigger for the VPN was the WiFi to cellular change, not the resource being accessed.
I've had 100% success with using the "ActionParameters" key. This is the per connection trigger. There are two additional keys that can be added when using ActionParameters, "RequiredDNSServers" and "RequiredURLString-Probe". Go with RequiredURLString-Probe. See my excerpt below--it's directly from my iPhone .mobileconfig. Here is the logic of it though: 1) if WiFi SSID is "My Home WiFi", then disconnect. 2) if any domain, test non-existent URL for connectivity (HTTP 200 Success), invoke VPN if URL test fails (it is designed to always fail). 3) if rule one or two doesn't match, then connect.
If I find the VPN is getting in the way or that I don't need it, then I just toggle the "Connect On Demand" feature off from the Settings in iOS. Happy tunneling!
<key>OnDemandEnabled</key>
<integer>1</integer>
<key>OnDemandRules</key>
<array>
<dict>
<key>Action</key>
<string>Disconnect</string>
<key>SSIDMatch</key>
<array>
<string>My Home WiFi</string>
</array>
</dict>
<dict>
<key>Action</key>
<string>EvaluateConnection</string>
<key>ActionParameters</key>
<array>
<dict>
<key>Domains</key>
<array>
<string>*</string>
</array>
<key>RequiredURLStringProbe</key>
<string>https://test-non-existent-URL-for-connectivity.com</string>
<key>DomainAction</key>
<string>ConnectIfNeeded</string>
</dict>
</array>
</dict>
<dict>
<key>Action</key>
<string>Connect</string>
</dict>
</array>