Skip to content

Commit

Permalink
Better Cyrus configuration: set password
Browse files Browse the repository at this point in the history
  • Loading branch information
guimard committed Mar 15, 2023
1 parent 68d6e85 commit fa435d6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ ARG DEBIANVERSION=bullseye

FROM debian:${DEBIANVERSION}-slim as debian-backports-updated

ENV DEBIAN_VERSION=bullseye \
MAILNAME=mail.example.com \
OTHER_DESTINATIONS="example.com mail.example.com" \
RELAY_HOST= \
MYNETWORKS="127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128" \
ROOT_ADDRESS=
ENV DEBIAN_VERSION=bullseye

RUN echo "# Install packages from ${DEBIAN_VERSION}" && \
apt-get -y update && \
Expand All @@ -23,6 +18,16 @@ LABEL maintainer="Yadd [email protected]>" \
name="yadd/cyrus-imapd-postfix" \
version="v1.0"

ENV DEBIAN_VERSION=bullseye \
MAILNAME=mail.example.com \
OTHER_DESTINATIONS="example.com mail.example.com" \
RELAY_HOST= \
MYNETWORKS="127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128" \
ROOT_ADDRESS= \
CYRUS_PWD= \
SASL_PWCHECK_METHOD="saslauthd auxprop" \
SASLDB=sasldb

RUN \
echo cyrus-common cyrus-common/removespools boolean false | debconf-set-selections && \
echo postfix postfix/main_mailer_type select "Internet Site" | debconf-set-selections && \
Expand All @@ -44,7 +49,8 @@ RUN \
cyrus-admin/${DEBIAN_VERSION}-backports \
cyrus-caldav/${DEBIAN_VERSION}-backports \
libcyrus-imap-perl/${DEBIAN_VERSION}-backports \
postfix && \
postfix \
sasl2-bin && \
apt autoremove -y && apt clean && rm -rf /var/lib/apt/lists/* && \
rm -f /etc/postfix/master.cf.proto \
/etc/postfix/sasl_passwd \
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ _(after the first run if volume is kept)_.

Environment variables for Postfix _(with default value)_:

* `MAILNAME` = `mail.example.com`
* `OTHER_DESTINATIONS` = `example.com mail.example.com`
* `RELAY_HOST` = `""`
* `MYNETWORKS` = `127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128`
* `ROOT_ADDRESS` = `""`: _(address to which mail from root and postmaster will be sent)_
* For Cyrus-Imapd:
* `CYRUS_PWD` = `""` _(if not set, cyradm isn't usable)_
* `SASL_PWCHECK_METHOD` = `saslauthd auxprop`
* `SASLDB` = `sasldb`
* For Postfix
* `MAILNAME` = `mail.example.com`
* `OTHER_DESTINATIONS` = `example.com mail.example.com`
* `RELAY_HOST` = `""`
* `MYNETWORKS` = `127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128`
* `ROOT_ADDRESS` = `""`: _(address to which mail from root and postmaster will be sent)_

## Exposed ports

Expand Down
7 changes: 7 additions & 0 deletions install/etc/cont-init.d/cyrus-config
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@

mkdir -p /run/cyrus
chown cyrus /run/cyrus

if test "$CYRUS_PWD" = ""; then
echo "CYRUS_PWD isn't set, unable to configure cyrus adm password" >&2
else
echo -n "$CYRUS_PWD" | saslpasswd2 -p cyrus
fi
perl -i -pe 's/^sasl_auxprop_plugin:.*$//;s/^sasl_pwcheck_method:.*$/sasl_pwcheck_method: '$SASL_PWCHECK_METHOD'\nsasl_auxprop_plugin: '$SASLDB'/' /etc/imapd.conf

0 comments on commit fa435d6

Please sign in to comment.