Skip to content

Commit e7103fe

Browse files
committed
Merge branch 'release/0.3.0'
2 parents 945bc45 + 9acf6b8 commit e7103fe

File tree

6 files changed

+69
-12
lines changed

6 files changed

+69
-12
lines changed

ChangeLog

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
= 0.3.0 / 2014-05-04
2+
* Documentation updates.
3+
* Added support for `URLStringProbe`, via `--url-probe`.
4+
15
= 0.2.1 / 2014-04-19
26
* Implement unit testing.
37
* Switch to a portable and native uuidgen implementation.
@@ -18,4 +22,4 @@
1822
* Improved Documentation.
1923

2024
= 0.0.1 / 2014-03-26
21-
* Initial Release.
25+
* Initial Release.

README.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22

33
OpenVPN iOS Configuration Profile Utility
44

5-
[![GitHub version](https://badge.fury.io/gh/iphoting%2Fovpnmcgen.rb.svg)](http://badge.fury.io/gh/iphoting%2Fovpnmcgen.rb) [![Gem Version](https://badge.fury.io/rb/ovpnmcgen.rb.svg)](http://badge.fury.io/rb/ovpnmcgen.rb) [![Build Status](https://travis-ci.org/iphoting/ovpnmcgen.rb.svg?branch=master)](https://travis-ci.org/iphoting/ovpnmcgen.rb)
5+
[![Stories in Ready](https://badge.waffle.io/iphoting/ovpnmcgen.rb.png?label=ready&title=Ready)](http://waffle.io/iphoting/ovpnmcgen.rb)
6+
[![GitHub version](https://badge.fury.io/gh/iphoting%2Fovpnmcgen.rb.svg)](http://badge.fury.io/gh/iphoting%2Fovpnmcgen.rb)
7+
[![Gem Version](https://badge.fury.io/rb/ovpnmcgen.rb.svg)](http://badge.fury.io/rb/ovpnmcgen.rb)
8+
[![Build Status](https://travis-ci.org/iphoting/ovpnmcgen.rb.svg?branch=master)](https://travis-ci.org/iphoting/ovpnmcgen.rb)
69

710
Generates iOS configuration profiles (.mobileconfig) that configures OpenVPN for use with VPN-on-Demand that are not accessible through the Apple Configurator or the iPhone Configuration Utility.
811

9-
Although there are many possible VPN-on-Demand (VoD) triggers, this utility currently only implements `SSIDMatch` and `InterfaceTypeMatch`. For 'high' (default) security level, the following algorithm is executed upon network changes, in order:
12+
Although there are many possible VPN-on-Demand (VoD) triggers, this utility currently only implements `SSIDMatch`, `InterfaceTypeMatch`, and optionally `URLStringProbe`. For 'high' (default) security level, the following algorithm is executed upon network changes, in order:
1013

1114
- If wireless SSID matches any specified with `--trusted-ssids`, tear down the VPN connection and do not reconnect on demand.
1215
- Else if wireless SSID matches any specified with `--untrusted-ssids`, unconditionally bring up the VPN connection on the next network attempt.
1316
- Else if the primary network interface becomes Wifi (any SSID except those above), unconditionally bring up the VPN connection on the next network attempt.
1417
- Else if the primary network interface becomes Cellular, leave any existing VPN connection up, but do not reconnect on demand.
1518
- Else, unconditionally bring up the VPN connection on the next network attempt.
1619

17-
Note: The other match triggers, such as `DNSDomainMatch`, `DNSServerAddressMatch`, `URLStringProbe`, and per-connection domain inspection (`ActionParameters`), are not implemented. I reckon some kind of DSL will need to be built to support them; pull-requests are welcome.
20+
Note: The other match triggers, such as `DNSDomainMatch`, `DNSServerAddressMatch`, and per-connection domain inspection (`ActionParameters`), are not implemented. I reckon some kind of DSL will need to be built to support them; pull-requests are welcome.
1821

1922
## Installation
2023

@@ -55,6 +58,7 @@ Usage: ovpnmcgen.rb generate [options] <user> <device>
5558
--cert-uuid UUID Override a Certificate payload UUID.
5659
-t, --trusted-ssids SSIDS List of comma-separated trusted SSIDs.
5760
-u, --untrusted-ssids SSIDS List of comma-separated untrusted SSIDs.
61+
--url-probe URL This URL must return HTTP status 200, without redirection, before the VPN service will try establishing.
5862
--ovpnconfigfile FILE Path to OpenVPN client config file.
5963
-o, --output FILE Output to file. [Default: stdout]
6064
```
@@ -79,6 +83,14 @@ For 'medium' security level, the following algorithm is executed upon network ch
7983
- Else if the primary network interface becomes Cellular, leave any existing VPN connection up, but do not reconnect on demand.
8084
- Else, unconditionally bring up the VPN connection on the next network attempt.
8185

86+
### URL Probe
87+
88+
Apple provides a `URLStringProbe` test condition where a VPN connection will only be established, if and only if a specified URL is successfully fetched (returning a 200 HTTP status code) without redirection.
89+
90+
This feature can be enabled for statistical and maintenance-protection reasons. Otherwise, it can also workaround a circular limitation with unsecured wireless captive portals. See Known Issues below for further elaboration.
91+
92+
By enabling this option, you will need to reliably and quickly respond with HTTP status code 200 at the URL string supplied.
93+
8294
## Examples
8395

8496
### Typical Usage
@@ -235,6 +247,7 @@ Output:
235247
--p12file path/to/john-ipad.p12 --p12pass p12passphrase john ipad
236248

237249
Output similar to above:
250+
238251
```
239252
<?xml version="1.0" encoding="UTF-8"?>
240253
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -323,7 +336,7 @@ Output similar to above:
323336

324337
Workaround: Manually disable VPN-on-Demand in Settings.app > VPN > Server (i) option screen. Reenable only after Internet access is available.
325338

326-
TODO: Implement `URLStringProbe` where, if and only if this URL is successfully fetched (returning a 200 HTTP status code) without redirection, will the VPN service be required, relied on, and brought up.
339+
Solution: Implement `URLStringProbe` where, if and only if this URL is successfully fetched (returning a 200 HTTP status code) without redirection, will the VPN service be required, relied on, and brought up. Enable with the `--url-probe` flag.
327340

328341
## TODO
329342

bin/ovpnmcgen.rb

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
c.option '--cert-uuid UUID', 'Override a Certificate payload UUID.'
3333
c.option '-t', '--trusted-ssids SSIDS', Array, 'List of comma-separated trusted SSIDs.'
3434
c.option '-u', '--untrusted-ssids SSIDS', Array, 'List of comma-separated untrusted SSIDs.'
35+
c.option '--url-probe URL', 'This URL must return HTTP status 200, without redirection, before the VPN service will try establishing.'
3536
c.option '--ovpnconfigfile FILE', 'Path to OpenVPN client config file.'
3637
c.option '-o', '--output FILE', 'Output to file. [Default: stdout]'
3738
c.action do |args, options|
@@ -60,6 +61,7 @@
6061
}
6162
inputs[:ovpnconfigfile] = options.ovpnconfigfile if options.ovpnconfigfile
6263
inputs[:tafile] = options.tafile if options.tafile
64+
inputs[:url_probe] = options.url_probe if options.url_probe
6365

6466
unless options.output
6567
puts Ovpnmcgen.generate(inputs)

features/gen_basic.feature

+29
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,35 @@ Feature: Basic Generate Functionality
122122
\s*<integer>0</integer>
123123
"""
124124

125+
Scenario: The url-probe flag is set.
126+
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --p12file p12file.p12 --url-probe 'https://url.to.probe/' cucumber aruba`
127+
Then the output should match:
128+
"""
129+
<key>URLStringProbe</key>
130+
\s*<string>https://url.to.probe/</string>
131+
"""
132+
And the output should match:
133+
"""
134+
<dict>
135+
\s*<key>Action</key>
136+
\s*<string>Ignore</string>
137+
\s*</dict>
138+
"""
139+
140+
Scenario: The url-probe flag is not set.
141+
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --p12file p12file.p12 cucumber aruba`
142+
Then the output should not contain:
143+
"""
144+
<key>URLStringProbe</key>
145+
"""
146+
And the output should not match:
147+
"""
148+
<dict>
149+
\s*<key>Action</key>
150+
\s*<string>Ignore</string>
151+
\s*</dict>
152+
"""
153+
125154
Scenario: The [un]trusted-ssids flags are set.
126155
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --p12file p12file.p12 --trusted-ssids trusted1,trusted2 --untrusted-ssids evil3,evil4 cucumber aruba`
127156
Then the output should match:

lib/ovpnmcgen.rb

+15-6
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,16 @@ def generate(inputs = {})
6363
'SSIDMatch' => untrusted_ssids,
6464
'Action' => 'Connect'
6565
}
66-
vpnOnDemandRules << vodTrusted if trusted_ssids
67-
vpnOnDemandRules << vodUntrusted if untrusted_ssids
68-
69-
vpnOnDemandRules << { # Untrust all Wifi
66+
vodWifiOnly = { # Untrust all Wifi
7067
'InterfaceTypeMatch' => 'WiFi',
7168
'Action' => case inputs[:security_level]
7269
when 'paranoid', 'high'
7370
'Connect'
7471
else # medium
7572
'Ignore'
7673
end
77-
} << { # Trust Cellular
74+
}
75+
vodCellularOnly = { # Trust Cellular
7876
'InterfaceTypeMatch' => 'Cellular',
7977
'Action' => case inputs[:security_level]
8078
when 'paranoid'
@@ -84,10 +82,21 @@ def generate(inputs = {})
8482
else # medium
8583
'Disconnect'
8684
end
87-
} << { # Default catch-all
85+
}
86+
vodDefault = { # Default catch-all
8887
'Action' => 'Connect'
8988
}
9089

90+
# Insert URLStringProbe conditions when enabled with --url-probe
91+
vodTrusted['URLStringProbe'] = vodUntrusted['URLStringProbe'] = vodWifiOnly['URLStringProbe'] = vodCellularOnly['URLStringProbe'] = vodDefault['URLStringProbe'] = inputs[:url_probe] if inputs[:url_probe]
92+
93+
vpnOnDemandRules << vodTrusted if trusted_ssids
94+
vpnOnDemandRules << vodUntrusted if untrusted_ssids
95+
vpnOnDemandRules << vodWifiOnly << vodCellularOnly << vodDefault
96+
vpnOnDemandRules << { # Default catch-all when URLStringProbe is enabled and returns false to prevent circular race.
97+
'Action' => 'Ignore'
98+
} if inputs[:url_probe]
99+
91100
cert = {
92101
'Password' => p12pass,
93102
'PayloadCertificateFileName' => "#{user}-#{device}.p12",

lib/ovpnmcgen/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module Ovpnmcgen
2-
VERSION = "0.2.1"
2+
VERSION = "0.3.0"
33
SUMMARY = "An OpenVPN iOS Configuration Profile (.mobileconfig) Utility"
44
end

0 commit comments

Comments
 (0)