Browse Source

Updated dovecot

tags/v2.0.0
Robin Thoni 1 year ago
parent
commit
65865be877

+ 10
- 35
dovecot/Dockerfile View File

@@ -1,39 +1,14 @@
1
-FROM debian:jessie
1
+FROM debian:stretch
2 2
 
3
-MAINTAINER Robin Thoni <robin@rthoni.com>
3
+ADD https://raw.githubusercontent.com/docker-gcf/docker-gcf/v1.5.0/setup.sh /tmp/docker-utils-setup.sh
4
+RUN sh /tmp/docker-utils-setup.sh
5
+ENTRYPOINT ["gcf-entrypoint"]
6
+CMD ["dovecot", "-F"]
4 7
 
5
-RUN groupadd -r email --gid=7788 && useradd -r -g email --uid=7788 email
8
+ENV DOVECOT_VERSION=1:2.2.*
6 9
 
7
-RUN apt-get update &&\
8
-    apt-get install -y dovecot-imapd dovecot-pop3d dovecot-sieve dovecot-managesieved dovecot-pgsql dovecot-ldap dovecot-lmtpd exim4 &&\
9
-    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
10
+RUN groupadd -r email --gid=7788 && useradd -r -g email --uid=7788 email &&\
11
+    pkgs-install dovecot-imapd=${DOVECOT_VERSION} dovecot-sieve=${DOVECOT_VERSION} dovecot-managesieved=${DOVECOT_VERSION} \
12
+                 dovecot-pgsql=${DOVECOT_VERSION} dovecot-ldap=${DOVECOT_VERSION} dovecot-lmtpd=${DOVECOT_VERSION}
10 13
 
