Login with Google LDAP is not working (OpenNebula 7.2)

I’m trying to authenticate users using Google LDAP and it’s not working. Login process stay in a delay of 30 secs aprox that on the logs appears:

[Z0][ReM][D]: Req:2626 UID:-1 IP:127.0.0.1 one.user.info invoked -1, 0
[Z0][ReM][E]: Req:2626 UID:- one.user.info result FAILURE [one.user.info] User couldn’t be authenticated, aborting call.

I’ve installed and configured stunnel. Querys directly using openldapsearch are working against localhost:1636 port. The problem is when I’m doing the login using web and cli.

My /etc/one/auth/ldap_auth.conf is:

server 1:

Ldap user able to query, if not set connects as anonymous. For

Active Directory append the domain name. Example:

Administrator@my.domain.com

#:user: ‘admin’
#:password: ‘password’

# Ldap authentication method
:auth_method: :simple

# Ldap server
:host: localhost
:port: 1636

# Connection and authentication timeout
#:timeout: 15

# Uncomment this line for tls connections, use :simple_tls or :start_tls
#:encryption: :plain

#:tls_options:
#   :verify_mode: 0

:bind_dn: 'cn=user'
:bind_pw: 'password'

# base hierarchy where to search for users and groups
:base: 'dc=xxx,dc=cat'

# group the users need to belong to. If not set any user will do
#:group: 'cn=cloud,ou=groups,dc=domain'

# field that holds the user name, if not set 'cn' will be used
:user_field: 'mail'
#:filter: '(mail=%s)'

#:user: 'user'
#:password: 'password'
:timeout: 5
#:disable_referrals: true

# for Active Directory use this user_field instead
#:user_field: 'sAMAccountName'

# field name for group membership, by default it is 'member'
#:group_field: 'member'

# user field that is in the group group_field, if not set 'dn' will be used
#:user_group_field: 'dn'

# Generate mapping file from group template info
:mapping_generate: false

# Seconds a mapping file remain untouched until the next regeneration
:mapping_timeout: 300

# Name of the mapping file in OpenNebula var directory
:mapping_filename: server1.yaml

# Key from the OpenNebula template to map to an AD group
## commented:mapping_key: GROUP_DN

# Default group ID used for users in an AD group not mapped
## commented:mapping_default: 1

# use RFC2307bis for groups
# if false, depending on your LDAP server configuration,
# set user_field and user_group_field 'uid' and group_field 'memberUid'
:rfc2307bis: true

# DN of a group, if user is member of that group in LDAP, this user
# will be group admin of all mapped LDAP groups in OpenNebula.
#:group_admin_group_dn: 'cn=admins,ou=groups,dc=domain'

I’ve installed on the server the ruby-net-ldap

Also the file /etc/one/oned.conf:

AUTH_MAD = [
EXECUTABLE = “one_auth_mad”,
AUTHN = “ssh,x509,ldap,server_cipher,server_x509,saml”
]

I have the user created with authentication driver as ldap and the username is the full email user.

Can anyone help me about this topic or give me some clue?

Thanks,

Jordi.

Can anyone help me about this issue?


Versions of the related components and OS (frontend, hypervisors, VMs):

Steps to reproduce:

Current results:

Expected results:

Hello, bona tarda

I have no experience with Google LDAP but

  • :bind_dn and :bind_pw should not be used.The bind user is created from :user and :password fields. I’m unsure if the bind user here needs the @domain.cat (for Active Directory it is)

  • In some cases I have found that ruby reads the information from /etc/ldap.conf (using native LDAP libraries). If after changing opennebula’s config file it is still not working, please fill it up with the following

# The LDAP server URI (use ldaps:// for SSL/TLS on port 636, or ldap:// for plain on port 389)
uri ldap://localhost:1636

# Default base DN for searching the directory
base dc=example,dc=cat

# Default bind DN (service/admin user used to query the directory)
binddn cn=admin,dc=example,dc=cat

# Default bind password (if supported/required by the client library)
bindpw your_secure_password

# SSL/TLS settings (optional but recommended)
ssl no
# tls_cacertdir /etc/ssl/certs

These should be two points to start

Salut!

Bon dia Buno,

I’ve applied the changes that you are detailing and it’s still not working. The error message in oned.log is:

Tue Oct 20 09:00:32 2026 [Z0][AuM][E]: Auth Error: Request timeout
Tue Oct 20 09:00:32 2026 [Z0][ReM][D]: Req:1959 UID:-1 IP:127.0.0.1 one.user.info invoked -1, 0
Tue Oct 20 09:00:32 2026 [Z0][ReM][E]: Req:1959 UID:- one.user.info result FAILURE [one.user.info] User couldn’t be authenticated, aborting call.

This is my /etc/ldap/ldap.conf (! = #)

! The LDAP server URI (use ldaps:// for SSL/TLS on port 636, or ldap:// for plain on port 389)
uri ldap://localhost:1636

! Default base DN for searching the directory
base dc=itb,dc=cat

! Default bind DN (service/admin user used to query the directory)
binddn cn=xxxxxxxxxxxx

! Default bind password (if supported/required by the client library)
bindpw passwd

! SSL/TLS settings (optional but recommended)
ssl no
! tls_cacertdir /etc/ssl/certs

In /etc/one/auth/ldap_auth.conf I’ve changed this values:

:user: 'cn=xxxxx'
:password: 'xxxxx'

And I’ve restarted opennebula service.

This query works fine:

ldapsearch -H ldap://127.0.0.1:1636 -D “xxxxxx” -W -b “ou=Users,dc=itb,dc=cat” “(mail=jordi.casas@itb.cat)”

Then the connection between my system and Google LDAP works fine. I can’t find any log with more additional information. Any help will be appreciated. Thanks!

Jordi.

Hey,

In this case it would be nice to have a Google LDAP log to check what kind of query is being executed.

OpenNebula’s ldap driver is in /usr/lib/one/ruby/opennebula/ldap_auth.rb. I would back up the file and modify it to check what is done in the function find_user (line ~136). For instance, the result variable can be written to a log file with a line looking like

File.open('/path/to/log/file', 'a') { |f| f.write(result.to_s) }

That may give some more clues about what is happening

Gràcies!

Hi,

I’ve tried to add this line but no log is generated.

Also I’ve added a simple write to a file entering in find_user function:

def find_user(name)
    File.write('/var/log/one/ldap.log', 'Entrant a find_user')
    filter = Net::LDAP::Filter.equals(@options[:user_field], name)

Also in this function:

def authenticate(user, password)
    File.write('/var/log/one/ldap.log', 'Entrant a authenticate')
    ldap=@ldap.clone

And file is not generated on logs folder.

Do I have to restart the opennebula service every time that I change a ruby file? In what other place can I put other logs maybe before calling this function?

Thanks for your help,

Jordi

Hey, the File.write method in ruby shouldn’t work like that (it’s OO) and also the regular log file is being managed by OpenNebula logger, so it’s better to let it alone.

I would recommend to write things to a different file, that’s why we recommend this

File.open('/tmp/myldap.log', 'a') { |f| f.write('Entrant a authenticate') }

Bon dia