Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#503 #522

Merged
merged 9 commits into from
Apr 26, 2017
Merged

#503 #522

merged 9 commits into from
Apr 26, 2017

Conversation

alinmear
Copy link
Contributor

This PR fixes issue #503.

I also introduced a new method/logic to deal with config substitution "override_configs".

This method parses takes 2 argument: an env var prefix (like LDAP_) and a config file. See start-mailserver.sh for details. I think this could make the provisioning also for other config implementations much easier. Maybe we could write a section for developers at the end of the README.me to point at stuff like this.

This method takes 2 arguments:
  1.) Environment Variable Prefix
  2.) String of files separated by whitespace

e.g.
  export LDAP_SEARCH_BASE=dc=domain,dc=loc
  export LDAP_BIND_PW=test

  overwrite_config "LDAP_" "/etc/postfix/ldap-users.cf
  /etc/postfix/ldap-groups.cf"

Logic:
  + all env vars will be search for vars with the prefix LDAP_
  + afterwards they will be dissembled in key value pairs
    LDAP_BIND_PW=test --> bind_pw test
  + the key and value will be substituted within the provided files
  via sed
…container

provisioning within /tmp/docker-mailserver
    * check custom configs copied
    * check environment variables substituted
@tomav
Copy link
Contributor

tomav commented Feb 23, 2017

Anyone using LDAP wanting to give a feedback on this PR?

@tomav
Copy link
Contributor

tomav commented Mar 13, 2017

LDAP users, anyone? :-)

@tomav
Copy link
Contributor

tomav commented Mar 25, 2017

@alinmear nobody want to help you I think :)

@alinmear
Copy link
Contributor Author

@tomav :) ... I will write the README Section on my own within this PR.

@tomav
Copy link
Contributor

tomav commented Mar 28, 2017

A page in the Wiki may be better to maintain.
Let me know if I can safely merge this PR and I'll do it.

@tomav
Copy link
Contributor

tomav commented Apr 17, 2017

@alinmear ?

@alinmear
Copy link
Contributor Author

@tomav, sry for the delay, i need a day with 48 hours. This pr should be save to merge ...

But 1 Thing to mention: we are only covering postfix and it's ldap parameterisation but not in detail the Dovecot side. For example we are not covering the user_filter, pass_filter, etc. I am not using dovecot on my own, maybe somebody could look into it, whether this is needed or not.

I left this untouched but marked the section with the following:

# @TODO: Environment Variables for DOVECOT ldap integration to configure for better control
notify 'inf' "Configuring dovecot LDAP authentification"
sed -i -e 's|^hosts.*|hosts = '${LDAP_SERVER_HOST:="mail.domain.com"}'|g' \
-e 's|^base.*|base = '${LDAP_SEARCH_BASE:="ou=people,dc=domain,dc=com"}'|g' \
-e 's|^dn\s*=.*|dn = '${LDAP_BIND_DN:="cn=admin,dc=domain,dc=com"}'|g' \
-e 's|^dnpass\s*=.*|dnpass = '${LDAP_BIND_PW:="admin"}'|g' \
/etc/dovecot/dovecot-ldap.conf.ext

We should open an issue Review ldap integration for dovecot.

The integration tests are covering test cases for successfully copying provided config files and also overriding the config with specified ENV-VARs.

@tomav
Copy link
Contributor

tomav commented Apr 26, 2017

Hi @alinmear, same here for 48h days
I'm gonna merge it. Could you create the issue and explain necessary work?
Thank you

@tomav tomav merged commit 26992bb into docker-mailserver:master Apr 26, 2017
RichardFevrier pushed a commit to RichardFevrier/docker-mailserver that referenced this pull request Aug 26, 2019
* Add method overwrite_config()
This method takes 2 arguments:
  1.) Environment Variable Prefix
  2.) String of files separated by whitespace

e.g.
  export LDAP_SEARCH_BASE=dc=domain,dc=loc
  export LDAP_BIND_PW=test

  overwrite_config "LDAP_" "/etc/postfix/ldap-users.cf
  /etc/postfix/ldap-groups.cf"

Logic:
  + all env vars will be search for vars with the prefix LDAP_
  + afterwards they will be dissembled in key value pairs
    LDAP_BIND_PW=test --> bind_pw test
  + the key and value will be substituted within the provided files
  via sed

* Fix docker-mailserver#503 added logic for custom configs provided at container
provisioning within /tmp/docker-mailserver

* Add additional unit tests for postfix ldap integration

    * check custom configs copied
    * check environment variables substituted

* Fix quoting problems in tests.bats

* Fix missing brackets in function _fix_var_amavis_permissions()

* Fix typo in _setup_ldap

* Fix notify in overwrite_config

* Fix typo

* Fix added dovecot ldap config provisioning again and Add notify for tasks
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.

None yet

2 participants