Browse Source

Updated opendkim

tags/v2.0.0
Robin THONI 5 months ago
parent
commit
44cc4a6613

+ 7
- 30
opendkim/Dockerfile View File

@@ -1,33 +1,10 @@
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 ["opendkim", "-f"]
4 7
 
5
-RUN apt-get update &&\
6
-    apt-get install -y opendkim opendkim-tools openssl libopendbx1-pgsql rsyslog &&\
7
-    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
8
+RUN pkgs-install opendkim opendkim-tools openssl libopendbx1-pgsql rsyslog
8 9
 
9
-RUN rm /etc/opendkim.conf &&\
10
-    ln -s /etc/opendkim/opendkim.conf /etc/opendkim.conf
11
-
12
-RUN rm -rf /var/log/* &&\
13
-    mkfifo /var/log/syslog &&\
14
-    ln -s /dev/null /var/log/mail.log &&\
15
-    ln -s /dev/null /var/log/mail.err &&\
16
-    ln -s /dev/null /var/log/main.info &&\
17
-    ln -s /dev/null /var/log/messages
18
-
19
-RUN sed -e 's/\(\$ModLoad imklog.*\)/#\1/' -i /etc/rsyslog.conf
20
-
21
-COPY ./config /etc/opendkim/
22
-
23
-RUN chown -R opendkim:opendkim /etc/opendkim
24
-
25
-COPY ./vars-vars /etc/vars-vars
26
-
27
-COPY ./vars-files /etc/vars-files
28
-
29
-COPY ./run.sh /run.sh
30
-
31
-VOLUME ["/etc/opendkim/keys"]
32
-
33
-CMD ["/run.sh"]
10
+COPY ./config /etc/salt/base/

+ 0
- 21
opendkim/config.sql/opendkim.conf View File

@@ -1,21 +0,0 @@
1
-AutoRestart             Yes
2
-AutoRestartRate         10/1h
3
-UMask                   002
4
-Syslog                  yes
5
-SyslogSuccess           yes
6
-LogWhy                  Yes
7
-
8
-Canonicalization        relaxed/simple
9
-
10
-ExternalIgnoreList      dsn:pgsql://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST/POSTGRES_DB/table=dkim_external_ignore_list?keycol=host?datacol=host
11
-InternalHosts           dsn:pgsql://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST/POSTGRES_DB/table=dkim_internal_hosts?keycol=host?datacol=host
12
-KeyTable                dsn:pgsql://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST/POSTGRES_DB/table=dkim_key_table?keycol=name?datacol=key_path
13
-SigningTable            dsn:pgsql://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST/POSTGRES_DB/table=dkim_signing_table?keycol=email?datacol=name
14
-
15
-Mode                    sv
16
-PidFile                 /var/run/opendkim/opendkim.pid
17
-SignatureAlgorithm      rsa-sha256
18
-
19
-UserID                  opendkim:opendkim
20
-
21
-Socket                  inet:OPENDKIM_PORT@0.0.0.0

+ 0
- 1
opendkim/config/KeyTable View File

@@ -1 +0,0 @@
1
-all                  MAIL_DOMAIN:dkim:/etc/opendkim/keys/dkim.private

+ 0
- 3
opendkim/config/TrustedHosts View File

@@ -1,3 +0,0 @@
1
-127.0.0.1
2
-localhost
3
-postfix.internal.docker

+ 1
- 0
opendkim/config/states/opendkim/config/KeyTable View File

@@ -0,0 +1 @@
1
+all                  {{ salt['pillar.get']("model:common:mail:domain") }}:dkim:/etc/opendkim/keys/dkim.private

opendkim/config/SigningTable → opendkim/config/states/opendkim/config/SigningTable View File


+ 3
- 0
opendkim/config/states/opendkim/config/TrustedHosts View File

@@ -0,0 +1,3 @@
1
+127.0.0.1
2
+localhost
3
+{{ salt['pillar.get']("model:common:mail:host") }}

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

@@ -20,4 +20,4 @@ SignatureAlgorithm      rsa-sha256
20 20
 
21 21
 UserID                  opendkim:opendkim
22 22
 
23
-Socket                  inet:OPENDKIM_PORT@0.0.0.0
23
+Socket                  inet:{{ salt['pillar.get']("model:opendkim:port") }}@0.0.0.0

+ 32
- 0
opendkim/config/states/opendkim/init.sls View File

@@ -0,0 +1,32 @@
1
+opendkim-config:
2
+  file.recurse:
3
+    - name: /etc/opendkim
4
+    - source: salt://opendkim/config
5
+    - user: opendkim
6
+    - group: opendkim
7
+    - template: jinja
8
+
9
+opendkim-config-etc:
10
+  file.symlink:
11
+    - name: /etc/opendkim.conf
12
+    - target: /etc/opendkim/opendkim.conf
13
+    - force: True
14
+
15
+opendkim-pid-file:
16
+  file.absent:
17
+    - name: /var/run/opendkim/opendkim.pid
18
+
19
+opendkim-key:
20
+  cmd.run:
21
+    - name: opendkim-genkey -s dkim -d "$(cat /tmp/gcf-model.json | jq -r .model.common.mail.domain)"
22
+    - cwd: /etc/opendkim/keys
23
+    - creates: /etc/opendkim/keys/dkim.private
24
+
25
+opendkim-key-owner:
26
+  file.directory:
27
+    - name: /etc/opendkim/keys
28
+    - user: opendkim
29
+    - group: opendkim
30
+    - recurse:
31
+      - user
32
+      - group

+ 0
- 43
opendkim/run.sh View File

@@ -1,43 +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
-if [ ! -e /etc/opendkim/keys/dkim.private ]
30
-then
31
-  cd /etc/opendkim/keys &&
32
-  opendkim-genkey -s dkim -d "${MAIL_DOMAIN}" &&
33
-  chown opendkim:opendkim dkim.private dkim.txt
34
-  cd --
35
-fi
36
-
37
-sleep 5
38
-
39
-rm -f /var/run/rsyslogd.pid
40
-rm -f /var/run/opendkim/opendkim.pid
41
-service rsyslog start
42
-service opendkim start &&
43
-cat /var/log/syslog

+ 0
- 2
opendkim/vars-files View File

@@ -1,2 +0,0 @@
1
-/etc/opendkim/opendkim.conf
2
-/etc/opendkim/KeyTable

+ 0
- 23
opendkim/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