goauthentik / authentik

The authentication glue you need.
https://goauthentik.io
Other
12.6k stars 847 forks source link

ldap_sync_paginator: Error handling #6811

Open a-gerhard opened 1 year ago

a-gerhard commented 1 year ago

Is your feature request related to a problem? Please describe. When ldap_sync_paginator has to fetch a large number of pages (>25k in my case), it will create a lot of redis entries. If the method fails at any point, these entries are not removed, and neither is an ldap_sync task scheduled to apply it.

Describe the solution you'd like It'd be good if it would log the error, but still return the task signatures for already collected ldap entries, so that the chain and group can still be created by ldap_sync_single

Describe alternatives you've considered Hope that it doesn't fail?

a-gerhard commented 1 year ago

Another issue: If I understand the ldap3 library correctly, it should be possible to reconnect after receiving an LDAPSocketReceiveError. It may be a good idea to implement error handling for that case in BaseLDAPSynchronizer.search_paginator.