diff --git a/src/authm_mad/remotes/ssh/ssh_auth.rb b/src/authm_mad/remotes/ssh/ssh_auth.rb index a0d2915be9..c26f50da9c 100644 --- a/src/authm_mad/remotes/ssh/ssh_auth.rb +++ b/src/authm_mad/remotes/ssh/ssh_auth.rb @@ -24,7 +24,7 @@ require 'fileutils' # as auth method is defined. It also holds some helper methods to be used # by oneauth command class SshAuth - PROXY_PATH = ENV['HOME']+'/.one/one_ssh' + LOGIN_PATH = ENV['HOME']+'/.one/one_ssh' attr_reader :public_key @@ -69,7 +69,7 @@ class SshAuth expire ||= 3600 # Init proxy file path and creates ~/.one directory if needed - proxy_dir = File.dirname(PROXY_PATH) + proxy_dir = File.dirname(LOGIN_PATH) begin FileUtils.mkdir_p(proxy_dir) @@ -84,7 +84,7 @@ class SshAuth proxy = "#{user}:ssh:#{secret_crypted}" - file = File.open(PROXY_PATH, "w") + file = File.open(LOGIN_PATH, "w") file.write(proxy) file.close diff --git a/src/authm_mad/remotes/x509/x509_auth.rb b/src/authm_mad/remotes/x509/x509_auth.rb index 43ffce6127..4fba744a26 100644 --- a/src/authm_mad/remotes/x509/x509_auth.rb +++ b/src/authm_mad/remotes/x509/x509_auth.rb @@ -45,7 +45,7 @@ class X509Auth end if @options[:key_pem] - @key = OpenSSL::PKey::RSA.new(key_pem) + @key = OpenSSL::PKey::RSA.new(@options[:key_pem]) end end @@ -71,7 +71,7 @@ class X509Auth # - user_name:time_expires:cert_chain is base64 encoded def login_token(user, expire) if expire != 0 - expires = Time.now.to_i+expire + expires = Time.now.to_i + expire.to_i else expires = @cert_chain[0].not_after.to_i end diff --git a/src/cli/one_helper/oneuser_helper.rb b/src/cli/one_helper/oneuser_helper.rb index 999755ec98..878abd442d 100644 --- a/src/cli/one_helper/oneuser_helper.rb +++ b/src/cli/one_helper/oneuser_helper.rb @@ -96,12 +96,10 @@ class OneUserHelper < OpenNebulaHelper::OneHelper options[:key] ||= ENV['X509_USER_KEY'] begin - certs = Array.new - certs[0] = File.read(options[:cert]) - - key = File.read(options[:key]) + certs = [File.read(options[:cert])] + key = File.read(options[:key]) - auth = X509Auth.new(:cert=>certs, :key=>key) + auth = X509Auth.new(:certs_pem=>certs, :key_pem=>key) rescue Exception => e return -1, e.message end @@ -130,7 +128,7 @@ class OneUserHelper < OpenNebulaHelper::OneHelper auth.login(username, options[:time]) - return 0, 'export ONE_AUTH=' << auth.class::PROXY_PATH + return 0, 'export ONE_AUTH=' << auth.class::LOGIN_PATH end private diff --git a/src/cli/oneuser b/src/cli/oneuser index 2394319ae8..753d3bb388 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -171,7 +171,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do EOT command :login, login_desc, :username, [:password, nil], - :options=>create_options do + :options=>login_options do helper.login(args[0], options) end