Sign outgoing emails using DKIM

master
Pierre Jaury 9 years ago
parent 24680957f7
commit 66a1b50cc9

@ -55,7 +55,9 @@ class Domain(Base):
@property @property
def dkim_publickey(self): def dkim_publickey(self):
return dkim.strip_key(self.dkim_key).decode("utf8") dkim_key = self.dkim_key
if dkim_key:
return dkim.strip_key(self.dkim_key).decode("utf8")
def generate_dkim_key(self): def generate_dkim_key(self):
self.dkim_key = dkim.gen_key() self.dkim_key = dkim.gen_key()

@ -31,6 +31,7 @@ Domain details
{{ domain.name }}. 600 IN TXT "v=spf1 mx a:{{ config["HOSTNAME"] }} -all" {{ domain.name }}. 600 IN TXT "v=spf1 mx a:{{ config["HOSTNAME"] }} -all"
{{ domain.name }}. 600 IN SPF "v=spf1 mx a:{{ config["HOSTNAME"] }} -all"</pre></td> {{ domain.name }}. 600 IN SPF "v=spf1 mx a:{{ config["HOSTNAME"] }} -all"</pre></td>
</tr> </tr>
{% if domain.dkim_publickey %}
<tr> <tr>
<th>DKIM public key</th> <th>DKIM public key</th>
<td><pre style="white-space: pre-wrap; word-wrap: break-word;">{{ domain.dkim_publickey }}</pre></td> <td><pre style="white-space: pre-wrap; word-wrap: break-word;">{{ domain.dkim_publickey }}</pre></td>
@ -43,6 +44,7 @@ Domain details
<th>DNS DMARC entry</th> <th>DNS DMARC entry</th>
<td><pre>_dmarc.{{ domain.name }}. 600 IN TXT "v=DMARC1; p=reject; rua=mailto:{{ config["POSTMASTER"] }}@{{ config["DOMAIN"] }}; adkim=s; aspf=s"</pre></td> <td><pre>_dmarc.{{ domain.name }}. 600 IN TXT "v=DMARC1; p=reject; rua=mailto:{{ config["POSTMASTER"] }}@{{ config["DOMAIN"] }}; adkim=s; aspf=s"</pre></td>
</tr> </tr>
{% endif %}
</tbody> </tbody>
</table> </table>
{% endblock %} {% endblock %}

@ -117,3 +117,14 @@ greylisting {
awl_ttl = 3600s; awl_ttl = 3600s;
}; };
dkim {
domain {
key = /dkim;
domain = "*";
selector = "dkim";
};
header_canon = relaxed;
body_canon = relaxed;
sign_alg = sha256;
auth_only = no;
};

Loading…
Cancel
Save