From cb673818f843b276a57bbadd8ff5aaa5f1f50a40 Mon Sep 17 00:00:00 2001 From: shirenn Date: Sat, 24 Jul 2021 11:48:15 +0200 Subject: [PATCH] [dovecot] Updating the configuration and listening on the adm for the auth --- group_vars/dovecot.yml | 7 ++++++- .../dovecot/templates/dovecot/conf.d/10-master.conf.j2 | 5 +++-- .../dovecot/templates/dovecot/dovecot-ldap.conf.ext.j2 | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/group_vars/dovecot.yml b/group_vars/dovecot.yml index 50edaf23..9472033b 100644 --- a/group_vars/dovecot.yml +++ b/group_vars/dovecot.yml @@ -1,3 +1,8 @@ glob_dovecot: - ldap_dn: 'cn=dovecot,ou=service-users,dc=crans,dc=org' + ldap: + uri: "ldap://{{ query('ldap', 'ip', 're2o-ldap', 'adm') | ipv4 | first }}/" + dn: 'cn=dovecot,ou=service-users,dc=crans,dc=org' + pass: "{{ vault.dovecot_dnpass }}" + users_base: 'cn=Utilisateurs,dc=crans,dc=org' + home_path: '/home_adh' inet_listener: "{{ query('ldap', 'ip', ansible_hostname, 'adm') | ipwrap | join(', ') }}" diff --git a/roles/dovecot/templates/dovecot/conf.d/10-master.conf.j2 b/roles/dovecot/templates/dovecot/conf.d/10-master.conf.j2 index f4b4e437..8330907e 100644 --- a/roles/dovecot/templates/dovecot/conf.d/10-master.conf.j2 +++ b/roles/dovecot/templates/dovecot/conf.d/10-master.conf.j2 @@ -16,7 +16,7 @@ default_process_limit = 500 service imap-login { inet_listener imap { - address = 127.0.0.1, {{ dovecot.inet_listener }} + address = 127.0.0.1, [::1], {{ dovecot.inet_listener }} port = 143 } inet_listener imaps { @@ -39,7 +39,7 @@ service imap-login { service pop3-login { inet_listener pop3 { - address = 127.0.0.1, {{ dovecot.inet_listener }} + address = 127.0.0.1, [::1], {{ dovecot.inet_listener }} port = 110 } inet_listener pop3s { @@ -119,6 +119,7 @@ service auth { client_limit = 1024 inet_listener { + address = 127.0.0.1, [::1], {{ dovecot.inet_listener }} port = 4242 } } diff --git a/roles/dovecot/templates/dovecot/dovecot-ldap.conf.ext.j2 b/roles/dovecot/templates/dovecot/dovecot-ldap.conf.ext.j2 index 82d27df0..82398893 100644 --- a/roles/dovecot/templates/dovecot/dovecot-ldap.conf.ext.j2 +++ b/roles/dovecot/templates/dovecot/dovecot-ldap.conf.ext.j2 @@ -18,14 +18,14 @@ # LDAP URIs to use. You can use this instead of hosts list. Note that this # setting isn't supported by all LDAP libraries. -uris = {{ ldap.uri }} +uris = {{ dovecot.ldap.uri }} # Distinguished Name - the username used to login to the LDAP server. # Leave it commented out to bind anonymously (useful with auth_bind=yes). -dn = {{ dovecot.ldap_dn }} +dn = {{ dovecot.ldap.dn }} # Password for LDAP server, if dn is specified. -dnpass = {{ vault.dovecot_dnpass }} +dnpass = {{ dovecot.ldap.pass }} # Use SASL binding instead of the simple binding. Note that this changes # ldap_version automatically to be 3 if it's lower. Also note that SASL binds @@ -87,7 +87,7 @@ dnpass = {{ vault.dovecot_dnpass }} # LDAP base. %variables can be used here. # For example: dc=mail, dc=example, dc=org -base = {{ ldap.users_base }} +base = {{ dovecot.ldap.users_base }} # Dereference: never, searching, finding, always #deref = never @@ -104,7 +104,7 @@ base = {{ ldap.users_base }} # # There are also other special fields which can be returned, see # http://wiki2.dovecot.org/UserDatabase/ExtraFields -user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid +user_attrs = homeDirectory=home={{ dovecot.home_path }}/%u,uidNumber=uid,gidNumber=gid # Filter for user lookup. Some variables can be used (see