diff --git a/src/authm_mad/remotes/server_cipher/server_cipher_auth.rb b/src/authm_mad/remotes/server_cipher/server_cipher_auth.rb index cac1227736..3e8152b52d 100644 --- a/src/authm_mad/remotes/server_cipher/server_cipher_auth.rb +++ b/src/authm_mad/remotes/server_cipher/server_cipher_auth.rb @@ -53,10 +53,10 @@ class ServerCipherAuth def self.new_client(srv_user=nil, srv_passwd=nil) if ( srv_user == nil || srv_passwd == nil ) begin - if ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? - one_auth = File.read(ENV["ONE_AUTH"]) + if ENV["ONE_CIPHER_AUTH"] and !ENV["ONE_CIPHER_AUTH"].empty? + one_auth = File.read(ENV["ONE_CIPHER_AUTH"]) else - one_auth = File.read(ENV["HOME"]+"/.one/one_auth") + raise "ONE_CIPHER_AUTH environment variable not set" end one_auth.rstrip! diff --git a/src/cloud/ec2/lib/econe-server.rb b/src/cloud/ec2/lib/econe-server.rb index 930c0b9df4..63b1d12461 100644 --- a/src/cloud/ec2/lib/econe-server.rb +++ b/src/cloud/ec2/lib/econe-server.rb @@ -23,10 +23,12 @@ if !ONE_LOCATION RUBY_LIB_LOCATION = "/usr/lib/one/ruby" CONFIGURATION_FILE = "/etc/one/econe.conf" TEMPLATE_LOCATION = "/etc/one/ec2query_templates" + EC2_AUTH = "/etc/one/auth/ec2_auth" else RUBY_LIB_LOCATION = ONE_LOCATION+"/lib/ruby" CONFIGURATION_FILE = ONE_LOCATION+"/etc/econe.conf" TEMPLATE_LOCATION = ONE_LOCATION+"/etc/ec2query_templates" + EC2_AUTH = ONE_LOCATION + "/etc/one/auth/ec2_auth" end VIEWS_LOCATION = RUBY_LIB_LOCATION + "/cloud/econe/views" @@ -75,7 +77,16 @@ if CloudServer.is_port_open?(settings.config[:server], exit 1 end -set :cloud_auth, CloudAuth.new(settings.config) +begin + ENV["ONE_CIPHER_AUTH"] = EC2_AUTH + cloud_auth = CloudAuth.new(settings.config) +rescue => e + puts "Error initializing authentication system" + puts e.message + exit -1 +end + +set :cloud_auth, cloud_auth econe_host = conf[:ssl_server] econe_host ||= conf[:server] diff --git a/src/cloud/occi/etc/occi-server.conf b/src/cloud/occi/etc/occi-server.conf index 839aa27eb7..d9fb7da197 100644 --- a/src/cloud/occi/etc/occi-server.conf +++ b/src/cloud/occi/etc/occi-server.conf @@ -31,6 +31,7 @@ # occi, for OpenNebula's user-password scheme # x509, for x509 certificates based authentication :auth: occi +:one_cipher_auth: /etc/one/auth/occi_auth # Authentication driver to communicate with OpenNebula core :core_auth: cipher diff --git a/src/cloud/occi/lib/occi-server.rb b/src/cloud/occi/lib/occi-server.rb index 6410ba4e27..69a6b9207c 100755 --- a/src/cloud/occi/lib/occi-server.rb +++ b/src/cloud/occi/lib/occi-server.rb @@ -28,10 +28,12 @@ if !ONE_LOCATION RUBY_LIB_LOCATION="/usr/lib/one/ruby" TEMPLATE_LOCATION="/etc/one/occi_templates" CONFIGURATION_FILE = "/etc/one/occi-server.conf" + OCCI_AUTH = "/etc/one/auth/occi_auth" else RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" TEMPLATE_LOCATION=ONE_LOCATION+"/etc/occi_templates" CONFIGURATION_FILE = ONE_LOCATION+"/etc/occi-server.conf" + OCCI_AUTH = ONE_LOCATION + "/etc/one/auth/occi_auth" end $: << RUBY_LIB_LOCATION @@ -78,7 +80,16 @@ end set :host, settings.config[:server] set :port, settings.config[:port] -set :cloud_auth, CloudAuth.new(settings.config) +begin + ENV["ONE_CIPHER_AUTH"] = OCCI_AUTH + cloud_auth = CloudAuth.new(settings.config) +rescue => e + puts "Error initializing authentication system" + puts e.message + exit -1 +end + +set :cloud_auth, cloud_auth ############################################################################## # Helpers diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 52b4a9d586..8c4d113286 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -25,12 +25,14 @@ if !ONE_LOCATION RUBY_LIB_LOCATION = "/usr/lib/one/ruby" CONFIGURATION_FILE = "/etc/one/sunstone-server.conf" PLUGIN_CONFIGURATION_FILE = "/etc/one/sunstone-plugins.yaml" + SUNSTONE_AUTH = "/etc/one/auth/sunstone_auth" else VAR_LOCATION = ONE_LOCATION+"/var" LOG_LOCATION = ONE_LOCATION+"/var" RUBY_LIB_LOCATION = ONE_LOCATION+"/lib/ruby" CONFIGURATION_FILE = ONE_LOCATION+"/etc/sunstone-server.conf" PLUGIN_CONFIGURATION_FILE = ONE_LOCATION+"/etc/sunstone-plugins.yaml" + SUNSTONE_AUTH = ONE_LOCATION + "/etc/one/auth/sunstone_auth" end SUNSTONE_ROOT_DIR = File.dirname(__FILE__) @@ -66,7 +68,16 @@ set :config, conf set :host, settings.config[:host] set :port, settings.config[:port] -set :cloud_auth, CloudAuth.new(settings.config) +begin + ENV["ONE_CIPHER_AUTH"] = SUNSTONE_AUTH + cloud_auth = CloudAuth.new(settings.config) +rescue => e + puts "Error initializing authentication system" + puts e.message + exit -1 +end + +set :cloud_auth, cloud_auth ############################################################################## # Helpers