bin/vpnmaker in vpnmaker-1.0.0 vs bin/vpnmaker in vpnmaker-1.0.1
- old
+ new
@@ -53,10 +53,25 @@
argument('organization') {
required
cast :string
arity 1
}
+ argument('organization_unit') {
+ required
+ cast :string
+ arity 1
+ }
+ argument('common_name') {
+ required
+ cast :string
+ arity 1
+ }
+ argument('key_name') {
+ required
+ cast :string
+ arity 1
+ }
argument('email') {
required
cast :string
arity 1
validate {|e| e =~ RFC822::EmailAddress}
@@ -94,19 +109,22 @@
:key_properties => {
:country => params['country'].value,
:province => params['province'].value,
:city => params['city'].value,
:organization => params['organization'].value,
+ :organization_unit => params['organization_unit'].value,
+ :common_name => params['common_name'].value,
+ :name => params['key_name'].value,
:email => params['email'].value
},
:site => {
:data_dir => data_dir.split('/').last,
:template_dir => template_dir.split('/').last,
:client_conf_dir => client_config_dir.split('/').last
}
}
- example_config = YAML.load_file(lib_dir + "/example_vpnmaker_site.config.yaml").to_yaml.gsub(/\n|---/, "\n# ")
+ example_config = YAML.load_file(lib_dir + "/example_vpnmaker_site.config.yaml").to_yaml.gsub(/\n|---/, "\n#")
File.open((File.expand_path(dir) + "/" + name + ".vpn" + "/" + name + ".config.yaml"), 'w') {|f| f.write(initial_config.to_yaml + example_config)}
mgr = VPNMaker::Manager.new((File.expand_path(dir) + "/" + name + ".vpn"))
mgr.build_ca
say("Please edit files in #{template_dir} and #{dir}/#{name}.vpn/#{name}.config.yaml before proceeding further")
else
@@ -176,11 +194,12 @@
default 'passwd'
}
def run
params['client_name'].values.each_with_index do |c, i|
- passwd = params['passwd'].values[i] ? params['passwd'].values[i] : params['passwd'].default
- db.create_user(c, c, "#{c}@#{db.config[:key_properties][:email].split('@').last}", passwd) if db.users.select {|r| r =~ /#{c}/}.empty?
+ email = "#{c}@#{db.config[:key_properties][:email].split('@').last}"
+ passwd = params['passwd'].values[i]
+ (passwd ? db.create_user(c, c, email, passwd) : db.create_user(c, c, email)) if db.users.select {|r| r =~ /#{c}/}.empty?
end
end
}
mode('destroy') {