Explorar el Código

Replace OpenDKIM with Rspamd's dkim_signing module

- remove configuration of OpenDKIM
- remove OpenDKIM milter from postfix's configuration
- add configuration files for rpsamd's dkim module
- update the rspamd task
- update services in README
Mike Ashley hace 7 años
padre
commit
486c3f1414

+ 7
- 7
README.md Ver fichero

@@ -20,15 +20,15 @@ What do you get if you point Sovereign at a server? All kinds of good stuff!
20 20
 -   [IMAP](https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol) over SSL via [Dovecot](http://dovecot.org/), complete with full text search provided by [Solr](https://lucene.apache.org/solr/).
21 21
 -   [POP3](https://en.wikipedia.org/wiki/Post_Office_Protocol) over SSL, also via Dovecot
22 22
 -   [SMTP](https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol) over SSL via Postfix, including a nice set of [DNSBLs](https://en.wikipedia.org/wiki/DNSBL) to discard spam before it ever hits your filters.
23
+-   Virtual domains for your email, backed by [PostgreSQL](http://www.postgresql.org/).
24
+-   Spam fighting via [Rspamd](https://www.rspamd.com/).
25
+-   Mail server verification using [DKIM](http://www.dkim.org/) and [DMARC](http://www.dmarc.org/) so the Internet knows your mailserver is legit.
26
+-   Secure on-disk storage for email and more via [EncFS](http://www.arg0.net/encfs).
23 27
 -   Webmail via [Roundcube](http://www.roundcube.net/).
24 28
 -   Mobile push notifications via [Z-Push](http://z-push.sourceforge.net/soswp/index.php?pages_id=1&t=home).
25 29
 -   Email client [automatic configuration](https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration).
26 30
 -   Jabber/[XMPP](http://xmpp.org/) instant messaging via [Prosody](http://prosody.im/).
27 31
 -   An RSS Reader via [Selfoss](http://selfoss.aditu.de/).
28
--   Virtual domains for your email, backed by [PostgreSQL](http://www.postgresql.org/).
29
--   Secure on-disk storage for email and more via [EncFS](http://www.arg0.net/encfs).
30
--   Spam fighting via [Rspamd](https://www.rspamd.com/) and [Postgrey](http://postgrey.schweikert.ch/).
31
--   Mail server verification via [OpenDKIM](http://www.opendkim.org/) and [DMARC](http://www.dmarc.org/) so the Internet knows your mailserver is legit.
32 32
 -   [CalDAV](https://en.wikipedia.org/wiki/CalDAV) and [CardDAV](https://en.wikipedia.org/wiki/CardDAV) to keep your calendars and contacts in sync, via [ownCloud](http://owncloud.org/).
33 33
 -   Your own private storage cloud via [ownCloud](http://owncloud.org/).
34 34
 -   Your own VPN server via [OpenVPN](http://openvpn.net/index.php/open-source.html).
@@ -158,13 +158,13 @@ The `dependencies` tag just installs dependencies, performing no other operation
158 158
 
159 159
 Create an `MX` record for `example.com` which assigns `mail.example.com` as the domain’s mail server.
160 160
 
161
-To ensure your emails pass DKIM checks you need to add a `txt` record. The name field will be `default._domainkey.EXAMPLE.COM.` The value field contains the public key used by OpenDKIM. The exact value needed can be found in the file `/etc/opendkim/keys/EXAMPLE.COM/default.txt` it’ll look something like this:
161
+To ensure your emails pass DKIM checks you need to add a `txt` record. The name field will be `default._domainkey.EXAMPLE.COM.` The value field contains the public key used by DKIM. The exact value needed can be found in the file `/var/lib/rspamd/dkim/EXAMPLE.COM.default.txt`. It will look something like this:
162 162
 
163 163
     v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKKAQfMwKVx+oJripQI+Ag4uTwYnsXKjgBGtl7Tk6UMTUwhMqnitqbR/ZQEZjcNolTkNDtyKZY2Z6LqvM4KsrITpiMbkV1eX6GKczT8Lws5KXn+6BHCKULGdireTAUr3Id7mtjLrbi/E3248Pq0Zs39hkDxsDcve12WccjafJVwIDAQAB
164 164
 
165
-For DMARC you'll also need to add a `txt` record. The name field should be `_dmarc.EXAMPLE.COM` and the value should be `v=DMARC1; p=none`. More info on DMARC can be found [here](https://dmarc.org)
165
+For DMARC you'll also need to add a `txt` record. The name field should be `_dmarc.EXAMPLE.COM` and the value should be `v=DMARC1; p=none`. More info on DMARC can be found [here](https://dmarc.org).
166 166
 
167
-Set up SPF and reverse DNS [as per this post](http://sealedabstract.com/code/nsa-proof-your-e-mail-in-2-hours/). Make sure to validate that it’s all working, for example by sending an email to <a href="mailto:check-auth@verifier.port25.com">check-auth@verifier.port25.com</a> and reviewing the report that will be emailed back to you.
167
+Set up SPF and reverse DNS [as per this post](http://sealedabstract.com/code/nsa-proof-your-e-mail-in-2-hours/). Make sure to validate that it’s all working, for example, by sending an email to <a href="mailto:check-auth@verifier.port25.com">check-auth@verifier.port25.com</a> and reviewing the report that will be emailed back to you.
168 168
 
169 169
 ### 8. Miscellaneous Configuration
170 170
 

+ 0
- 18
roles/mailserver/files/etc_opendkim.conf Ver fichero

@@ -1,18 +0,0 @@
1
-##
2
-## opendkim.conf -- configuration file for OpenDKIM filter
3
-##
4
-Canonicalization        relaxed/relaxed
5
-ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
6
-InternalHosts           refile:/etc/opendkim/TrustedHosts
7
-KeyTable                refile:/etc/opendkim/KeyTable
8
-LogWhy                  Yes
9
-MinimumKeyBits          1024
10
-Mode                    sv
11
-PidFile                 /var/run/opendkim/opendkim.pid
12
-SigningTable            refile:/etc/opendkim/SigningTable
13
-Socket                  inet:8891@localhost
14
-Syslog                  Yes
15
-SyslogSuccess           Yes
16
-TemporaryDirectory      /var/tmp
17
-UMask                   022
18
-UserID                  opendkim:opendkim

+ 5
- 0
roles/mailserver/files/etc_rspamd_override.d_dkim_signing.conf Ver fichero

@@ -0,0 +1,5 @@
1
+# Default path to key, can include '$domain' and '$selector' variables
2
+path = "/var/lib/rspamd/dkim/$domain.$selector.key";
3
+  
4
+# Default selector to use
5
+selector = "default";

+ 0
- 2
roles/mailserver/tasks/main.yml Ver fichero

@@ -2,8 +2,6 @@
2 2
   tags: postfix
3 3
 - include: dovecot.yml
4 4
   tags: dovecot
5
-- include: opendkim.yml
6
-  tags: opendkim
7 5
 - include: rspamd.yml
8 6
   tags: rspamd
9 7
 - include: solr.yml

+ 0
- 44
roles/mailserver/tasks/opendkim.yml Ver fichero

@@ -1,44 +0,0 @@
1
----
2
-# Handy reference: http://stevejenkins.com/blog/2010/09/how-to-get-dkim-domainkeys-identified-mail-working-on-centos-5-5-and-postfix-using-opendkim/
3
-
4
-- name: Install OpenDKIM and related packages
5
-  apt: pkg={{ item }} state=installed
6
-  with_items:
7
-    - opendkim
8
-    - opendkim-tools
9
-  tags:
10
-    - dependencies
11
-
12
-- name: Create OpenDKIM config directory
13
-  file: state=directory path=/etc/opendkim group=opendkim owner=opendkim
14
-
15
-- name: Create OpenDKIM key directories
16
-  file: state=directory path=/etc/opendkim/keys/{{ item.name }} group=opendkim owner=opendkim
17
-  with_items: "{{ mail_virtual_domains }}"
18
-
19
-- name: Generate OpenDKIM keys
20
-  command: opendkim-genkey -r -d {{ item.name }} -D /etc/opendkim/keys/{{ item.name }}/ creates=/etc/opendkim/keys/{{ item.name }}/default.private
21
-  with_items: "{{ mail_virtual_domains }}"
22
-
23
-- name: Put opendkim.conf into place
24
-  copy: src=etc_opendkim.conf dest=/etc/opendkim.conf owner=opendkim group=opendkim
25
-  notify:
26
-    - restart opendkim
27
-    - restart postfix
28
-
29
-- name: Put additional OpenDKIM configuration files into place
30
-  template: src=etc_opendkim_{{ item }}.j2 dest=/etc/opendkim/{{ item }} owner=opendkim group=opendkim
31
-  with_items:
32
-    - KeyTable
33
-    - SigningTable
34
-    - TrustedHosts
35
-  notify:
36
-    - restart opendkim
37
-    - restart postfix
38
-
39
-- name: Set OpenDKIM config directory permissions
40
-  file: state=directory path=/etc/opendkim
41
-          group=opendkim owner=opendkim mode=0700 recurse=yes
42
-  notify:
43
-    - restart opendkim
44
-    - restart postfix

+ 14
- 0
roles/mailserver/tasks/rspamd.yml Ver fichero

@@ -41,5 +41,19 @@
41 41
   copy: src=etc_rspamd_local.d_redis.conf dest=/etc/rspamd/local.d/redis.conf owner=root group=root mode="0644"
42 42
   notify: restart rspamd
43 43
 
44
+- name: Copy DKIM configuration into place
45
+  copy: src=etc_rspamd_override.d_dkim_signing.conf dest=/etc/rspamd/override.d/dkim_signing.conf owner=root group=root mode="0644"
46
+  notify: restart rspamd
47
+
48
+- name: Create dkim key directory
49
+  file: path=/var/lib/rspamd/dkim state=directory owner=_rspamd group=_rspamd
50
+
51
+- name: Generate DKIM keys
52
+  shell: rspamadm dkim_keygen -s default -d {{ item.name }} -k {{ item.name }}.default.key > {{ item.name }}.default.txt
53
+  args:
54
+    creates: /var/lib/rspamd/dkim/{{ item.name }}.default.key
55
+    chdir: /var/lib/rspamd/dkim/
56
+  with_items: "{{ mail_virtual_domains }}"
57
+
44 58
 - name: Start redis
45 59
   service: name=redis-server state=started

+ 0
- 3
roles/mailserver/templates/etc_opendkim_KeyTable.j2 Ver fichero

@@ -1,3 +0,0 @@
1
-{% for domain in mail_virtual_domains %}
2
-default._domainkey.{{ domain.name }} {{ domain.name }}:default:/etc/opendkim/keys/{{ domain.name}}/default.private
3
-{% endfor %}

+ 0
- 3
roles/mailserver/templates/etc_opendkim_SigningTable.j2 Ver fichero

@@ -1,3 +0,0 @@
1
-{% for domain in mail_virtual_domains %}
2
-*@{{ domain.name }} default._domainkey.{{ domain.name }}
3
-{% endfor %}

+ 0
- 8
roles/mailserver/templates/etc_opendkim_TrustedHosts.j2 Ver fichero

@@ -1,8 +0,0 @@
1
-127.0.0.1
2
-{{ ansible_default_ipv4.address }}
3
-{% for domain in mail_virtual_domains %}
4
-{{ domain.name }}
5
-{% endfor %}
6
-{% for domain in mail_virtual_domains %}
7
-{{ mail_server_hostname }}
8
-{% endfor %}

+ 2
- 2
roles/mailserver/templates/etc_postfix_main.cf.j2 Ver fichero

@@ -99,8 +99,8 @@ virtual_mailbox_maps = pgsql:/etc/postfix/pgsql-virtual-mailbox-maps.cf
99 99
 virtual_alias_maps = pgsql:/etc/postfix/pgsql-virtual-alias-maps.cf
100 100
 local_recipient_maps = $virtual_mailbox_maps
101 101
 
102
-# Milters: OpenDKIM, Rspamd
103
-smtpd_milters = inet:127.0.0.1:8891,inet:127.0.0.1:11332
102
+# Milters: Rspamd
103
+smtpd_milters = inet:127.0.0.1:11332
104 104
 non_smtpd_milters = $smtpd_milters
105 105
 milter_protocol = 6
106 106
 milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen} {auth_type}

Loading…
Cancelar
Guardar