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

Support multiple LDAP servers for automatic failover #549

Open
oyvindhagberg opened this issue Aug 22, 2024 · 0 comments
Open

Support multiple LDAP servers for automatic failover #549

oyvindhagberg opened this issue Aug 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@oyvindhagberg
Copy link
Contributor

A recent outage highlighted the need for mreg to support multiple LDAP servers for failover purposes.
Here's a dump from a discussion we had internally (names have been removed for privacy):

https://django-auth-ldap.readthedocs.io/en/latest/multiconfig.html

is this something that can be implemented via just settings?

static classes defining how many ldap backends can be set up seems like a very poor way to go about this

does django ldap really not support defining a server list?

with the python ldap3 library it's possible to set up a server pool and round robin between them for connections

apparently the "solution" is to make AUTH_LDAP_SERVER_URI a callable and write your own code to check for availability

way to go shoving the problem onto users

If your server location is even more dynamic than this, you may provide a function (or any callable object) that returns the URI. The callable is passed a single positional argument: request. You should assume that this will be called on every request, so if it’s an expensive operation, some caching is in order.

does it bind on every request? sounds expensive

for the actual check you could probably get away fairly cheap by using socket to check if a server is available, and implement some basic strategies like round robin and random selection

to avoid doing this on every single connection i would use cachetools.TTLCache

@oyvindhagberg oyvindhagberg added the enhancement New feature or request label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant