vpn-config 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +92 -0
- data/Rakefile +9 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/data/providers.yml +86 -0
- data/exe/vpn-config +6 -0
- data/lib/vpn/config/cli.rb +104 -0
- data/lib/vpn/config/generator.rb +143 -0
- data/lib/vpn/config/version.rb +5 -0
- data/lib/vpn/config.rb +8 -0
- data/snake-oil/certificate.p12 +0 -0
- data/vpn-config.gemspec +29 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 59b428d53dd9bd6ff78c96ce3ae747d7bd962e7a
|
4
|
+
data.tar.gz: 8a4595c5b90d8dce348a76b1f57dfe2c87824526
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fe1a1d209a32ce56c164aab5b258fb21850eb940e349d1587c958b7462a59adfc1450deb4f79b11a707e32f6c59f5c6d95cb55427cc5dcfdbc8c5284e1387a40
|
7
|
+
data.tar.gz: 88a46ea0eb843bc54ad5f56646cc5e91571ddcbe075705da10dabf3cc746adc87b68b3cc107c03b80c6f958405b6c8f2c3c71a5860410cd92161f0a371e00d3a
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Matias Korhonen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# VPN Config
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/matiaskorhonen/vpn-config.svg?branch=master)](https://travis-ci.org/matiaskorhonen/vpn-config)
|
4
|
+
|
5
|
+
Generate iOS/OS X configuration profiles for VPNs.
|
6
|
+
|
7
|
+
Only L2TP [Private Internet Access](https://www.privateinternetaccess.com/) VPNs are supported out of the box at the moment, but it's possible to provide your own data file (pull requests are also welcome, if you want to add support for your VPN provider).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
A working Ruby is required (preferably Ruby 2.2.0 or above).
|
12
|
+
|
13
|
+
Install it in the usual manner:
|
14
|
+
|
15
|
+
gem install vpn-config
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
To get basic help, run: `vpn-config help`
|
20
|
+
|
21
|
+
For information on a specific command: `vpn-config help COMMAND`
|
22
|
+
|
23
|
+
### Generate a signed configuration file
|
24
|
+
|
25
|
+
To generate a configuration file for the default VPN Provider (Private Internet Access), run:
|
26
|
+
|
27
|
+
```sh
|
28
|
+
vpn-config generate --username=foo --password=bar test.mobileconfig
|
29
|
+
```
|
30
|
+
|
31
|
+
To sign the configuration file, also give the `--sign` argument:
|
32
|
+
|
33
|
+
```sh
|
34
|
+
vpn-config generate --username=foo --password=bar --sign test.mobileconfig
|
35
|
+
```
|
36
|
+
|
37
|
+
To select specific endpoints, use the `--endpoints` option:
|
38
|
+
|
39
|
+
```sh
|
40
|
+
vpn-config generate --username=foo --password=bar --sign \
|
41
|
+
--endpoints "US East" "Canada" "Hong Kong" test.mobileconfig
|
42
|
+
```
|
43
|
+
|
44
|
+
To sign with your own certificate, simply provide the path and passphrase (the certificate **must** be a PKCS12 file):
|
45
|
+
|
46
|
+
```sh
|
47
|
+
vpn-config generate --username=foo --password=bar --sign \
|
48
|
+
--certificate-path my.p12 --certificate-pass SuperSecret test.mobileconfig
|
49
|
+
```
|
50
|
+
|
51
|
+
### Supply your own data file
|
52
|
+
|
53
|
+
If you wish, you can use your own VPN list instead of the built-in list:
|
54
|
+
|
55
|
+
```sh
|
56
|
+
vpn-config generate --username=foo --password=bar --sign \
|
57
|
+
--data-file mydata.yml --provider "My Provider" test.mobileconfig
|
58
|
+
```
|
59
|
+
|
60
|
+
Use the [data/providers.yml](https://github.com/matiaskorhonen/vpn-config/blob/master/data/providers.yml) file as an example of how to format your list.
|
61
|
+
|
62
|
+
## Private Internet Access L2TP credentials
|
63
|
+
|
64
|
+
Don't try to use your PIA account credentials to log in to PIA VPNs. Instead you will find a separate set of credentials on the [Client Control Panel](https://www.privateinternetaccess.com/pages/client-control-panel):
|
65
|
+
|
66
|
+
![PPTP/L2TP/SOCKS Username and Password](http://shots.matiaskorhonen.fi/PPTPL2TPSOCKS_Username_and_Password.png)
|
67
|
+
|
68
|
+
Generate the credentials if you haven't already…
|
69
|
+
|
70
|
+
## Development
|
71
|
+
|
72
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
73
|
+
|
74
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
75
|
+
|
76
|
+
### Unit tests
|
77
|
+
|
78
|
+
Run the Minitest/Minispec tests with: `rake test`
|
79
|
+
|
80
|
+
## Contributing
|
81
|
+
|
82
|
+
1. Fork it ( https://github.com/matiaskorhonen/vpn-config/fork )
|
83
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
84
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
85
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
86
|
+
5. Create a new Pull Request
|
87
|
+
|
88
|
+
## Copyright & License
|
89
|
+
|
90
|
+
Licensed under the MIT License. See the [LICENSE.txt](/LICENSE.txt) file for details.
|
91
|
+
|
92
|
+
Copyright (c) 2015 Matias Korhonen
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vpn/config"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/data/providers.yml
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
---
|
2
|
+
providers:
|
3
|
+
- name: Private Internet Access
|
4
|
+
url: https://www.privateinternetaccess.com/
|
5
|
+
uuid: 59C4DCB3-1F43-4D22-BBA4-1EF8FDED8960
|
6
|
+
endpoints:
|
7
|
+
- name: US Midwest
|
8
|
+
host: us-midwest.privateinternetaccess.com
|
9
|
+
shared_secret: mysafety
|
10
|
+
uuid: 40D6AAB4-E1C8-4801-9E91-D39FA6C7BFC9
|
11
|
+
- name: US East
|
12
|
+
host: us-east.privateinternetaccess.com
|
13
|
+
shared_secret: mysafety
|
14
|
+
uuid: D258C16E-749E-4CE4-91FB-9285F997B73E
|
15
|
+
- name: US West
|
16
|
+
host: us-west.privateinternetaccess.com
|
17
|
+
shared_secret: mysafety
|
18
|
+
uuid: B17BE106-6FC5-40FF-9F94-5BA74006BAFA
|
19
|
+
- name: US Texas
|
20
|
+
host: us-texas.privateinternetaccess.com
|
21
|
+
shared_secret: mysafety
|
22
|
+
uuid: 6A52CEE6-9D78-416F-A8CB-E06E63CEACE8
|
23
|
+
- name: US California
|
24
|
+
host: us-california.privateinternetaccess.com
|
25
|
+
shared_secret: mysafety
|
26
|
+
uuid: A0E1DB55-7E4C-4D10-86CC-F409E5148FE9
|
27
|
+
- name: US Florida
|
28
|
+
host: us-florida.privateinternetaccess.com
|
29
|
+
shared_secret: mysafety
|
30
|
+
uuid: 972F964F-5F11-45BE-ADDA-6C426BF1D9C4
|
31
|
+
- name: Canada
|
32
|
+
host: ca.privateinternetaccess.com
|
33
|
+
shared_secret: mysafety
|
34
|
+
uuid: DBF7EE4D-6334-4F62-990C-852B2B5A4B02
|
35
|
+
- name: Canada Toronto
|
36
|
+
host: ca-toronto.privateinternetaccess.com
|
37
|
+
shared_secret: mysafety
|
38
|
+
uuid: 7F02BFD6-5E47-42C8-9ABB-46783A0328B7
|
39
|
+
- name: UK London
|
40
|
+
host: uk-london.privateinternetaccess.com
|
41
|
+
shared_secret: mysafety
|
42
|
+
uuid: A53524A7-8B57-4C2A-962A-85C143923EDF
|
43
|
+
- name: UK Southhampton
|
44
|
+
host: uk-southampton.privateinternetaccess.com
|
45
|
+
shared_secret: mysafety
|
46
|
+
uuid: 33E795D9-D8D0-4471-AE3F-7C7C956EF662
|
47
|
+
- name: Switzerland
|
48
|
+
host: swiss.privateinternetaccess.com
|
49
|
+
shared_secret: mysafety
|
50
|
+
uuid: A3B894CD-88A1-45C6-BB2A-EC77DE6262F0
|
51
|
+
- name: Netherlands
|
52
|
+
host: nl.privateinternetaccess.com
|
53
|
+
shared_secret: mysafety
|
54
|
+
uuid: 3DC2A875-81B9-4B16-97F6-A046D17AB22E
|
55
|
+
- name: Sweden
|
56
|
+
host: sweden.privateinternetaccess.com
|
57
|
+
shared_secret: mysafety
|
58
|
+
uuid: FC1DE0BE-B132-4A05-B493-AA5EAC048EC1
|
59
|
+
- name: France
|
60
|
+
host: france.privateinternetaccess.com
|
61
|
+
shared_secret: mysafety
|
62
|
+
uuid: 141C6848-16C4-4864-9A2C-05375EBD48BB
|
63
|
+
- name: Germany
|
64
|
+
host: germany.privateinternetaccess.com
|
65
|
+
shared_secret: mysafety
|
66
|
+
uuid: CB6BACB2-CAB7-4AF7-95D5-4ED510DA1F0E
|
67
|
+
- name: Romania
|
68
|
+
host: ro.privateinternetaccess.com
|
69
|
+
shared_secret: mysafety
|
70
|
+
uuid: 06B9DD78-E3A3-4717-91DC-D7F1189CBB35
|
71
|
+
- name: Hong Kong
|
72
|
+
host: hk.privateinternetaccess.com
|
73
|
+
shared_secret: mysafety
|
74
|
+
uuid: AA740582-AE45-48F2-8E85-E167413E9646
|
75
|
+
- name: Israel
|
76
|
+
host: israel.privateinternetaccess.com
|
77
|
+
shared_secret: mysafety
|
78
|
+
uuid: 11D1D493-AF0E-406F-86A3-219750606321
|
79
|
+
- name: Australia
|
80
|
+
host: aus.privateinternetaccess.com
|
81
|
+
shared_secret: mysafety
|
82
|
+
uuid: E62D2A3A-3CE5-4B4A-B96C-57DB6FBF8256
|
83
|
+
- name: Japan
|
84
|
+
host: japan.privateinternetaccess.com
|
85
|
+
shared_secret: mysafety
|
86
|
+
uuid: 72FE6636-355C-4E7A-B4D3-9ABEDDE31948
|
data/exe/vpn-config
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "vpn/config"
|
3
|
+
|
4
|
+
module VPN
|
5
|
+
module Config
|
6
|
+
class CLI < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
desc "generate OUTPUT_FILE", "Generate a VPN .mobileconfig file for OS X or iOS. \n\nSigning uses a self-signed snake-oil certificate by default."
|
10
|
+
method_option :username, type: :string, required: true, banner: "VPN_USERNAME", aliases: "-u"
|
11
|
+
method_option :password, type: :string, required: true, banner: "VPN_PASSWORD", aliases: "-p"
|
12
|
+
method_option :endpoints, type: :array, default: [], banner: "VPN_ENDPOINTS", aliases: "-e"
|
13
|
+
method_option :provider, type: :string, default: "Private Internet Access", banner: "VPN_PROVIDER", required: false, aliases: "-w"
|
14
|
+
method_option :identifier, type: :string, required: false, default: "com.example.vpn", aliases: "-i"
|
15
|
+
method_option :certificate_path, type: :string, required: false, banner: "PKCS12_CERTIFICATE", aliases: "-C"
|
16
|
+
method_option :certificate_pass, type: :string, required: false, banner: "PASSPHRASE", aliases: "-P"
|
17
|
+
method_option :sign, type: :boolean, default: false, aliases: "-S"
|
18
|
+
method_option :data_file, type: :string, required: false, banner: "YAML_FILE", aliases: "-d"
|
19
|
+
def generate(output_file)
|
20
|
+
datafile = if options[:data_file]
|
21
|
+
File.expand_path(options[:data_file])
|
22
|
+
end
|
23
|
+
|
24
|
+
certificate_path = if options[:certificate_path]
|
25
|
+
File.expand_path(options[:certificate_path])
|
26
|
+
end
|
27
|
+
|
28
|
+
generator = VPN::Config::Generator.new(
|
29
|
+
auth_name: options[:username],
|
30
|
+
auth_pass: options[:password],
|
31
|
+
identifier: options[:identifier],
|
32
|
+
certificate_path: certificate_path,
|
33
|
+
certificate_pass: options[:certificate_pass],
|
34
|
+
endpoints: options[:endpoints],
|
35
|
+
provider: options[:provider],
|
36
|
+
data_file: datafile
|
37
|
+
)
|
38
|
+
|
39
|
+
plist = if options[:sign]
|
40
|
+
generator.generate_signed_plist
|
41
|
+
else
|
42
|
+
generator.generate_plist
|
43
|
+
end
|
44
|
+
|
45
|
+
if output_file.nil? || output_file.empty?
|
46
|
+
puts plist
|
47
|
+
else
|
48
|
+
unless output_file =~ /\.(mobileconfig|plist)\z/i
|
49
|
+
output_file = output_file + ".mobileconfig"
|
50
|
+
end
|
51
|
+
|
52
|
+
out_path = File.expand_path(output_file)
|
53
|
+
puts "Writing to: #{out_path}"
|
54
|
+
|
55
|
+
File.open(output_file, "wb") do |f|
|
56
|
+
f << plist
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "providers", "List known VPN providers"
|
62
|
+
method_option :data_file, type: :string, required: false, banner: "YAML_FILE", aliases: "-d"
|
63
|
+
method_option :verbose, type: :boolean, default: false, aliases: "-v"
|
64
|
+
def providers
|
65
|
+
datafile = if options[:data_file]
|
66
|
+
File.expand_path(options[:data_file])
|
67
|
+
end
|
68
|
+
|
69
|
+
generator = VPN::Config::Generator.new(data_file: datafile)
|
70
|
+
generator.providers.each do |pr|
|
71
|
+
puts "* " + pr["name"]
|
72
|
+
if options[:verbose]
|
73
|
+
puts " * URL: " + pr["url"]
|
74
|
+
puts " * UUID: " + pr["uuid"]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "endpoints PROVIDER", "List known VPN endpoints for a given provider"
|
80
|
+
method_option :data_file, type: :string, required: false, banner: "YAML_FILE", aliases: "-d"
|
81
|
+
method_option :verbose, type: :boolean, default: false, aliases: "-v"
|
82
|
+
def endpoints(provider="Private Internet Access")
|
83
|
+
datafile = if options[:data_file]
|
84
|
+
File.expand_path(options[:data_file])
|
85
|
+
end
|
86
|
+
|
87
|
+
generator = VPN::Config::Generator.new(data_file: datafile)
|
88
|
+
provider = generator.providers.find {|pr| pr["name"] =~ Regexp.new(provider, Regexp::IGNORECASE) }
|
89
|
+
if provider
|
90
|
+
provider["endpoints"].each do |e|
|
91
|
+
puts "* " + e["name"]
|
92
|
+
if options[:verbose]
|
93
|
+
puts " * Host: " + e["host"]
|
94
|
+
puts " * UUID: " + e["uuid"]
|
95
|
+
puts " * SharedSecret: " + e["shared_secret"]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
else
|
99
|
+
abort "No provider found"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "plist"
|
3
|
+
require "openssl"
|
4
|
+
|
5
|
+
module VPN
|
6
|
+
module Config
|
7
|
+
class Generator
|
8
|
+
attr_accessor :auth_name, :auth_pass, :identifier, :certificate_path,
|
9
|
+
:certificate_pass, :provider, :endpoints, :data_file
|
10
|
+
|
11
|
+
def initialize(auth_name: nil, auth_pass: nil, identifier: nil,
|
12
|
+
certificate_path: nil, certificate_pass: nil, provider: nil,
|
13
|
+
endpoints: nil, data_file: nil)
|
14
|
+
@auth_name = auth_name
|
15
|
+
@auth_pass = auth_pass
|
16
|
+
@identifier = identifier || "com.example.vpn"
|
17
|
+
@certificate_path = certificate_path
|
18
|
+
@certificate_pass = certificate_pass
|
19
|
+
@provider = provider || "Private Internet Access"
|
20
|
+
@endpoints = endpoints
|
21
|
+
@data_file = data_file || VPN::Config::PROVIDERS_PATH
|
22
|
+
end
|
23
|
+
|
24
|
+
def providers
|
25
|
+
@providers ||= YAML.load_file(data_file)["providers"]
|
26
|
+
end
|
27
|
+
|
28
|
+
def selected_provider
|
29
|
+
@selected_provider ||= begin
|
30
|
+
prov = providers.find {|pr| pr["name"] == provider }
|
31
|
+
if prov
|
32
|
+
prov
|
33
|
+
else
|
34
|
+
raise ArgumentError, "Provider '#{provider}' not found"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def vpns
|
40
|
+
@vpns ||= selected_provider["endpoints"]
|
41
|
+
end
|
42
|
+
|
43
|
+
def enabled_vpns
|
44
|
+
if endpoints && endpoints.any?
|
45
|
+
vpns.select {|e| endpoints.include? e["name"] }
|
46
|
+
else
|
47
|
+
vpns
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate_plist
|
52
|
+
config.to_plist
|
53
|
+
end
|
54
|
+
|
55
|
+
def generate_signed_plist
|
56
|
+
private_key = p12.key
|
57
|
+
signing_cert = p12.certificate
|
58
|
+
|
59
|
+
private_key = p12.key
|
60
|
+
intermediate_certs = p12.ca_certs
|
61
|
+
signing_cert = p12.certificate
|
62
|
+
|
63
|
+
# Read configuration profile
|
64
|
+
configuration_profile_data = generate_plist
|
65
|
+
|
66
|
+
# Sign the configuration profile
|
67
|
+
signing_flags = OpenSSL::PKCS7::BINARY
|
68
|
+
signature = OpenSSL::PKCS7.sign(signing_cert, private_key,
|
69
|
+
configuration_profile_data, intermediate_certs,
|
70
|
+
signing_flags)
|
71
|
+
|
72
|
+
signature.to_der
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def p12
|
78
|
+
@p12 ||= begin
|
79
|
+
if certificate_path
|
80
|
+
path = File.expand_path(certificate_path)
|
81
|
+
unless File.exists? path
|
82
|
+
raise ArgumentError, "File not found: #{certificate_path}"
|
83
|
+
end
|
84
|
+
cert = File.read(path)
|
85
|
+
OpenSSL::PKCS12.new(cert, certificate_pass)
|
86
|
+
else
|
87
|
+
default_p12
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def default_p12
|
93
|
+
@default_certificate ||= begin
|
94
|
+
path = File.expand_path("../../../../snake-oil/certificate.p12", __FILE__)
|
95
|
+
cert = File.read(path)
|
96
|
+
OpenSSL::PKCS12.new(cert, "Swordfish")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def config
|
101
|
+
{
|
102
|
+
"PayloadDescription" => "VPN settings for #{selected_provider["name"]}",
|
103
|
+
"PayloadDisplayName" => selected_provider["name"],
|
104
|
+
"PayloadIdentifier" => identifier,
|
105
|
+
"PayloadOrganization" => "",
|
106
|
+
"PayloadRemovalDisallowed" => false,
|
107
|
+
"PayloadType" => "Configuration",
|
108
|
+
"PayloadUUID" => selected_provider["uuid"],
|
109
|
+
"PayloadVersion" => 1,
|
110
|
+
|
111
|
+
"PayloadContent" => enabled_vpns.each_with_index.map do |vpn, index|
|
112
|
+
{
|
113
|
+
"EAP" => {},
|
114
|
+
"IPSec" => {
|
115
|
+
"AuthenticationMethod" => "SharedSecret",
|
116
|
+
"SharedSecret" => StringIO.new(vpn["shared_secret"]),
|
117
|
+
},
|
118
|
+
"IPv4" => {
|
119
|
+
"OverridePrimary" => 1
|
120
|
+
},
|
121
|
+
"PPP" => {
|
122
|
+
"AuthName" => auth_name,
|
123
|
+
"AuthPassword" => auth_pass,
|
124
|
+
"TokenCard" => false,
|
125
|
+
"CommRemoteAddress" => vpn["host"],
|
126
|
+
},
|
127
|
+
"PayloadDescription" => "Configures VPN settings, including authentication.",
|
128
|
+
"PayloadDisplayName" => "VPN (#{vpn["name"]})",
|
129
|
+
"PayloadIdentifier" => "#{identifier}.vpn#{index}",
|
130
|
+
"PayloadOrganization" => "",
|
131
|
+
"PayloadType" => "com.apple.vpn.managed",
|
132
|
+
"PayloadUUID" => vpn["uuid"],
|
133
|
+
"PayloadVersion" => 1,
|
134
|
+
"Proxies" => {},
|
135
|
+
"UserDefinedName" => vpn["name"],
|
136
|
+
"VPNType" => "L2TP"
|
137
|
+
}
|
138
|
+
end
|
139
|
+
}
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
data/lib/vpn/config.rb
ADDED
Binary file
|
data/vpn-config.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vpn/config/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vpn-config"
|
8
|
+
spec.version = VPN::Config::VERSION
|
9
|
+
spec.authors = ["Matias Korhonen"]
|
10
|
+
spec.email = ["matias@kiskolabs.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Generate iOS/OS X configuration profiles for VPNs}
|
13
|
+
spec.description = %q{Generate signed and unsigned iOS/OS X configuration profiles for VPNs}
|
14
|
+
spec.homepage = "https://github.com/matiaskorhonen/vpn-config"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "plist"
|
23
|
+
spec.add_dependency "thor"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "minitest", "~> 5.5.1"
|
28
|
+
spec.add_development_dependency "simplecov", "~> 0.9.2"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vpn-config
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matias Korhonen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: plist
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 5.5.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 5.5.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.9.2
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.9.2
|
97
|
+
description: Generate signed and unsigned iOS/OS X configuration profiles for VPNs
|
98
|
+
email:
|
99
|
+
- matias@kiskolabs.com
|
100
|
+
executables:
|
101
|
+
- vpn-config
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CHANGELOG.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- data/providers.yml
|
115
|
+
- exe/vpn-config
|
116
|
+
- lib/vpn/config.rb
|
117
|
+
- lib/vpn/config/cli.rb
|
118
|
+
- lib/vpn/config/generator.rb
|
119
|
+
- lib/vpn/config/version.rb
|
120
|
+
- snake-oil/certificate.p12
|
121
|
+
- vpn-config.gemspec
|
122
|
+
homepage: https://github.com/matiaskorhonen/vpn-config
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.4.6
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Generate iOS/OS X configuration profiles for VPNs
|
146
|
+
test_files: []
|