mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-19 06:50:07 +03:00
bug #847: Update method to get server credentials from etc files
This commit is contained in:
parent
198c60b6a4
commit
4da3123d05
@ -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!
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user