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

Postfix LDAP - Add logic to provide custom configs at /tmp/docker-mailserver/ and Add global variable to specify the query_filter #503

Closed
alinmear opened this issue Feb 2, 2017 · 4 comments
Assignees

Comments

@alinmear
Copy link
Contributor

alinmear commented Feb 2, 2017

Right now we have no chance to specify the query_filter within the ldap-{user,aliases,group}.conf at /etc/postfix. I don't know why we missed to implement that. I would work on it.

I would suggest the following logic:

  • Check whether config is provided or not and copy them in place
  • Check whether global variables have been specified and substitute
@alinmear
Copy link
Contributor Author

alinmear commented Feb 2, 2017

Ok, i investigated this a little bit. While restructuring the start-mailserver.sh an important part has been dropped (not on purpose):

for i in 'users' 'groups' 'aliases'; do
fpath="/tmp/docker-mailserver/postfix-ldap-${i}.cf"
if [ -f $fpath ]; then
cp ${fpath} /etc/postfix/ldap-${i}.cf
sed -i -e 's|^server_host.|server_host = '${LDAP_SERVER_HOST}'|g' \
-e 's|^search_base.
|search_base = '${LDAP_SEARCH_BASE}'|g'
-e 's|^bind_dn.|bind_dn = '${LDAP_BIND_DN}'|g'
-e 's|^bind_pw.
|bind_pw = '${LDAP_BIND_PW}'|g'
/etc/postfix/ldap-${i}.cf
else
echo "${fpath} not found"
echo "==> Warning: 'config/postfix-ldap-$i.cf' is not provided."
fi
done

@tomav
Copy link
Contributor

tomav commented Feb 3, 2017

Thanks for the feedback @alinmear, we should add more tests and doc on LDAP.
It currently seems to bring new users to the project but we're not accurate and it's still not totally plug and play.

@tomav
Copy link
Contributor

tomav commented Feb 13, 2017

@alinmear, could you submit a PR for that?

@alinmear
Copy link
Contributor Author

yes, will. had no time so far. I will do my best, to make a pr!

alinmear added a commit to alinmear/docker-mailserver that referenced this issue Feb 16, 2017
…container

provisioning within /tmp/docker-mailserver
@alinmear alinmear mentioned this issue Feb 18, 2017
@tomav tomav closed this as completed in 26992bb Apr 26, 2017
RichardFevrier pushed a commit to RichardFevrier/docker-mailserver that referenced this issue 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

No branches or pull requests

2 participants