mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-19 03:12:55 +09:00
feature #754: simple driver that implements plain auth (that in OpenNebula core). Removed debug messages
This commit is contained in:
1 parent
2a0b2818d4
commit
b421a874e0
4 files changed
+31
-19
No files matched your search
@@ -224,6 +224,7 @@ VAR_DIRS="$VAR_LOCATION/remotes \
|
||||
$VAR_LOCATION/remotes/image \
|
||||
$VAR_LOCATION/remotes/image/fs \
|
||||
$VAR_LOCATION/remotes/auth \
|
||||
$VAR_LOCATION/remotes/auth/plain \
|
||||
$VAR_LOCATION/remotes/auth/ssh"
|
||||
|
||||
SUNSTONE_DIRS="$SUNSTONE_LOCATION/models \
|
||||
@@ -317,6 +318,7 @@ INSTALL_FILES=(
|
||||
IM_PROBES_XEN_FILES:$VAR_LOCATION/remotes/im/xen.d
|
||||
IM_PROBES_GANGLIA_FILES:$VAR_LOCATION/remotes/im/ganglia.d
|
||||
AUTH_SSH_FILES:$VAR_LOCATION/remotes/auth/ssh
|
||||
AUTH_PLAIN_FILES:$VAR_LOCATION/remotes/auth/plain
|
||||
VMM_EXEC_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm
|
||||
VMM_EXEC_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen
|
||||
VMM_EXEC_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll
|
||||
@@ -577,6 +579,8 @@ IM_PROBES_GANGLIA_FILES="src/im_mad/remotes/ganglia.d/ganglia_probe"
|
||||
#-------------------------------------------------------------------------------
|
||||
AUTH_SSH_FILES="src/authm_mad/remotes/ssh/authenticate"
|
||||
|
||||
AUTH_PLAIN_FILES="src/authm_mad/remotes/plain/authenticate"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Transfer Manager commands, to be installed under $LIB_LOCATION/tm_commands
|
||||
# - NFS TM, $LIB_LOCATION/tm_commands/nfs
|
||||
|
||||
@@ -111,6 +111,8 @@ class AuthDriver < OpenNebulaDriver
|
||||
|
||||
requests.flatten!
|
||||
|
||||
#OpenNebula.log_debug("#{request_id} #{user_id} #{requests}")
|
||||
|
||||
if @authZ_cmd == nil
|
||||
if requests[-1] == "1"
|
||||
result = RESULT[:success]
|
||||
|
||||
Regular → Executable
+25
-16
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
|
||||
# #
|
||||
@@ -14,22 +16,29 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# Password authentication module. This one just compares stored password
|
||||
# with the token sent by the client.
|
||||
class SimpleAuth
|
||||
# Method called by authentication driver. It should awnser true if
|
||||
# successful or a string with the error message if failure. All
|
||||
# parameters are strings extracted from the authorization message.
|
||||
#
|
||||
# * user_id: OpenNebula user identifier
|
||||
# * user: user name
|
||||
# * password: password stored in OpenNebula dabatase
|
||||
# * token: password sent by the client trying to connect
|
||||
def auth(user_id, user, password, token)
|
||||
auth=(password==token)
|
||||
auth="Invalid credentials" if auth!=true or token=='-'
|
||||
auth
|
||||
end
|
||||
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 'scripts_common'
|
||||
|
||||
user = ARGV[0]
|
||||
pass = ARGV[1]
|
||||
secret = ARGV[2]
|
||||
|
||||
#OpenNebula.log_debug("Authenticating #{user}, with password #{pass} (#{secret})")
|
||||
|
||||
if pass == secret
|
||||
exit 0
|
||||
else
|
||||
OpenNebula.error_message "Invalid credentials"
|
||||
exit -1
|
||||
end
|
||||
@@ -253,9 +253,6 @@ bool UserPool::authenticate(const string& session,
|
||||
|
||||
ar.add_authenticate(username,u_pass,secret);
|
||||
|
||||
NebulaLog::log("AuM********",Log::ERROR,username);
|
||||
NebulaLog::log("AuM*********",Log::ERROR,u_pass);
|
||||
NebulaLog::log("AuM**********",Log::ERROR,secret);
|
||||
if ( uid == 0 ) //oneadmin
|
||||
{
|
||||
if (ar.plain_authenticate())
|
||||
|
||||
Reference in new issue
Block a user