11
-RUN rm -rf /etc/dovecot/*
12
-
13
-COPY ./config/ /etc/dovecot/
14
-
15
-COPY ./exim4/ /etc/exim4/
16
-
17
-RUN chown root:Debian-exim /etc/exim4/passwd.client &&\
18
-    update-exim4.conf
19
-
20
-RUN rm -rf /var/log/* &&\
21
-    mkdir -p /var/log/exim4/ &&\
22
-    ln -s /dev/stdout /var/log/exim4/mainlog &&\
23
-    ln -s /dev/stderr /var/log/exim4/paniclog
24
-
25
-COPY ./sieve/ /etc/dovecot/sieve/
26
-
27
-COPY ./vars-vars /etc/vars-vars
28
-
29
-COPY ./vars-files /etc/vars-files
30
-
31
-COPY ./run.sh /run.sh
32
-
33
-VOLUME ["/var/email"]
34
-
35
-EXPOSE 110 143 993 995 4190
36
-
37
-CMD ["/run.sh"]
38
-
39
-COPY ./certs/ /etc/ssl/private/
14
+COPY ./config /etc/salt/base/

+ 0
- 5
dovecot/config/dovecot-pgsql.conf View File

@@ -1,5 +0,0 @@
1
-driver = pgsql
2
-connect = host=POSTGRES_HOST dbname=POSTGRES_DB user=POSTGRES_USER password=POSTGRES_PASSWORD
3
-default_pass_scheme = MD5-CRYPT
4
-user_query = SELECT '/var/email/%d/%n' as home, 7788 AS uid, 7788 AS gid FROM mailbox WHERE username = '%u'
5
-password_query = SELECT password FROM mailbox WHERE username = '%u'

dovecot/config/dovecot-dict-auth.conf.ext → dovecot/config/states/dovecot/config/dovecot-dict-auth.conf.ext View File


+ 5
- 0
dovecot/config/states/dovecot/config/dovecot-pgsql.conf View File

@@ -0,0 +1,5 @@
1
+driver = pgsql
2
+connect = host={{ salt['pillar.get']("model:postgres:host") }} dbname={{ salt['pillar.get']("model:postgres:database") }} user={{ salt['pillar.get']("model:postgres:user") }} password={{ salt['pillar.get']("model:postgres:password") }}
3
+default_pass_scheme = MD5-CRYPT
4
+user_query = SELECT '/var/email/%d/%n' as home, 7788 AS uid, 7788 AS gid FROM mailbox WHERE username = '%u'
5
+password_query = SELECT password FROM mailbox WHERE username = '%u'

dovecot/config/dovecot.conf → dovecot/config/states/dovecot/config/dovecot.conf View File

@@ -1,24 +1,34 @@
1
-# 2.1.7: /etc/dovecot/dovecot.conf
2
-# OS: Linux 2.6.35.8-ikhpv1 x86_64 Debian 7.6 ext3
3
-mail_debug = yes
4 1
 auth_mechanisms = plain login
5 2
 auth_verbose = yes
3
+
6 4
 first_valid_gid = 7788
7 5
 first_valid_uid = 7788
8 6
 last_valid_gid = 7788
9 7
 last_valid_uid = 7788
10
-log_timestamp = "%Y-%m-%d %H:%M:%S "
8
+
11 9
 mail_location = maildir:/var/email/%d/%n/Maildir:LAYOUT=fs
12 10
 mail_privileged_group = email
11
+mail_debug = yes
12
+
13
+ssl_cert = </etc/ssl/certs/fullchain.pem
14
+ssl_key = </etc/ssl/certs/privkey.pem
15
+
16
+log_timestamp = "%Y-%m-%d %H:%M:%S "
17
+log_path = /dev/stderr
18
+
19
+postmaster_address = {{ salt['pillar.get']("model:dovecot:postmaster") }}
20
+
21
+protocols = imap sieve lmtp
22
+
13 23
 passdb {
14 24
   args = /etc/dovecot/dovecot-pgsql.conf
15 25
   driver = sql
16 26
 }
17
-protocols = imap pop3 sieve lmtp
27
+
18 28
 service auth {
19 29
   executable = /usr/lib/dovecot/auth
20 30
   inet_listener {
21
-    port = DOVECOT_SASL_PORT
31
+    port = {{ salt['pillar.get']("model:dovecot:sasl:port") }}
22 32
     address = 0.0.0.0
23 33
   }
24 34
   unix_listener auth-master {
@@ -27,17 +37,16 @@ service auth {
27 37
     user = email
28 38
   }
29 39
 }
30
-ssl_ca = </etc/ssl/private/mail-chain.crt
31
-ssl_cert = </etc/ssl/private/mail.crt
32
-ssl_key = </etc/ssl/private/mail.key
40
+
33 41
 userdb {
34 42
   args = /etc/dovecot/dovecot-pgsql.conf
35 43
   driver = sql
36 44
 }
45
+
37 46
 protocol lda {
38 47
   auth_socket_path = /var/run/dovecot/auth-master
39 48
   mail_plugins = sieve
40
-  postmaster_address = postmaster@example.org
49
+  postmaster_address = {{ salt['pillar.get']("model:dovecot:postmaster") }}
41 50
 }
42 51
 
43 52
 protocol lmtp {
@@ -60,14 +69,10 @@ service managesieve-login {
60 69
   }
61 70
 }
62 71
 
63
-log_path = /dev/stderr
64
-
65
-postmaster_address = postmaster@example.org
66
-
67 72
 service lmtp {
68 73
   inet_listener lmtp {
69 74
     address = 0.0.0.0
70
-    port = DOVECOT_LMTP_PORT
75
+    port = {{ salt['pillar.get']("model:dovecot:lmtp:port") }}
71 76
   }
72 77
 }
73 78
 

dovecot/certs/.gitkeep → dovecot/config/states/dovecot/config/sieve/after/.gitkeep View File


dovecot/sieve/after/.gitkeep → dovecot/config/states/dovecot/config/sieve/before/.gitkeep View File


+ 7
- 0
dovecot/config/states/dovecot/config/sieve/before/duplicates.sieve View File

@@ -0,0 +1,7 @@
1
+require ["duplicate","fileinto"];
2
+
3
+# Discard duplicates
4
+if allof (duplicate)
5
+{
6
+	discard;
7
+}

dovecot/sieve/before/.gitkeep → dovecot/config/states/dovecot/config/sieve/include/.gitkeep View File


+ 12
- 0
dovecot/config/states/dovecot/init.sls View File

@@ -0,0 +1,12 @@
1
+dovecot-config:
2
+  file.recurse:
3
+    - name: /etc/dovecot
4
+    - source: salt://dovecot/config
5
+    - template: jinja
6
+    - clean: True
7
+    - user: 7788
8
+    - group: 7788
9
+
10
+dovecot-pid-file:
11
+  file.absent:
12
+    - name: /var/run/dovecot/master.pid

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

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

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

@@ -1,31 +0,0 @@
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'

+ 0
- 33
dovecot/run.sh View File

@@ -1,33 +0,0 @@
1
-#! /usr/bin/env bash
2
-
3
-replace_var()
4
-{
5
-  file="${1}"
6
-  var="${2}"
7
-  sed -e "s?${var}?${!var}?g" -i "${file}"
8
-}
9
-
10
-replace_vars()
11
-{
12
-  file="${1}"
13
-  for var in $(cat /etc/vars-vars)
14
-  do
15
-    replace_var "${file}" "${var}"
16
-  done
17
-}
18
-
19
-replace_files()
20
-{
21
-  for file in $(cat /etc/vars-files)
22
-  do
23
-    replace_vars "${file}"
24
-  done
25
-}
26
-
27
-replace_files
28
-
29
-rm -f /var/run/dovecot/master.pid &&
30
-rm -f /var/run/exim4/exim.pid &&
31
-service exim4 start &&
32
-
33
-dovecot -F

+ 0
- 9
dovecot/sieve/before/spam.sieve View File

@@ -1,9 +0,0 @@
1
-## Generated by Vacation Sieve plugin for roundcube, the Fri, 04 Nov 2016 00:24:07 +0000 ##
2
-
3
-require ["fileinto","variables"];
4
-set "subject" "";
5
-# rule:[spam]
6
-if header :contains "subject" "[SPAM]"
7
-{
8
-	fileinto "Junk";
9
-}

+ 0
- 0
dovecot/sieve/include/.gitkeep View File


+ 0
- 4
dovecot/vars-files View File

@@ -1,4 +0,0 @@
1
-/etc/dovecot/dovecot.conf
2
-/etc/dovecot/dovecot-pgsql.conf
3
-/etc/exim4/update-exim4.conf.conf
4
-/etc/exim4/passwd.client

+ 0
- 23
dovecot/vars-vars View File

@@ -1,23 +0,0 @@
1
-POSTGRES_HOST
2
-POSTGRES_USER
3
-POSTGRES_PASSWORD
4
-POSTGRES_DB
5
-
6
-MAIL_DOMAIN
7
-MAIL_HOSTNAME
8
-
9
-DOVECOT_HOST
10
-DOVECOT_SASL_PORT
11
-DOVECOT_LMTP_PORT
12
-
13
-POSTFIX_HOST
14
-
15
-OPENDKIM_HOST
16
-OPENDKIM_PORT
17
-
18
-MILTER_SASL_HOST
19
-MILTER_SASL_PORT
20
-
21
-EXIM_SMARTHOST_HOST
22
-EXIM_SMARTHOST_USER
23
-EXIM_SMARTHOST_PASSWORD

Loading…
Cancel
Save