Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra LDAP user and group filters #471

Closed
kasimon opened this issue Mar 12, 2021 · 8 comments
Closed

Add extra LDAP user and group filters #471

kasimon opened this issue Mar 12, 2021 · 8 comments
Labels
enhancement The issue describes an enhancement that we would like to implement in the future.

Comments

@kasimon
Copy link

kasimon commented Mar 12, 2021

Desired Behavior

Introduce new config variables AUTH_LDAP_USER_SEARCH_EXTRA_FILTER and AUTH_LDAP_GROUP_SEARCH_EXTRA_FILTER that are added to the LDAP queries.

This would allow to filter users/groups based on their attributes (for example to require a field like assignedRole: Netbox).

Contrast to Current Behavior

Currently there is no way to add an extra LDAP filter without changing the ldap config code.

Changes Required

Add these variables to the config. If not using the new variables nothing changes.

Discussion: Benefits and Drawbacks

This change would improve the versatility of the django ldap config.

@cimnine
Copy link
Collaborator

cimnine commented Mar 12, 2021

Currently there is no way to add an extra LDAP filter without changing the ldap config code.

You can create a new file configuration/ldap/your_configuration.py containing whatever LDAP-related configuration you want. Every piece of configuration added in such a file takes precedence over the default configuration and also extends it. See configuration/extra.py for reference; the same principle works for the ldap configuration.

@cimnine cimnine added the awaiting answer There is still some open discussion. label Mar 12, 2021
@cimnine
Copy link
Collaborator

cimnine commented Mar 12, 2021

I've added a quick paragraph to our wiki that describes the custom configuration files, see https://github.com/netbox-community/netbox-docker/wiki/Configuration#custom-configuration-files. I hope this solves your need for more environment variables – you could implement them yourself. If you think that they are a relevant to other, please consider opening a PR.

@kasimon
Copy link
Author

kasimon commented Mar 12, 2021

Given that these kind of filters are quite common in most LDAP setups I know, I would be for adding these to the default ldap_config.py. Adding your own config especially for LDAP requires knowledge not everybody needing such a filter might have. I could come up with a minimal PR if that would help.

@no-response no-response bot removed the awaiting answer There is still some open discussion. label Mar 12, 2021
@cimnine cimnine added the enhancement The issue describes an enhancement that we would like to implement in the future. label Mar 14, 2021
@ryanmerolle
Copy link
Contributor

After quickly searching google, gitlab, django-auth-ldap, and github I have not seen these options mentioned much.

In all the setups I have helped with I have not once used either of these options. Just adding my two cents. I think this should just be closed out.

@kasimon
Copy link
Author

kasimon commented Apr 21, 2021

@ryanmerolle gitlab and django-auth-ldap definitely support arbitrary user and group filter (I know because we use both).

@ryanmerolle
Copy link
Contributor

I was not saying they are not supported. I was just saying I did not see much mention of people using those options a lot.

tobiasge added a commit that referenced this issue Jan 30, 2023
implement extra LDAP user and group filters as requested in #471
@tobiasge
Copy link
Member

Fixed in #931

timrabl added a commit to timrabl/netbox-docker that referenced this issue Jan 31, 2023
@timrabl
Copy link
Contributor

timrabl commented Jan 31, 2023

@tobiasge Actually i made a mistake in #931.
#939 should fix this finally. ^^

timrabl added a commit to timrabl/netbox-docker that referenced this issue Jan 31, 2023
timrabl added a commit to timrabl/netbox-docker that referenced this issue Feb 1, 2023
add missing AUTH_LDAP_USER_SEARCH, removed while modifying....

revert AUTH_LDAP_USER_SEARCH variable that was accidentally removed in netbox-community#931 and change behaviour to requested features in netbox-community#471
timrabl added a commit to timrabl/netbox-docker that referenced this issue Feb 1, 2023
add missing AUTH_LDAP_USER_SEARCH, removed while modifying....

revert AUTH_LDAP_USER_SEARCH variable that was accidentally removed in netbox-community#931 and change behaviour to requested features in netbox-community#471

remove duplicate AUTH_LDAP_USER_SEARCH variable now and fix this finally, hopefully
tobiasge added a commit that referenced this issue Feb 1, 2023
@tobiasge tobiasge mentioned this issue Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue describes an enhancement that we would like to implement in the future.
Projects
None yet
Development

No branches or pull requests

5 participants