Skip to content

Commit

Permalink
Merge branch 'release/v0.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
iphoting committed May 7, 2014
2 parents 33a2bbb + 241edb1 commit aadfa5f
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 5 deletions.
9 changes: 7 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
= 0.4.0 / 2014-05-04
= 0.4.1 / 2014-05-07
* Bugfix: SSIDs specified as a string in configfile now correctly output
as arrays. (#a9e638)

= 0.4.0 / 2014-05-07
* VoD rules in `--[un]trusted-ssids` to also use `InterfaceTypeMatch`.
* Added support for configuration persistance, via ENV or ~/.ovpnmcgen.rb.yml or `--config` flag.
* Added support for configuration persistance, via ENV or
~/.ovpnmcgen.rb.yml or `--config` flag.

= 0.3.0 / 2014-05-04
* Documentation updates.
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ Option flags can be set using environment variables or placed into a YAML format

Note: Only for YAML configuration files and environment variables, flags with hyphens (-) are replaced with underscores (_), i.e. `--trusted-ssids safe` should be `trusted_ssids: safe`.

Sample:

```
untrusted_ssids: [dangerous1, dangerous2]
trusted_ssids: [trust]
host: vpn.example.com
cafile: /etc/openvpn/ca.crt
tafile: /etc/openvpn/ta.key
url_probe: https://vpn.example.com/canVPN.php
```

### Security Levels

There are three different security levels to choose from, 'paranoid', 'high' (default), and 'medium'. The algorithm illustrated above is for 'high'.
Expand Down
29 changes: 29 additions & 0 deletions features/gen_configfile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,35 @@ Feature: Generate Functionality with Configuration File
Then the output should contain "error: "
And the output should not contain "error: Host"

Scenario: Single SSIDs specified should appear as an array in the output.
Given a file named ".ovpnmcgen.rb.yml" with:
"""
trusted_ssids: trust
"""
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --p12file p12file.p12 cucumber aruba`
Then the output should match:
"""
<key>SSIDMatch</key>
\s*<array>
\s*<string>trust</string>
\s*</array>
"""

Scenario: Multiple SSIDs specified should appear as an array in the output.
Given a file named ".ovpnmcgen.rb.yml" with:
"""
trusted_ssids: [trust1, trust2]
"""
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --p12file p12file.p12 cucumber aruba`
Then the output should match:
"""
<key>SSIDMatch</key>
\s*<array>
\s*<string>trust1</string>
\s*<string>trust2</string>
\s*</array>
"""

Scenario: Flags should override configuration file options.
Given a file named ".ovpnmcgen.rb.yml" with:
"""
Expand Down
4 changes: 4 additions & 0 deletions lib/ovpnmcgen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def generate(inputs = {})
trusted_ssids = inputs[:trusted_ssids] || false
untrusted_ssids = inputs[:untrusted_ssids] || false

# Ensure [un]trusted_ssids are Arrays.
trusted_ssids = Array(trusted_ssids) if trusted_ssids
untrusted_ssids = Array(untrusted_ssids) if untrusted_ssids

begin
ca_cert = File.readlines(inputs[:cafile]).map { |x| x.chomp }.join('\n')
rescue Errno::ENOENT
Expand Down
2 changes: 0 additions & 2 deletions lib/ovpnmcgen/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ def configure(filename = @@config_file_name)
@@config = AppConfiguration.new filename do
prefix 'og'
end

# @@config = AppConfiguration[:ovpnmcgen]
end

def config
Expand Down
2 changes: 1 addition & 1 deletion lib/ovpnmcgen/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ovpnmcgen
VERSION = "0.4.0"
VERSION = "0.4.1"
SUMMARY = "An OpenVPN iOS Configuration Profile (.mobileconfig) Utility"
end

0 comments on commit aadfa5f

Please sign in to comment.