diff --git a/dovecot/Dockerfile b/dovecot/Dockerfile index 22debde..7cf53f4 100644 --- a/dovecot/Dockerfile +++ b/dovecot/Dockerfile @@ -7,7 +7,7 @@ RUN apk add --no-cache \ RUN sed -i 's/#!include auth-ldap.conf.ext/!include auth-ldap.conf.ext/' /etc/dovecot/conf.d/10-auth.conf \ && sed -i 's/!include auth-passwdfile.conf.ext/#!include auth-passwdfile.conf.ext/' /etc/dovecot/conf.d/10-auth.conf \ && sed -i 's/#first_valid_uid = .*/first_valid_uid = 100/g' /etc/dovecot/conf.d/10-mail.conf \ - && sed -i 's/#last = .*/last = 100/g' /etc/dovecot/conf.d/10-mail.conf + && sed -i 's/#last_valid_uid = .*/last_valid_uid = 100/g' /etc/dovecot/conf.d/10-mail.conf RUN addgroup -S vmail \ && adduser -S -g '' -H -D -h /var/vmail vmail vmail diff --git a/dovecot/auth-ldap.conf.ext b/dovecot/auth-ldap.conf.ext index e37e23e..6d8cf30 100644 --- a/dovecot/auth-ldap.conf.ext +++ b/dovecot/auth-ldap.conf.ext @@ -1,6 +1,7 @@ passdb { driver = ldap args = /etc/dovecot/dovecot-ldap.conf.ext + override_fields = user=%{auth_user} } userdb { diff --git a/dovecot/entrypoint.sh b/dovecot/entrypoint.sh index 6ccff8b..d5ebca8 100755 --- a/dovecot/entrypoint.sh +++ b/dovecot/entrypoint.sh @@ -4,11 +4,7 @@ cat >> /etc/dovecot/dovecot-ldap.conf.ext << DOVECOTLDAP hosts = $LDAP_SERVER base = $LDAP_BASE auth_bind = yes -user_filter = (&(objectClass=posixAccount)(mail=%u)) pass_filter = (&(objectClass=posixAccount)(mail=%u)) -user_attrs = \ - =home=/var/vmail/%d/%n, \ - =mail=maildir:/var/vmail/%d/%n/Maildir DOVECOTLDAP cat > /etc/dovecot/conf.d/10-ssl.conf << SSL @@ -19,9 +15,6 @@ ssl_key = <$TLS_KEY ssl_dh_parameters_length = 2048 SSL -# debugging -#echo -e "auth_verbose=yes\nauth_debug=yes\nauth_debug_passwords=yes" >> /etc/dovecot/dovecot.conf - [ -e /var/lib/dovecot/instances ] && rm -rf /var/lib/dovecot/instances exec dovecot -F diff --git a/newaliases.sh b/newaliases.sh index 831249a..bf9116f 100755 --- a/newaliases.sh +++ b/newaliases.sh @@ -1,4 +1,5 @@ #!/bin/sh -sudo chown root:root aliases -docker-compose exec postfix postmap /etc/postfix/virtual -sudo chown $USER:$USER aliases +docker-compose exec postfix sh -c " +chown root:root /etc/postfix/virtual; +postmap /etc/postfix/virtual; +chown $(id -u):$(id -g) /etc/postfix/virtual" diff --git a/postfix/Dockerfile b/postfix/Dockerfile index 6977969..6a66211 100644 --- a/postfix/Dockerfile +++ b/postfix/Dockerfile @@ -43,8 +43,6 @@ RUN echo '' > /etc/postfix/main.cf \ && postconf -e strict_rfc821_envelopes='yes' \ && echo 'MAILER-DAEMON: postmaster\npostmaster: root' > /etc/postfix/aliases -# && postconf -e virtual_mailbox_maps='ldap:/etc/postfix/ldap/mailbox.cf' \ - COPY master.cf /etc/postfix/master.cf COPY smtp_header_checks /etc/postfix/smtp_header_checks diff --git a/postfix/postfix.sh b/postfix/postfix.sh index 776d5a7..34acee1 100755 --- a/postfix/postfix.sh +++ b/postfix/postfix.sh @@ -13,8 +13,9 @@ postconf -e smtpd_tls_cert_file="$TLS_FULLCHAIN" postconf -e virtual_mailbox_domains="$DOMAINS" -for hash in access_recipient access_sender access_helo;do #virtual;do +for hash in access_recipient access_sender access_helo virtual;do touch /etc/postfix/$hash + chown root:root /etc/postfix/$hash postmap /etc/postfix/$hash done