Skip to content

Fix ldap related critical Problems#644

Merged
tomav merged 15 commits intodocker-mailserver:masterfrom
alinmear:#641
Jul 3, 2017
Merged

Fix ldap related critical Problems#644
tomav merged 15 commits intodocker-mailserver:masterfrom
alinmear:#641

Conversation

@alinmear
Copy link
Copy Markdown
Contributor

@alinmear alinmear commented Jul 3, 2017

As already written by me (#641 (comment)) we have some serious issues regarding the setup of ldap with env variables.

This pr should fix the following issues: #641, #633, #491 (see comments), #636 (can be configured explicit with the new env vars; maybe we should discuss better defaults as stated there), #591

  • LDAP_QUERY_FILTER_USER
  • LDAP_QUERY_FILTER_GROUP
  • LDAP_QUERY_FILTER_ALIAS
  • DOVECOT_USER_FILTER
  • DOVECOT_PASS_FILTER

We may should discuss some defaults and or combinations to make the setup more straight forward (like dovecot user_filter and pass_filter could be the same, when only 1 has been defined or LDAP_QUERY_FILTER_USER could be set for the saslauthd part if not explicitly set).

Hope this helps ...

@alinmear alinmear changed the title #641 Fix ldap related critical Problems Jul 3, 2017
@tomav tomav merged commit 21fb3f3 into docker-mailserver:master Jul 3, 2017
@tomav
Copy link
Copy Markdown
Contributor

tomav commented Jul 3, 2017

Thanks @alinmear

@misyltoad
Copy link
Copy Markdown

Thanks for this, I will try it out if I get a chance later this week

@tailtwo
Copy link
Copy Markdown

tailtwo commented Jul 4, 2017

Thank you, I really didn't have the time to check the source to fix #591 so this mr will come in handy.

@johansmitsnl
Copy link
Copy Markdown
Contributor

The new variable don't work because they are in comment. Why is this?
Now the dovecot variable don't work, so did not build a new image to test.

https://github.com/tomav/docker-mailserver/blob/21fb3f3c86391f079afb7fb59260b64019fa2e51/target/start-mailserver.sh#L593:L595

@alinmear
Copy link
Copy Markdown
Contributor Author

alinmear commented Jul 8, 2017

@johansmitsnl, these are only default values. If you want to change those values you need to set the corresponding ENV Variables, like:

- DOVECOT_PASS_FILTER="(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))"
- DOVECOT_USER_FILTER="(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))"

I already wrote an example within the readme.

Update1: I commented those defaults, because I am not sure, if this could lead to some unexpected behavior in some setups, if i set user and pass filter equal.

Update2: The main substitution is triggered by this call btw: override_config "DOVECOT_" "/etc/dovecot/dovecot-ldap.conf.ext"

@johansmitsnl
Copy link
Copy Markdown
Contributor

Inside the docker:

echo $DOVECOT_PASS_FILTER
(&(objectClass=PostfixBookMailAccount)(|(uniqueIdentifier=%n)(mail=%u)))
cat /etc/dovecot/dovecot-ldap.conf.ext
pass_attrs          = uniqueIdentifier=user,userPassword=password
pass_filter         = (&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))
user_attrs          = mailHomeDirectory=home,mailUidNumber=uid,mailGidNumber=gid,mailStorageDirectory=mail
user_filter         = (&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))

It seems that the variables are not applied but they are set in the ENV.

@alinmear
Copy link
Copy Markdown
Contributor Author

alinmear commented Jul 8, 2017

@johansmitsnl , the problem here is the | within your expression; because we take the | for the separation of the sed parts; this is causing the problem; you could escape the | like:

(&(objectClass=PostfixBookMailAccount)(\|(uniqueIdentifier=%n)(mail=%u)))

This should work. I check how to deal with this kind of characters and sed, because currently we are doing the sed calls like:

sed -i -e "s|somethingelse|somethingelse-new|g"

Update: I found a solution by escaping the special character before the string is handed over to sed. I already made the commit within my project https://github.com/alinmear/docker-configomat and hopefully can merge this with the pr to #648.

@johansmitsnl
Copy link
Copy Markdown
Contributor

@alinmear Escaping worked and solved my ldap issue #636.
It should only escape the special chars as you already noted.

Now we only have the #642 to rework to support virtual domains in the ldap. Will take a look how the changes where made and update the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants