From 48c0e0654497a0736fb76e15d8a422f68d181ee4 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 26 Aug 2011 16:34:17 +0200 Subject: [PATCH] feature #754: Fix bugs for server authN --- src/authm_mad/remotes/server/authenticate | 3 ++- src/authm_mad/remotes/server/server_auth.rb | 18 ++---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/authm_mad/remotes/server/authenticate b/src/authm_mad/remotes/server/authenticate index 5cb282c1d8..20f0a2ebe8 100755 --- a/src/authm_mad/remotes/server/authenticate +++ b/src/authm_mad/remotes/server/authenticate @@ -39,8 +39,9 @@ secret = ARGV[2] # Base64 encoded secret as obtained from login_token begin server_auth = ServerAuth.new + dsecret = Base64::decode64(secret) - rc = server_auth.authenticate(user, pass, secret) + rc = server_auth.authenticate(user, pass, dsecret) rescue => e OpenNebula.error_message e.message exit -1 diff --git a/src/authm_mad/remotes/server/server_auth.rb b/src/authm_mad/remotes/server/server_auth.rb index 0f699bef2d..23bca5819c 100644 --- a/src/authm_mad/remotes/server/server_auth.rb +++ b/src/authm_mad/remotes/server/server_auth.rb @@ -18,18 +18,6 @@ require 'openssl' require 'base64' require 'fileutils' -ONE_LOCATION=ENV["ONE_LOCATION"] - -if !ONE_LOCATION - RUBY_LIB_LOCATION="/usr/lib/one/ruby" - ETC_LOCATION="/etc/one/" -else - RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" - ETC_LOCATION=ONE_LOCATION+"/etc/" -end - -$: << RUBY_LIB_LOCATION - require 'x509_auth' # Server authentication class. This authmethod can be used by opennebula services @@ -65,10 +53,8 @@ class ServerAuth < X509Auth end begin - certs = Array.new - certs[0] = File.read(@options[:host_cert]) - - key = File.read(@options[:host_key]) + certs = [ File.read(@options[:one_cert]) ] + key = File.read(@options[:one_key]) super(:certs_pem => certs, :key_pem => key,