Skip to content

Use dovecot's LDAP uris option instead of hosts (fixes #1510)#1901

Merged
wernerfred merged 6 commits intodocker-mailserver:masterfrom
moqmar:bugfix/dovecot-ldaps
Apr 19, 2021
Merged

Use dovecot's LDAP uris option instead of hosts (fixes #1510)#1901
wernerfred merged 6 commits intodocker-mailserver:masterfrom
moqmar:bugfix/dovecot-ldaps

Conversation

@moqmar
Copy link
Copy Markdown
Contributor

@moqmar moqmar commented Apr 12, 2021

Description

According to https://doc.dovecot.org/configuration_manual/authentication/ldap/, the "uris" option has to be used when using LDAPS, while the "hosts" option seems to only work with STARTTLS. So, this PR fixes the problem that docker-mailserver can't be used with LDAPS.

The change is made in a way that allows backwards-compatibility with configurations that assume the "hosts" option to be set by LDAP_SERVER_HOST, in which case it's using "ldap://" as a default protocol if none is specified. The only change for the user is that LDAP_SERVER_HOST now supports specifying a protocol like "ldaps://...".

Fixes #1510

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or ENVIRONMENT.md or the documentation)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@moqmar moqmar force-pushed the bugfix/dovecot-ldaps branch from 7228e98 to 6ac6c24 Compare April 12, 2021 19:57
Comment thread target/scripts/startup/setup-stack.sh Outdated
Comment thread target/dovecot/dovecot-ldap.conf.ext Outdated
@moqmar moqmar force-pushed the bugfix/dovecot-ldaps branch from 6ac6c24 to 0a3ab87 Compare April 16, 2021 08:38
Comment thread target/scripts/startup/setup-stack.sh Outdated
Comment thread target/scripts/startup/setup-stack.sh Outdated
Comment thread target/scripts/startup/setup-stack.sh Outdated
moqmar added a commit to moqmar/docker-mailserver that referenced this pull request Apr 16, 2021
Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can approve this PR style-wise. I cannot say anything about the functionality. I re-requested a review from @wernerfred

@moqmar
Copy link
Copy Markdown
Contributor Author

moqmar commented Apr 16, 2021

Whoops, seems like I have broken something with the style changes. Will evaluate. 🙃

Edit: seems like I just used a wrong variable somewhere: https://github.com/docker-mailserver/docker-mailserver/compare/f9f9fc4570a15c0268e30bcca0be4e229d8d432f..18b4f1a26e126a2dff281897d7b89ff3b59f039d

@georglauterbach
Copy link
Copy Markdown
Member

Please also note that your commit signatures are invalid - you may want to fix this as well :D

@wernerfred wernerfred requested a review from fbartels April 16, 2021 11:39
@wernerfred
Copy link
Copy Markdown
Member

@reneploetz you commented on #1902. Can you please review here as well?

moqmar added a commit to moqmar/docker-mailserver that referenced this pull request Apr 16, 2021
@moqmar moqmar force-pushed the bugfix/dovecot-ldaps branch from f9f9fc4 to aa3f829 Compare April 16, 2021 12:16
@moqmar moqmar force-pushed the bugfix/dovecot-ldaps branch from aa3f829 to 18b4f1a Compare April 16, 2021 12:19
@reneploetz
Copy link
Copy Markdown
Contributor

reneploetz commented Apr 17, 2021

@reneploetz you commented on #1902. Can you please review here as well?

As I'm not using dovecot + LDAP I'm unable to test this on an actual test system (my system is using Kopano + LDAP). But the change appears to fine to be given that there is a test that is checking the correct replacement inside the config after the container start as well as a test that dovecot starts with that configuration. Afterwards there is a test on whether one can connect with a username that is present in ldap.
If you feel uncomfortable to merge this then I can create local test environment for this tough.

@georglauterbach
Copy link
Copy Markdown
Member

If you feel uncomfortable to merge this then I can create local test environment for this tough.

That'd be awesome!

@moqmar
Copy link
Copy Markdown
Contributor Author

moqmar commented Apr 18, 2021

I think the most interesting test would be LDAP with StartTLS, as I think that it hasn't been tested yet with the change.

It seems like it should work with the ldap:// protocol and tls = yes, but I'm not sure if there is currently a way to set tls = yes at all with Dovecot right now? which seems to be doable by setting DOVECOT_TLS=yes.

@wernerfred
Copy link
Copy Markdown
Member

If you feel uncomfortable to merge this then I can create local test environment for this tough.

If you could to this it would be great! If you do not find time then I would consider it safe to merge as we have the same opinion by just looking at the changes. But only a real test can show if we are right.

Thanks in advance!

@georglauterbach
Copy link
Copy Markdown
Member

If you could to this it would be great! If you do not find time then I would consider it safe to merge as we have the same opinion by just looking at the changes. But only a real test can show if we are right.

I agree.

@georglauterbach
Copy link
Copy Markdown
Member

@wernerfred If you're comfortable merging this, I am too. I will update the branch first :)

@wernerfred
Copy link
Copy Markdown
Member

I would wait for a reply of @reneploetz :)
Depending on this we will merge or wait until he finished testing.

@reneploetz
Copy link
Copy Markdown
Contributor

I can confirm that the following configurations are working:

LDAP_SERVER_HOST=testing_ldap
DOVECOT_TLS=yes
DOVECOT_URIS=ldap://testing_ldap
DOVECOT_TLS=yes

All of them lead to this content in dovecot-ldap.conf.ext which allows dovecot to successfully connect to LDAP via TLS:

uris = ldap://testing_ldap
tls = yes

So as far as I'm concerned the configuration works with TLS.

As a side note in case somebody asks later: we currently do not support custom certificates for LDAP due to the lack of "tls_require_cert" or "tls_ca_cert_*" settings in the configuration.

Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I will approve these changes. @wernerfred if you're fine with this too, go ahead and merge this.

We can afterwards merge the PR about Gh actions

Comment thread ENVIRONMENT.md
- => Specify a space separated list of LDAP hosts.
- => Specify a space separated list of LDAP uris.
- Note: If the protocol is missing, `ldap://` will be used.
- Note: This deprecates `DOVECOT_HOSTS` (as it didn't allow to use LDAPS), which is currently still supported for backwards compatibility.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a breaking change. @aendeavor another reason for v10.0.0 😄
The note should be removed at some time in the future.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I said this earlier that this note will go with 10.0.0

@wernerfred
Copy link
Copy Markdown
Member

Does this change require documentation updates?

@wernerfred
Copy link
Copy Markdown
Member

Ah @moqmar proposed to do this with a separate PR in #1902 (comment).
Therefore I will merge

@wernerfred wernerfred merged commit 94b5ac4 into docker-mailserver:master Apr 19, 2021
@wernerfred wernerfred added this to the v10.0.0 milestone May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dovecot not working with ldaps:// protocol

5 participants