Browse Source

changed dovecot exim4 config to smarthost

tags/v1.0.0
Robin Thoni 7 years ago
parent
commit
eb0e98f884
5 changed files with 59 additions and 9 deletions
  1. 7
    7
      dovecot/Dockerfile
  2. 1
    0
      dovecot/exim4/passwd.client
  3. 31
    0
      dovecot/exim4/update-exim4.conf.conf
  4. 16
    2
      dovecot/run.sh
  5. 4
    0
      env

+ 7
- 7
dovecot/Dockerfile View File

@@ -4,23 +4,23 @@ MAINTAINER Robin Thoni <robin@rthoni.com>
4 4
 
5 5
 RUN groupadd -r email --gid=7788 && useradd -r -g email --uid=7788 email
6 6
 
7
-
8 7
 RUN apt-get update &&\
9 8
     apt-get install -y dovecot-imapd dovecot-pop3d dovecot-sieve dovecot-managesieved dovecot-pgsql dovecot-lmtpd exim4 &&\
10 9
     apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
11 10
 
12
-RUN sed -e "s/dc_eximconfig_configtype=.*/dc_eximconfig_configtype='internet'/" -i /etc/exim4/update-exim4.conf.conf &&\
13
-    sed -e "s/dc_other_hostnames=.*/dc_other_hostnames=''/" -i /etc/exim4/update-exim4.conf.conf &&\
14
-    update-exim4.conf
15
-
16
-COPY ./run.sh /run.sh
17
-
18 11
 RUN rm -rf /etc/dovecot/*
19 12
 
20 13
 COPY ./config/ /etc/dovecot/
21 14
 
22 15
 COPY ./certs/ /etc/ssl/private/
23 16
 
17
+COPY ./exim4/ /etc/exim4/
18
+
19
+RUN chown root:Debian-exim /etc/exim4/passwd.client &&\
20
+    update-exim4.conf
21
+
22
+COPY ./run.sh /run.sh
23
+
24 24
 VOLUME ["/var/email", "/etc/dovecot/sieve"]
25 25
 
26 26
 EXPOSE 110 143 993 995 4190

+ 1
- 0
dovecot/exim4/passwd.client View File

@@ -0,0 +1 @@
1
+EXIM_SMARTHOST_HOST:EXIM_SMARTHOST_USER:EXIM_SMARTHOST_PASSWORD

+ 31
- 0
dovecot/exim4/update-exim4.conf.conf View File

@@ -0,0 +1,31 @@
1
+# /etc/exim4/update-exim4.conf.conf
2
+#
3
+# Edit this file and /etc/mailname by hand and execute update-exim4.conf
4
+# yourself or use 'dpkg-reconfigure exim4-config'
5
+#
6
+# Please note that this is _not_ a dpkg-conffile and that automatic changes
7
+# to this file might happen. The code handling this will honor your local
8
+# changes, so this is usually fine, but will break local schemes that mess
9
+# around with multiple versions of the file.
10
+#
11
+# update-exim4.conf uses this file to determine variable values to generate
12
+# exim configuration macros for the configuration file.
13
+#
14
+# Most settings found in here do have corresponding questions in the
15
+# Debconf configuration, but not all of them.
16
+#
17
+# This is a Debian specific file
18
+
19
+dc_eximconfig_configtype='smarthost'
20
+dc_other_hostnames=''
21
+dc_local_interfaces='127.0.0.1 ; ::1'
22
+dc_readhost=''
23
+dc_relay_domains=''
24
+dc_minimaldns='false'
25
+dc_relay_nets=''
26
+dc_smarthost='EXIM_SMARTHOST_HOST::587'
27
+CFILEMODE='644'
28
+dc_use_split_config='true'
29
+dc_hide_mailname='false'
30
+dc_mailname_in_oh='true'
31
+dc_localdelivery='mail_spool'

+ 16
- 2
dovecot/run.sh View File

@@ -1,10 +1,24 @@
1 1
 #! /usr/bin/env sh
2 2
 
3
+replace_vars()
4
+{
5
+  file="${1}"
6
+  sed -e "s/DOVECOT_LMTP_PORT/${DOVECOT_LMTP_PORT}/" -i "${file}"
7
+  sed -e "s/DOVECOT_SASL_PORT/${DOVECOT_SASL_PORT}/" -i "${file}"
8
+  sed -e "s/EXIM_SMARTHOST_HOST/${EXIM_SMARTHOST_HOST}/" -i "${file}"
9
+  sed -e "s/EXIM_SMARTHOST_USER/${EXIM_SMARTHOST_USER}/" -i "${file}"
10
+  sed -e "s/EXIM_SMARTHOST_PASSWORD/${EXIM_SMARTHOST_PASSWORD}/" -i "${file}"
11
+}
12
+
3 13
 sed -e "s/connect *=.*/connect = host=${POSTGRES_HOST} dbname=${POSTGRES_DB} user=${POSTGRES_USER} password=${POSTGRES_PASSWORD}/g" -i /etc/dovecot/dovecot-pgsql.conf
4 14
 
5
-sed -e "s/DOVECOT_LMTP_PORT/${DOVECOT_LMTP_PORT}/" -i /etc/dovecot/dovecot.conf
6
-sed -e "s/DOVECOT_SASL_PORT/${DOVECOT_SASL_PORT}/" -i /etc/dovecot/dovecot.conf
7 15
 
16
+replace_vars /etc/dovecot/dovecot.conf
17
+replace_vars /etc/exim4/update-exim4.conf.conf
18
+replace_vars /etc/exim4/passwd.client
19
+
20
+
21
+rm -f /var/run/dovecot/master.pid &&
8 22
 service exim4 start &&
9 23
 
10 24
 dovecot -F

+ 4
- 0
env View File

@@ -14,3 +14,7 @@ POSTFIX_HOST=postfix.mx.internal.docker
14 14
 
15 15
 OPENDKIM_HOST=opendkim.mx.internal.docker
16 16
 OPENDKIM_PORT=12345
17
+
18
+EXIM_SMARTHOST_HOST=test-mx.rthoni.com
19
+EXIM_SMARTHOST_USER=smarthost@test-mx.rthoni.com
20
+EXIM_SMARTHOST_PASSWORD=smarthost

Loading…
Cancel
Save