Browse Source

added milter-sasl

tags/v1.1.0
Robin Thoni 7 years ago
parent
commit
b49da6f73a

+ 10
- 0
docker-compose.yml View File

@@ -70,5 +70,15 @@ services:
70 70
         env_file:
71 71
             - env
72 72
 
73
+    milter-sasl:
74
+        build: ./milter-sasl
75
+        container_name: mx-milter-sasl
76
+        networks:
77
+            mx.internal.docker:
78
+                aliases:
79
+                  - milter-sasl.mx.internal.docker
80
+        env_file:
81
+            - env
82
+
73 83
 networks:
74 84
     mx.internal.docker:

+ 3
- 0
dovecot/vars-vars View File

@@ -15,6 +15,9 @@ POSTFIX_HOST
15 15
 OPENDKIM_HOST
16 16
 OPENDKIM_PORT
17 17
 
18
+MILTER_SASL_HOST
19
+MILTER_SASL_PORT
20
+
18 21
 EXIM_SMARTHOST_HOST
19 22
 EXIM_SMARTHOST_USER
20 23
 EXIM_SMARTHOST_PASSWORD

+ 3
- 0
env View File

@@ -15,6 +15,9 @@ POSTFIX_HOST=postfix.mx.internal.docker
15 15
 OPENDKIM_HOST=opendkim.mx.internal.docker
16 16
 OPENDKIM_PORT=12345
17 17
 
18
+MILTER_SASL_HOST=milter-sasl.mx.internal.docker
19
+MILTER_SASL_PORT=12345
20
+
18 21
 EXIM_SMARTHOST_HOST=test-mx.rthoni.com
19 22
 EXIM_SMARTHOST_USER=smarthost@test-mx.rthoni.com
20 23
 EXIM_SMARTHOST_PASSWORD=smarthost

+ 30
- 0
milter-sasl/Dockerfile View File

@@ -0,0 +1,30 @@
1
+FROM debian:jessie
2
+
3
+MAINTAINER Robin Thoni <robin@rthoni.com>
4
+
5
+RUN apt-get update &&\
6
+    apt-get install -y gcc g++ cmake libssl-dev libjsoncpp-dev libmilter-dev git &&\
7
+    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
8
+
9
+RUN git clone https://git.rthoni.com/robin.thoni/milter-sasl &&\
10
+    cd milter-sasl && git checkout develop  &&\
11
+    mkdir build && cd build &&\
12
+    cmake .. && make &&\
13
+    cp src/milter-sasl /usr/local/bin
14
+
15
+RUN rm -rf /var/log/* &&\
16
+    mkfifo /var/log/syslog &&\
17
+    ln -s /dev/null /var/log/mail.log &&\
18
+    ln -s /dev/null /var/log/mail.err &&\
19
+    ln -s /dev/null /var/log/main.info &&\
20
+    ln -s /dev/null /var/log/messages
21
+
22
+COPY ./config /etc/milter-sasl/
23
+
24
+COPY ./vars-vars /etc/vars-vars
25
+
26
+COPY ./vars-files /etc/vars-files
27
+
28
+COPY ./run.sh /run.sh
29
+
30
+CMD ["/run.sh"]

+ 4
- 0
milter-sasl/config/milter-sasl.json View File

@@ -0,0 +1,4 @@
1
+{
2
+  "key": "your key here",
3
+  "socket": "inet:MILTER_SASL_PORT@0.0.0.0"
4
+}

+ 29
- 0
milter-sasl/run.sh View File

@@ -0,0 +1,29 @@
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
+milter-sasl

+ 1
- 0
milter-sasl/vars-files View File

@@ -0,0 +1 @@
1
+/etc/milter-sasl/milter-sasl.json

+ 23
- 0
milter-sasl/vars-vars View File

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

+ 2
- 0
opendkim/config/opendkim.conf View File

@@ -12,6 +12,8 @@ InternalHosts           refile:/etc/opendkim/TrustedHosts
12 12
 KeyTable                refile:/etc/opendkim/KeyTable
13 13
 SigningTable            refile:/etc/opendkim/SigningTable
14 14
 
15
+SignHeaders             Date,From,To,Subject,X-Sasl-User
16
+
15 17
 Mode                    sv
16 18
 PidFile                 /var/run/opendkim/opendkim.pid
17 19
 SignatureAlgorithm      rsa-sha256

+ 3
- 0
opendkim/vars-vars View File

@@ -15,6 +15,9 @@ POSTFIX_HOST
15 15
 OPENDKIM_HOST
16 16
 OPENDKIM_PORT
17 17
 
18
+MILTER_SASL_HOST
19
+MILTER_SASL_PORT
20
+
18 21
 EXIM_SMARTHOST_HOST
19 22
 EXIM_SMARTHOST_USER
20 23
 EXIM_SMARTHOST_PASSWORD

+ 2
- 1
postfix/config/main.cf View File

@@ -83,7 +83,8 @@ message_size_limit = 0
83 83
 
84 84
 milter_default_action = accept
85 85
 milter_protocol = 6
86
-smtpd_milters = inet:OPENDKIM_HOST:OPENDKIM_PORT
86
+smtpd_milters = inet:MILTER_SASL_HOST:MILTER_SASL_PORT,
87
+                inet:OPENDKIM_HOST:OPENDKIM_PORT
87 88
 non_smtpd_milters = inet:OPENDKIM_HOST:OPENDKIM_PORT
88 89
 smtpd_relay_restrictions = permit_mynetworks,
89 90
         permit_sasl_authenticated,

+ 3
- 0
postfix/vars-vars View File

@@ -15,6 +15,9 @@ POSTFIX_HOST
15 15
 OPENDKIM_HOST
16 16
 OPENDKIM_PORT
17 17
 
18
+MILTER_SASL_HOST
19
+MILTER_SASL_PORT
20
+
18 21
 EXIM_SMARTHOST_HOST
19 22
 EXIM_SMARTHOST_USER
20 23
 EXIM_SMARTHOST_PASSWORD

+ 3
- 0
postfixadmin/vars-vars View File

@@ -15,6 +15,9 @@ POSTFIX_HOST
15 15
 OPENDKIM_HOST
16 16
 OPENDKIM_PORT
17 17
 
18
+MILTER_SASL_HOST
19
+MILTER_SASL_PORT
20
+
18 21
 EXIM_SMARTHOST_HOST
19 22
 EXIM_SMARTHOST_USER
20 23
 EXIM_SMARTHOST_PASSWORD

Loading…
Cancel
Save