vpnmaker 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +25 -0
- data/README.rdoc +91 -0
- data/Rakefile +99 -0
- data/VERSION +1 -0
- data/bin/vpnmaker +11 -0
- data/foocorp.config.yaml +24 -0
- data/lib/client.haml +13 -0
- data/lib/openssl.haml +144 -0
- data/lib/server.haml +38 -0
- data/lib/vpnmaker.rb +45 -0
- data/lib/vpnmaker/config_generator.rb +36 -0
- data/lib/vpnmaker/key_builder.rb +141 -0
- data/lib/vpnmaker/key_config.rb +9 -0
- data/lib/vpnmaker/key_db.rb +62 -0
- data/lib/vpnmaker/key_tracker.rb +158 -0
- data/lib/vpnmaker/manager.rb +55 -0
- data/vpnmaker.gemspec +99 -0
- metadata +308 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
module VPNMaker
|
2
|
+
class Manager
|
3
|
+
attr_reader :tracker
|
4
|
+
|
5
|
+
def self.vpn_name(dir); dir =~ /(^|\/)([^\/\.]+)\.vpn/ ? $2 : nil; end
|
6
|
+
|
7
|
+
def initialize(dir)
|
8
|
+
name = self.class.vpn_name(File.expand_path(dir))
|
9
|
+
@tracker = KeyTracker.new(name, File.expand_path(dir))
|
10
|
+
end
|
11
|
+
|
12
|
+
def config; @tracker.config; end
|
13
|
+
|
14
|
+
def build_ca; @tracker.builder.build_ca; end
|
15
|
+
def build_server
|
16
|
+
@tracker.builder.build_server_key
|
17
|
+
@tracker.builder.build_ta_key
|
18
|
+
@tracker.builder.build_dh_key
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_user(user, name, email, pass=nil)
|
22
|
+
@tracker.builder.build_key(user, name, email, pass, :add_user)
|
23
|
+
end
|
24
|
+
|
25
|
+
def revoke_all(user)
|
26
|
+
cur = @tracker.active_key_version(user)
|
27
|
+
while cur >= 0
|
28
|
+
unless @tracker.revoked?(user, cur)
|
29
|
+
@tracker.builder.revoke_key(user, cur)
|
30
|
+
end
|
31
|
+
cur -= 1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def regenerate_user(user, pass=nil)
|
36
|
+
revoke_all(user)
|
37
|
+
u = @tracker.user(user)
|
38
|
+
@tracker.builder.build_key(user, u[:name], u[:email], pass, :add_user_key)
|
39
|
+
end
|
40
|
+
|
41
|
+
def delete_user(user)
|
42
|
+
revoke_all(user)
|
43
|
+
end
|
44
|
+
|
45
|
+
def users
|
46
|
+
@tracker.users.keys
|
47
|
+
end
|
48
|
+
|
49
|
+
def user(user)
|
50
|
+
@tracker.user(user)
|
51
|
+
end
|
52
|
+
|
53
|
+
def config_generator; ConfigGenerator.new(self); end
|
54
|
+
end
|
55
|
+
end
|
data/vpnmaker.gemspec
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "vpnmaker"
|
8
|
+
s.version = "0.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Voip Scout"]
|
12
|
+
s.date = "2012-05-06"
|
13
|
+
s.description = "haml templates and key tracking"
|
14
|
+
s.email = "voipscout@gmail.com"
|
15
|
+
s.executables = ["vpnmaker"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"bin/vpnmaker",
|
26
|
+
"foocorp.config.yaml",
|
27
|
+
"lib/client.haml",
|
28
|
+
"lib/openssl.haml",
|
29
|
+
"lib/server.haml",
|
30
|
+
"lib/vpnmaker.rb",
|
31
|
+
"lib/vpnmaker/config_generator.rb",
|
32
|
+
"lib/vpnmaker/key_builder.rb",
|
33
|
+
"lib/vpnmaker/key_config.rb",
|
34
|
+
"lib/vpnmaker/key_db.rb",
|
35
|
+
"lib/vpnmaker/key_tracker.rb",
|
36
|
+
"lib/vpnmaker/manager.rb",
|
37
|
+
"vpnmaker.gemspec"
|
38
|
+
]
|
39
|
+
s.homepage = "http://github.com/voipscout/vpnmaker"
|
40
|
+
s.licenses = ["MIT"]
|
41
|
+
s.require_paths = ["lib"]
|
42
|
+
s.rubygems_version = "1.8.24"
|
43
|
+
s.summary = "Makes it easy to manage OpenVPN"
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_runtime_dependency(%q<ipaddr_extensions>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<haml>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<trollop>, [">= 0"])
|
52
|
+
s.add_runtime_dependency(%q<gibberish>, [">= 0"])
|
53
|
+
s.add_runtime_dependency(%q<rubyzip>, [">= 0"])
|
54
|
+
s.add_development_dependency(%q<pry>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<pry-doc>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<pry-rails>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<pry-nav>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<pry-syntax-hacks>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<pry-stack_explorer>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<pry-exception_explorer>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
62
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<ipaddr_extensions>, [">= 0"])
|
66
|
+
s.add_dependency(%q<haml>, [">= 0"])
|
67
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
68
|
+
s.add_dependency(%q<gibberish>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rubyzip>, [">= 0"])
|
70
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
71
|
+
s.add_dependency(%q<pry-doc>, [">= 0"])
|
72
|
+
s.add_dependency(%q<pry-rails>, [">= 0"])
|
73
|
+
s.add_dependency(%q<pry-nav>, [">= 0"])
|
74
|
+
s.add_dependency(%q<pry-syntax-hacks>, [">= 0"])
|
75
|
+
s.add_dependency(%q<pry-stack_explorer>, [">= 0"])
|
76
|
+
s.add_dependency(%q<pry-exception_explorer>, [">= 0"])
|
77
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
78
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
79
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
80
|
+
end
|
81
|
+
else
|
82
|
+
s.add_dependency(%q<ipaddr_extensions>, [">= 0"])
|
83
|
+
s.add_dependency(%q<haml>, [">= 0"])
|
84
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
85
|
+
s.add_dependency(%q<gibberish>, [">= 0"])
|
86
|
+
s.add_dependency(%q<rubyzip>, [">= 0"])
|
87
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
88
|
+
s.add_dependency(%q<pry-doc>, [">= 0"])
|
89
|
+
s.add_dependency(%q<pry-rails>, [">= 0"])
|
90
|
+
s.add_dependency(%q<pry-nav>, [">= 0"])
|
91
|
+
s.add_dependency(%q<pry-syntax-hacks>, [">= 0"])
|
92
|
+
s.add_dependency(%q<pry-stack_explorer>, [">= 0"])
|
93
|
+
s.add_dependency(%q<pry-exception_explorer>, [">= 0"])
|
94
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
95
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
96
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
metadata
ADDED
@@ -0,0 +1,308 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vpnmaker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Voip Scout
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ipaddr_extensions
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: haml
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: trollop
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: gibberish
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rubyzip
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: pry
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: pry-doc
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: pry-rails
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: pry-nav
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: pry-syntax-hacks
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: pry-stack_explorer
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: pry-exception_explorer
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
- !ruby/object:Gem::Dependency
|
207
|
+
name: rdoc
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
210
|
+
requirements:
|
211
|
+
- - ~>
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '3.12'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ~>
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '3.12'
|
222
|
+
- !ruby/object:Gem::Dependency
|
223
|
+
name: bundler
|
224
|
+
requirement: !ruby/object:Gem::Requirement
|
225
|
+
none: false
|
226
|
+
requirements:
|
227
|
+
- - ! '>='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ! '>='
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
238
|
+
- !ruby/object:Gem::Dependency
|
239
|
+
name: jeweler
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
241
|
+
none: false
|
242
|
+
requirements:
|
243
|
+
- - ! '>='
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: '0'
|
246
|
+
type: :development
|
247
|
+
prerelease: false
|
248
|
+
version_requirements: !ruby/object:Gem::Requirement
|
249
|
+
none: false
|
250
|
+
requirements:
|
251
|
+
- - ! '>='
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '0'
|
254
|
+
description: haml templates and key tracking
|
255
|
+
email: voipscout@gmail.com
|
256
|
+
executables:
|
257
|
+
- vpnmaker
|
258
|
+
extensions: []
|
259
|
+
extra_rdoc_files:
|
260
|
+
- README.rdoc
|
261
|
+
files:
|
262
|
+
- .document
|
263
|
+
- Gemfile
|
264
|
+
- README.rdoc
|
265
|
+
- Rakefile
|
266
|
+
- VERSION
|
267
|
+
- bin/vpnmaker
|
268
|
+
- foocorp.config.yaml
|
269
|
+
- lib/client.haml
|
270
|
+
- lib/openssl.haml
|
271
|
+
- lib/server.haml
|
272
|
+
- lib/vpnmaker.rb
|
273
|
+
- lib/vpnmaker/config_generator.rb
|
274
|
+
- lib/vpnmaker/key_builder.rb
|
275
|
+
- lib/vpnmaker/key_config.rb
|
276
|
+
- lib/vpnmaker/key_db.rb
|
277
|
+
- lib/vpnmaker/key_tracker.rb
|
278
|
+
- lib/vpnmaker/manager.rb
|
279
|
+
- vpnmaker.gemspec
|
280
|
+
homepage: http://github.com/voipscout/vpnmaker
|
281
|
+
licenses:
|
282
|
+
- MIT
|
283
|
+
post_install_message:
|
284
|
+
rdoc_options: []
|
285
|
+
require_paths:
|
286
|
+
- lib
|
287
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
288
|
+
none: false
|
289
|
+
requirements:
|
290
|
+
- - ! '>='
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
293
|
+
segments:
|
294
|
+
- 0
|
295
|
+
hash: -380103579670376846
|
296
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
297
|
+
none: false
|
298
|
+
requirements:
|
299
|
+
- - ! '>='
|
300
|
+
- !ruby/object:Gem::Version
|
301
|
+
version: '0'
|
302
|
+
requirements: []
|
303
|
+
rubyforge_project:
|
304
|
+
rubygems_version: 1.8.24
|
305
|
+
signing_key:
|
306
|
+
specification_version: 3
|
307
|
+
summary: Makes it easy to manage OpenVPN
|
308
|
+
test_files: []
|