graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

LDAP users losing roles after authentication

Open wwilgner opened this issue 9 years ago • 14 comments

With LDAP/Active Directory authentication enabled, when users log in into graylog, they lost roles previously defined (admin or any other created role).

Expected Behavior

Users should log in and stays with the roles previously assigned (manually)

Current Behavior

When users log in, the roles previously defined disappears. Just the roles defined in Default User Role and Additional Default Roles (on LDAP configuration) remains.

Steps to Reproduce (for bugs)

  1. Configure LDAP/AD authentication with Group Mapping / Default User Role (read, basic access) and Additional Default Roles (any user created role)
  2. Login with a LDAP/AD user
  3. In other session, with graylog admin user, edit the user of the previous step, edit the roles, add admin role and click in update role
  4. Logout and login again with the user
  5. With graylog admin user, verify that the admin role disappeared from user

Context

We woud like to use LDAP/AD authentication just for the login, and we would use roles/permissions management manually. Now we don't want to create groups on Active Directory to make this control (but is one possibility, if is the only way).

I understand that can be a expected behavior, but this isn't clear on LDAP/AD configuration section.

Your Environment

  • Graylog Version: 2.3.2+3df951e, codename Tegernseer
  • Elasticsearch Version: 5.6.3
  • MongoDB Version: v3.4.2
  • Operating System: Centos 7.3
  • Browser version: Google Chrome Version 61.0.3163.100

wwilgner avatar Oct 27 '17 13:10 wwilgner

+1 with the same problem.

danielmrosa avatar Oct 27 '17 16:10 danielmrosa

Might be related to #3684.

joschi avatar Nov 02 '17 13:11 joschi

We have the same issue.

fabianecamargo avatar Nov 29 '17 15:11 fabianecamargo

We have the same problem

viniciusramosdefaria avatar Mar 27 '18 18:03 viniciusramosdefaria

We migrated our server from an all-in-one to a split pair (graylog front-end, es backend) and restored our mongodb. We're also having this issue now. We're running 2.4.4.

srematt avatar May 14 '18 12:05 srematt

This bug is in Graylog since 1.3.4, but I needed the time to reinstall with 2.4. Didn't want to open a ticket in 2018 against Graylog 1.3 :-) It is still in 2.4.5.

JensKuehnel avatar Jun 13 '18 08:06 JensKuehnel

The current behavior is intentional. The assumption is, that if you a are using LDAP to manage your users, you will also manage the groups/roles in LDAP. You can use the group mappings to map a LDAP group to a Graylog Administrator role.

I agree that this is not clear and also might be "wrong" depending on your use case. We cannot really do much about it at the moment without a bigger refactoring of the permissions system. (which will happen eventually, at one point in the future)

So for now you have to use the LDAP group mapping to map LDAP groups to Graylog roles to give admin credentials to specific Graylog users.

bernd avatar Jun 19 '18 14:06 bernd

I can agree, and I have removed the LDAP groups from my setup. It is now working, as expected.

JensKuehnel avatar Jun 29 '18 08:06 JensKuehnel

We had this same issue. Even though deprecated, for now, you can still set user permissions for view/edit and still use ldap. Would prefer to use roles NOT managed in LDAP, but uderstand why its done this way

cdj03 avatar Jul 18 '18 16:07 cdj03

I understand why this is done this way but could not find a way to map the ADMIN role to a AD user. a) ADMIN role cannot be assigned to a custom named role. b) We "cannot" have a AD group named ADMIN. It would be too ambiguous.

elexpander avatar Oct 01 '18 10:10 elexpander

But... why is this not happening for all users? Only some/new users are loosing their roles each few days/hours, other older ones keep the admin role regardless of login/logout cycle.

razvanphp avatar Nov 23 '18 17:11 razvanphp

@razvanphp I have read a couple of people having that issue, but so far we couldn't manage to reproduce it in our test setups. If you have some spare time and want to help us find out why that happens, please add these these two lines into the Loggers section of your Graylog logging configuration file (log4j2.xml):

<Logger name="org.graylog2.security.realm.LdapUserAuthenticator" level="debug"/>
<Logger name="org.graylog2.security.ldap.LdapConnector" level="trace"/>

That will make Graylog write more logs related to LDAP lookups, so you would be able to see more information while users log in.

Once the file is modified in all your Graylog nodes, you need to restart the servers for the configuration to take place.

At that point, please try to log in with a user whose roles update and with one whose roles do not update. You can feel free to look for differences in the lookups yourself or share the logs along your LDAP and group mapping settings with us. As that is quite sensitive information, you can also share it directly with me at: [email protected].

Thank you in advance!

edmundoa avatar Jan 29 '19 10:01 edmundoa

I got the exact same issue:

General Information: Node ID: a5c40c86-9d16-44a8-920d-820a5111e5f9 Version: 3.1.2+9e96b08, codename Quantum Dog JVM: PID 113033, Private Build 1.8.0_222 on Linux 4.4.0-154-generic

It started with that I added two roles to "Additional Default Roles" in the ldap configuration, since that every time a user logs into graylog, all his roles are deleted except the Default User Role, the Additional Default Roles, and the roles provided through "LDAP Group Mapping". So every role assignment did manually is gone after every login. I can reproduce this.

I did send the logs to the mentioned e-mail address.

thorus90 avatar Oct 29 '19 09:10 thorus90

This will be fixed in the upcoming 4.0 release and the new entity sharing system.

bernd avatar Oct 07 '20 13:10 bernd