Feature #2805
closedmod_auth caching
Description
I have been experimenting with lighttpd mod_authn_ldap how it handles caching and failure scenarios.
It seems that currently nothing is cached, but a TCP connect() is done for each HTTP request. Is there plans to add some caching of authentication results?
Additionally, it seems the code is using libldap in the synchronous or blocking mode, and no timeouts are set for the API calls. If using LDAP hostname that resolves to multiple IP-addresses the library properly attempts to connect them in order until a working host is found. However, this may mean the connect() syscall blocks for several seconds in case the first ldap hosts are not responding. Ideally, the code should use the asynchronous non-block APIs, but at least as minimum set timeouts for network and the API calls to not totally block.
Updated by gstrauss over 7 years ago
- Tracker changed from Bug to Feature
- Subject changed from mod_authn_ldap scalability to mod_authn_* caching
A caching layer is planned, but not yet implemented. If you looked at the code, you might have noted that the mod_authn_* modules are written such that a single, shared caching layer can be implemented (and, potentially, an optional per-module cache if deemed necessary). This will be configurable since lighttpd is also used on small-memory systems where excess memory usage might need to be avoided.
As for the module being synchronous, yes, that is a known limitation and documented in the code. However, there are no current plans to reimplement as an asynchronous. A cache will alleviate some of this pressure. Timeouts will be considered, or potentially handled in worker threads. Still, nothing is planned at the moment besides a caching layer.
Updated by gstrauss over 7 years ago
- Subject changed from mod_authn_* caching to mod_auth caching
Updated by tteras over 7 years ago
How about making LDAP_OPT_TIMEOUT (and potentially LDAP_OPT_NETWORK_TIMEOUT) options via ldap_set_option() be configurable with a sane default. The libldap default is indefinite, and can cause mod-authn-ldap to block lighttpd for several tens of seconds when the remote host becomes unresponsive.
Updated by gstrauss over 7 years ago
Worth considering. Patches welcome and will be reviewed.
Updated by gstrauss over 7 years ago
FYI: http://openldap-technical.openldap.narkive.com/yjqvvd9a/ldapbind-timeout-can-t-work
According to the above, LDAP_OPT_TIMEOUT was not honored until OpenLDAP 2.4. Still, will consider use where available.
Updated by gstrauss over 4 years ago
- Status changed from New to Patch Pending
- Target version changed from 1.4.x to 1.4.56
- ASK QUESTIONS IN Forums set to No
Updated by gstrauss over 4 years ago
- Status changed from Patch Pending to Fixed
Applied in changeset e11514b086f0069aff14be68bd2b45bc6477165a.
Also available in: Atom