[FR] Default values for LDAP_QUERY_FILTER_*
Feature Request
Context
Hello, I just spend a very long time getting docker-mailserver to work with Active Directory. Mostly stupid errors on my part but the trickiest issue was that I had left the following env variables empty/unset because I won't be using any alias, goup or domain, only users:
LDAP_QUERY_FILTER_GROUP
LDAP_QUERY_FILTER_ALIAS
LDAP_QUERY_FILTER_DOMAIN
And since the default mailserver.env also had unset variables I thought this was a working config: https://github.com/docker-mailserver/docker-mailserver/blob/master/mailserver.env#L299
Fortunately I found someone with similar errors (and a solution!) here: https://github.com/docker-mailserver/docker-mailserver/issues/1562#issuecomment-657095120
Their solution was to override the postfix config with postfix-main.cf but I've found you can also use the filters suggested in mailserver.env comments even if you know they won't match anything in your LDAP data but at least you avoid the following errors:
client:
Can't send mail - all recipients were rejected: 451 4.3.0 <[email protected]>: Temporary lookup failure
server:
postfix/trivial-rewrite[2335]: warning: dict_ldap_lookup: Search error 2: Protocol error
postfix/trivial-rewrite[2335]: warning: virtual_alias_domains: ldap:/etc/postfix/ldap-aliases.cf: table lookup problem
postfix/trivial-rewrite[2335]: warning: virtual_alias_domains lookup failure
Describe the Solution you'd like
Since the fix is to have something like the following (I used the same values as suggested in the comments of mailserver.env):
LDAP_QUERY_FILTER_GROUP=(&(mailGroupMember=%s)(mailEnabled=TRUE))
LDAP_QUERY_FILTER_ALIAS=(&(mailAlias=%s)(mailEnabled=TRUE))
LDAP_QUERY_FILTER_DOMAIN=(&(|(mail=*@%s)(mailalias=*@%s)(mailGroupMember=*@%s))(mailEnabled=TRUE))
even if you know this won't match anything in Active Directory/LDAP, why not have these values as a default when the variable is unset, like you do for many of the other environment variables in mailserver.env?
Are you going to implement it?
No, and I understand that it is highly likely no one will implement it. Furthermore, I understand that this issue will likely become stale and will be closed.
I did not encounter it but maybe the same kind of default would also help with DOVECOT_USER_FILTER, maybe?
https://github.com/docker-mailserver/docker-mailserver/issues/2255#issuecomment-948935230
even if you know this won't match anything in Active Directory/LDAP, why not have these values as a default when the variable is unset, like you do for many of the other environment variables in mailserver.env?
Original Response:
I think the issue is more that none of the active maintainers have much LDAP experience and without properly understanding what those additions are and why they resolve the issue faced, maintainers may be uncomfortable doing so... as sometimes one users fix by changing defaults breaks other users deployments.
This recently was an issue for another LDAP user trying to fix a permissions issue they were experiencing, and while we'd love for that to not be an issue for them, their fix did introduce regressions for other users (thankfully our tests caught that early).
In this case it's not as big of a concern as it would only affect LDAP users, but at the same time our tests probably don't cover LDAP as widely until the test suite gets overhauled to be more flexible :sweat_smile:
I appreciate the referenced issues and solution shared here, if more LDAP users chime in for support for this change or the opposite that would help make a decision.
We also have some LDAP docs that seem to touch on this topic (albeit slightly different values), if you glance over those and see room for improvement we are very welcoming towards updates there!
FWIW, the mailserver.env file is just a reference and not required, and I don't think we actually set any defaults for these type of ENV in our scripts as they're dynamically processed via the configomat submodule AFAIK.
EDIT: Our LDAP tests do configure the following related LDAP_ / DOVECOT_ ENV:
https://github.com/docker-mailserver/docker-mailserver/blob/6ad9dd30635a6e81dfe8dcecb933ee445a1cb145/test/mail_with_ldap.bats#L46-L53
I also glanced at mailserver.env and see that you're using those example values from the comments.
It may be fine to set those as defaults in that env file then, and revert if necessary. This would only affect new users that use mailserver.env when getting started right? Or were you requesting to set these as defaults internally (which I'd be more reluctant)
I agree. We could set these values as default and see what happens, given that none of the currently active maintainers use LDAP (as of now). @3id0 would you open a PR for this?
This issue has become stale because it has been open for 20 days without activity. This issue will be closed in 10 days automatically unless:
- a maintainer removes the
meta/stalelabel or adds thestale-bot/ignorelabel - new activity occurs, such as a new comment
This issue has become stale because it has been open for 20 days without activity. This issue will be closed in 10 days automatically unless:
- a maintainer removes the
meta/stalelabel or adds thestale-bot/ignorelabel - new activity occurs, such as a new comment
This issue was closed due to inactivity.