Support for multiple remote auth backends #7757

Closed
opened 2025-12-29 20:27:52 +01:00 by adam · 6 comments
Owner

Originally created by @decoupca on GitHub (Mar 14, 2023).

Originally assigned to: @decoupca on GitHub.

NetBox version

v3.4.6

Feature type

New functionality

Proposed functionality

Currently, REMOTE_AUTH_BACKEND only supports a single auth backend. Modify REMOTE_AUTH_BACKEND to accept an iterable, which may reference one or more Django authentication backends. Backends would then be attempted in sequence when authenticating a user.

Use case

Valid NetBox users may not all exist in the same authentication directory or service, e.g. multiple AD forests. Note: For multiple AD domains within a single forest, point AUTH_LDAP_SERVER_URI to the AD Global Catalog port 3269 as described in the docs.

As Django supports multiple auth backends, extending this functionality to NetBox seems feasible.

This has come up several times in discussion:

Database changes

None

External dependencies

None

Originally created by @decoupca on GitHub (Mar 14, 2023). Originally assigned to: @decoupca on GitHub. ### NetBox version v3.4.6 ### Feature type New functionality ### Proposed functionality Currently, [REMOTE_AUTH_BACKEND](https://docs.netbox.dev/en/stable/configuration/remote-authentication/#remote_auth_backend) only supports a single auth backend. Modify REMOTE_AUTH_BACKEND to accept an iterable, which may reference one or more Django authentication backends. Backends would then be attempted in sequence when authenticating a user. ### Use case Valid NetBox users may not all exist in the same authentication directory or service, e.g. multiple AD forests. **Note**: For multiple AD domains within a single forest, point `AUTH_LDAP_SERVER_URI` to the AD Global Catalog port 3269 as described in the [docs](https://docs.netbox.dev/en/stable/installation/6-ldap/#general-server-configuration). As Django [supports multiple auth backends](https://django-auth-ldap.readthedocs.io/en/latest/multiconfig.html), extending this functionality to NetBox seems feasible. This has come up several times in discussion: - [Multiple Authentication methods at the same time, meaning Ldap OR SSO possible?](https://github.com/netbox-community/netbox/discussions/10733) - [Multiple LDAP sources Docker](https://github.com/netbox-community/netbox/discussions/5457) - [Multiple remote auth backends](https://github.com/netbox-community/netbox/discussions/9479) - [Multiple LDAP error](https://github.com/netbox-community/netbox/discussions/9360) ### Database changes None ### External dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 20:27:52 +01:00
adam closed this issue 2025-12-29 20:27:52 +01:00
Author
Owner

@decoupca commented on GitHub (Mar 16, 2023):

The use case that motivated this FR (authenticating users from multiple domains in a single forest) was resolved by pointing AUTH_LDAP_SERVER_URI to the Global Catalog port 3269 as described in the docs. However, this FR would still be useful in the case of separate AD forests, or any other case requiring multiple authentication backends.

@decoupca commented on GitHub (Mar 16, 2023): The use case that motivated this FR (authenticating users from multiple domains in a single forest) was resolved by pointing `AUTH_LDAP_SERVER_URI` to the Global Catalog port 3269 as described in the [docs](https://docs.netbox.dev/en/stable/installation/6-ldap/#general-server-configuration). However, this FR would still be useful in the case of separate AD forests, or any other case requiring multiple authentication backends.
Author
Owner

@decoupca commented on GitHub (Mar 18, 2023):

Can I take a swing at this one?

@decoupca commented on GitHub (Mar 18, 2023): Can I take a swing at this one?
Author
Owner

@decoupca commented on GitHub (Mar 20, 2023):

Would it be appropriate or helpful to include an example for how to leverage this? I have working PoC code for how to use this for multiple AD forests, but I'm not sure it belongs in the docs

@decoupca commented on GitHub (Mar 20, 2023): Would it be appropriate or helpful to include an example for how to leverage this? I have working PoC code for how to use this for multiple AD forests, but I'm not sure it belongs in the docs
Author
Owner

@AnythingOverIP commented on GitHub (Mar 24, 2023):

This could help also to add redundancy, even for a single domain. Pointing the requests to multiple servers of a same domain instead of a single one. If it was to be unavailable, other servers would still authenticate the users.

for multiple domains, can it support providing the domain name (DOMAIN\User)? Currently, I was not able to do it, and should it support multiple AD Forest, many of my users would have the same username defined in different domains.

@AnythingOverIP commented on GitHub (Mar 24, 2023): This could help also to add redundancy, even for a single domain. Pointing the requests to multiple servers of a same domain instead of a single one. If it was to be unavailable, other servers would still authenticate the users. for multiple domains, can it support providing the domain name (DOMAIN\User)? Currently, I was not able to do it, and should it support multiple AD Forest, many of my users would have the same username defined in different domains.
Author
Owner

@decoupca commented on GitHub (Mar 24, 2023):

for multiple domains, can it support providing the domain name (DOMAIN\User)? Currently, I was not able to do it, and should it support multiple AD Forest, many of my users would have the same username defined in different domains.

I wondered the same thing. Don't know for sure, may require a custom backend, which is the only way I see to be able to parse a username and take conditional actions based on it.

@decoupca commented on GitHub (Mar 24, 2023): > for multiple domains, can it support providing the domain name (DOMAIN\User)? Currently, I was not able to do it, and should it support multiple AD Forest, many of my users would have the same username defined in different domains. I wondered the same thing. Don't know for sure, may require a [custom backend](https://django-auth-ldap.readthedocs.io/en/latest/custombehavior.html#subclassing-ldapbackend), which is the only way I see to be able to parse a username and take conditional actions based on it.
Author
Owner

@AnythingOverIP commented on GitHub (Mar 25, 2023):

If it's too complicated to parse, a drop-down menu on the login page that list the available domains might be easier to implement. Selecting a domain would then refer to a domain specific config that has one or more LDAP server.

@AnythingOverIP commented on GitHub (Mar 25, 2023): If it's too complicated to parse, a drop-down menu on the login page that list the available domains might be easier to implement. Selecting a domain would then refer to a domain specific config that has one or more LDAP server.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7757