vpnmaker 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Rakefile +0 -63
- data/VERSION +1 -1
- data/bin/vpnmaker +50 -70
- data/vpnmaker.gemspec +5 -2
- metadata +19 -3
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
2
|
require 'rubygems'
|
4
3
|
require 'bundler'
|
5
4
|
begin
|
@@ -26,23 +25,6 @@ Jeweler::Tasks.new do |gem|
|
|
26
25
|
end
|
27
26
|
Jeweler::RubygemsDotOrgTasks.new
|
28
27
|
|
29
|
-
# require 'rake/testtask'
|
30
|
-
# Rake::TestTask.new(:test) do |test|
|
31
|
-
# test.libs << 'lib' << 'test'
|
32
|
-
# test.pattern = 'test/**/test_*.rb'
|
33
|
-
# test.verbose = true
|
34
|
-
# end
|
35
|
-
|
36
|
-
# require 'rcov/rcovtask'
|
37
|
-
# Rcov::RcovTask.new do |test|
|
38
|
-
# test.libs << 'test'
|
39
|
-
# test.pattern = 'test/**/test_*.rb'
|
40
|
-
# test.verbose = true
|
41
|
-
# test.rcov_opts << '--exclude "gems/*"'
|
42
|
-
# end
|
43
|
-
|
44
|
-
# task :default => :test
|
45
|
-
|
46
28
|
require 'rdoc/task'
|
47
29
|
Rake::RDocTask.new do |rdoc|
|
48
30
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
@@ -52,48 +34,3 @@ Rake::RDocTask.new do |rdoc|
|
|
52
34
|
rdoc.rdoc_files.include('README*')
|
53
35
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
36
|
end
|
55
|
-
|
56
|
-
# require 'highline/import'
|
57
|
-
# require File.join(File.dirname(__FILE__), 'vpnmaker')
|
58
|
-
|
59
|
-
# def get_arg(argname, echo=true)
|
60
|
-
# return ENV[argname] if ENV[argname]
|
61
|
-
# ask("Value for #{argname}?") { |q| q.echo = false unless echo }
|
62
|
-
# end
|
63
|
-
|
64
|
-
# namespace :config do
|
65
|
-
# desc 'Generate server config'
|
66
|
-
# task :server => :environment do
|
67
|
-
# puts $manager.config_generator.server
|
68
|
-
# end
|
69
|
-
|
70
|
-
# desc 'Generate client config'
|
71
|
-
# task :client => :environment do
|
72
|
-
# username = get_arg('username')
|
73
|
-
# puts $manager.config_generator.client($manager.user(username))
|
74
|
-
# end
|
75
|
-
# end
|
76
|
-
|
77
|
-
# namespace :user do
|
78
|
-
# desc 'Create a new user'
|
79
|
-
# task :create => :environment do
|
80
|
-
# cn = get_arg('cn')
|
81
|
-
# name = get_arg('name')
|
82
|
-
# email = get_arg('email')
|
83
|
-
# password = get_arg('password', false)
|
84
|
-
# confirm_password = get_arg('confirm_password', false)
|
85
|
-
# raise ArgumentError.new("Password mismatch") unless password == confirm_password
|
86
|
-
|
87
|
-
# if password.length > 0
|
88
|
-
# $manager.create_user(cn, name, email, password)
|
89
|
-
# else
|
90
|
-
# $manager.create_user(cn, name, email)
|
91
|
-
# end
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
|
95
|
-
# # Set up environment
|
96
|
-
# task :environment do
|
97
|
-
# vpndir = get_arg('vpndir')
|
98
|
-
# $manager = VPNMaker::Manager.new(vpndir)
|
99
|
-
# end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.11
|
data/bin/vpnmaker
CHANGED
@@ -2,35 +2,20 @@
|
|
2
2
|
require_relative '../lib/vpnmaker.rb'
|
3
3
|
#require 'micro-optparse'
|
4
4
|
#require 'highline'
|
5
|
+
require 'ya_email_validator'
|
5
6
|
require 'highline/import'
|
6
7
|
require 'main'
|
7
8
|
|
9
|
+
# This validates email addresses
|
10
|
+
class String; include YaEmailValidator; end
|
11
|
+
|
8
12
|
#TODO: use ~/.vpnmaker .vpnmaker and /etc/vpnmaker | maybe vpnmakerrc
|
9
13
|
module VPNMaker
|
10
14
|
module CLI
|
11
|
-
module RFC822
|
12
|
-
EmailAddress = begin
|
13
|
-
qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'
|
14
|
-
dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'
|
15
|
-
atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-' +
|
16
|
-
'\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'
|
17
|
-
quoted_pair = '\\x5c[\\x00-\\x7f]'
|
18
|
-
domain_literal = "\\x5b(?:#{dtext}|#{quoted_pair})*\\x5d"
|
19
|
-
quoted_string = "\\x22(?:#{qtext}|#{quoted_pair})*\\x22"
|
20
|
-
domain_ref = atom
|
21
|
-
sub_domain = "(?:#{domain_ref}|#{domain_literal})"
|
22
|
-
word = "(?:#{atom}|#{quoted_string})"
|
23
|
-
domain = "#{sub_domain}(?:\\x2e#{sub_domain})*"
|
24
|
-
local_part = "#{word}(?:\\x2e#{word})*"
|
25
|
-
addr_spec = "#{local_part}\\x40#{domain}"
|
26
|
-
pattern = /\A#{addr_spec.force_encoding('ASCII-8BIT')}\z/
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
15
|
class Options
|
31
16
|
# main DSL
|
32
17
|
Main do
|
33
|
-
version
|
18
|
+
version File.read(File.expand_path("../..", __FILE__) + "/VERSION")
|
34
19
|
author 'Copyleft(cl) VoipScout - No rights reserved'
|
35
20
|
|
36
21
|
mode('init') {
|
@@ -74,7 +59,7 @@ module VPNMaker
|
|
74
59
|
required
|
75
60
|
cast :string
|
76
61
|
arity 1
|
77
|
-
validate {|e| e
|
62
|
+
validate {|e| e.email?}
|
78
63
|
}
|
79
64
|
|
80
65
|
} #mode 'cli'
|
@@ -90,46 +75,9 @@ module VPNMaker
|
|
90
75
|
arity 1
|
91
76
|
validate {|dir| File.directory?(File.expand_path(dir))}
|
92
77
|
}
|
93
|
-
def run
|
94
|
-
name = params['conf_name'].value
|
95
|
-
dir = params['new_dir_path'].value
|
96
|
-
|
97
|
-
VPNMaker.generate name, dir
|
98
|
-
|
99
|
-
data_dir = (File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + "_data")
|
100
|
-
template_dir = (File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + "_templates")
|
101
|
-
client_config_dir = (File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + "_client_configs")
|
102
78
|
|
103
|
-
|
104
|
-
|
105
|
-
FileUtils.cp Dir.glob(lib_dir + "/*.haml"), template_dir
|
106
|
-
|
107
|
-
if params['email'].given?
|
108
|
-
initial_config = {
|
109
|
-
:key_properties => {
|
110
|
-
:country => params['country'].value,
|
111
|
-
:province => params['province'].value,
|
112
|
-
:city => params['city'].value,
|
113
|
-
:organization => params['organization'].value,
|
114
|
-
:organization_unit => params['organization_unit'].value,
|
115
|
-
:common_name => params['common_name'].value,
|
116
|
-
:name => params['key_name'].value,
|
117
|
-
:email => params['email'].value
|
118
|
-
},
|
119
|
-
:site => {
|
120
|
-
:data_dir => data_dir.split('/').last,
|
121
|
-
:template_dir => template_dir.split('/').last,
|
122
|
-
:client_conf_dir => client_config_dir.split('/').last
|
123
|
-
}
|
124
|
-
}
|
125
|
-
example_config = YAML.load_file(lib_dir + "/example_vpnmaker_site.config.yaml").to_yaml.gsub(/\n|---/, "\n#")
|
126
|
-
File.open((File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + ".config.yaml"), 'w') {|f| f.write(initial_config.to_yaml + example_config)}
|
127
|
-
mgr = VPNMaker::Manager.new((File.expand_path(dir) + "/" + name + ".vpn"))
|
128
|
-
mgr.build_ca
|
129
|
-
say("Please edit files in #{template_dir} and #{dir}/#{name}.vpn/#{name}.config.yaml before proceeding further")
|
130
|
-
else
|
131
|
-
say('Time to mod yaml files')
|
132
|
-
end
|
79
|
+
def run
|
80
|
+
get_init_config
|
133
81
|
end
|
134
82
|
}
|
135
83
|
|
@@ -294,23 +242,55 @@ EOS
|
|
294
242
|
|
295
243
|
}
|
296
244
|
|
297
|
-
# Global run() is overwritten by specific mode run
|
298
|
-
def run
|
299
|
-
puts "Hitting global run()"
|
300
|
-
params.each {|p| pp "#{p.class} - #{p.name} => #{p.value}"}
|
301
|
-
@opts = params
|
302
|
-
pp @opts
|
303
|
-
end
|
304
|
-
|
305
245
|
def db
|
306
246
|
VPNMaker::Manager.new params['dir'].value
|
307
247
|
end
|
308
248
|
|
249
|
+
def get_init_config
|
250
|
+
name = params['conf_name'].value
|
251
|
+
dir = params['new_dir_path'].value
|
309
252
|
|
310
|
-
|
253
|
+
VPNMaker.generate name, dir
|
311
254
|
|
312
|
-
|
255
|
+
data_dir = (File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + "_data")
|
256
|
+
template_dir = (File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + "_templates")
|
257
|
+
client_config_dir = (File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + "_client_configs")
|
258
|
+
|
259
|
+
[data_dir, template_dir, client_config_dir].each {|dir| FileUtils.mkdir_p(dir)}
|
260
|
+
lib_dir = File.dirname(File.expand_path __FILE__).gsub('/bin', '/lib')
|
261
|
+
FileUtils.cp Dir.glob(lib_dir + "/*.haml"), template_dir
|
262
|
+
|
263
|
+
if params['email'].given?
|
264
|
+
initial_config = {
|
265
|
+
:key_properties => {
|
266
|
+
:country => params['country'].value,
|
267
|
+
:province => params['province'].value,
|
268
|
+
:city => params['city'].value,
|
269
|
+
:organization => params['organization'].value,
|
270
|
+
:organization_unit => params['organization_unit'].value,
|
271
|
+
:common_name => params['common_name'].value,
|
272
|
+
:name => params['key_name'].value,
|
273
|
+
:email => params['email'].value
|
274
|
+
},
|
275
|
+
:site => {
|
276
|
+
:data_dir => data_dir.split('/').last,
|
277
|
+
:template_dir => template_dir.split('/').last,
|
278
|
+
:client_conf_dir => client_config_dir.split('/').last
|
279
|
+
}
|
280
|
+
}
|
313
281
|
|
282
|
+
example_config = YAML.load_file(lib_dir + "/example_vpnmaker_site.config.yaml").to_yaml.gsub(/\n|---/, "\n#")
|
283
|
+
File.open((File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + ".config.yaml"), 'w') {|f| f.write(initial_config.to_yaml + example_config)}
|
284
|
+
mgr = VPNMaker::Manager.new((File.expand_path(dir) + "/" + name + ".vpn"))
|
285
|
+
mgr.build_ca
|
286
|
+
say("Please edit files in #{template_dir} and #{dir}/#{name}.vpn/#{name}.config.yaml before proceeding further")
|
287
|
+
else
|
288
|
+
say('Time to mod yaml files')
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
end # Main {}
|
293
|
+
end #class Options
|
314
294
|
end #module CLI
|
315
295
|
end #module VPNMaker
|
316
296
|
|
data/vpnmaker.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "vpnmaker"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Voip Scout"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-12"
|
13
13
|
s.description = "haml templates and key tracking"
|
14
14
|
s.email = "voipscout@gmail.com"
|
15
15
|
s.executables = ["vpnmaker"]
|
@@ -55,6 +55,7 @@ Gem::Specification.new do |s|
|
|
55
55
|
s.add_runtime_dependency(%q<gibberish>, [">= 0"])
|
56
56
|
s.add_runtime_dependency(%q<chronic>, [">= 0"])
|
57
57
|
s.add_runtime_dependency(%q<ipaddr_extensions>, [">= 0"])
|
58
|
+
s.add_runtime_dependency(%q<ya_email_validator>, [">= 0"])
|
58
59
|
s.add_development_dependency(%q<pry>, [">= 0"])
|
59
60
|
s.add_development_dependency(%q<pry-doc>, [">= 0"])
|
60
61
|
s.add_development_dependency(%q<pry-rails>, [">= 0"])
|
@@ -72,6 +73,7 @@ Gem::Specification.new do |s|
|
|
72
73
|
s.add_dependency(%q<gibberish>, [">= 0"])
|
73
74
|
s.add_dependency(%q<chronic>, [">= 0"])
|
74
75
|
s.add_dependency(%q<ipaddr_extensions>, [">= 0"])
|
76
|
+
s.add_dependency(%q<ya_email_validator>, [">= 0"])
|
75
77
|
s.add_dependency(%q<pry>, [">= 0"])
|
76
78
|
s.add_dependency(%q<pry-doc>, [">= 0"])
|
77
79
|
s.add_dependency(%q<pry-rails>, [">= 0"])
|
@@ -90,6 +92,7 @@ Gem::Specification.new do |s|
|
|
90
92
|
s.add_dependency(%q<gibberish>, [">= 0"])
|
91
93
|
s.add_dependency(%q<chronic>, [">= 0"])
|
92
94
|
s.add_dependency(%q<ipaddr_extensions>, [">= 0"])
|
95
|
+
s.add_dependency(%q<ya_email_validator>, [">= 0"])
|
93
96
|
s.add_dependency(%q<pry>, [">= 0"])
|
94
97
|
s.add_dependency(%q<pry-doc>, [">= 0"])
|
95
98
|
s.add_dependency(%q<pry-rails>, [">= 0"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vpnmaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|
@@ -107,6 +107,22 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: ya_email_validator
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
110
126
|
- !ruby/object:Gem::Dependency
|
111
127
|
name: pry
|
112
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -311,7 +327,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
311
327
|
version: '0'
|
312
328
|
segments:
|
313
329
|
- 0
|
314
|
-
hash:
|
330
|
+
hash: -930937730295424088
|
315
331
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
316
332
|
none: false
|
317
333
|
requirements:
|