forked from Fachschaft/nixConfig
Enable DKIM signing
This commit is contained in:
parent
836971cac4
commit
5dfd352edd
3 changed files with 93 additions and 0 deletions
|
@ -202,12 +202,53 @@ in {
|
|||
sieve.trusted.from-addr = "sender"; # set the from-address to the original sender as specified in the MAIL FROM.
|
||||
sieve.trusted.from-namo = "sender";
|
||||
sieve.trusted.return-path = "sender";
|
||||
# If we are the sender, we sign the message with DKIM. Else we leave it alone.
|
||||
sieve.trusted.sign = [
|
||||
{
|
||||
"if" = "is_local_domain('', sender_domain) || sender_domain == 'lists.mathebau.de'";
|
||||
"then" = "['rsa_' + sender_domain, 'ed25519_' + sender_domain]";
|
||||
}
|
||||
{"else" = false;}
|
||||
];
|
||||
sieve.trusted.limits = {
|
||||
redirects = 50;
|
||||
out-messages = 50;
|
||||
};
|
||||
session.data.script = "'redirects'";
|
||||
|
||||
# See https://stalw.art/docs/smtp/authentication/dkim/sign
|
||||
# We need two blocks per domain because the domain setting in the blocks does not accept variables like `sender_domain`.
|
||||
signature = let
|
||||
signatureTemplate = domain: {
|
||||
"rsa_${domain}" = {
|
||||
private-key = "%{file:/run/secrets/dkim_rsa}%";
|
||||
domain = "${domain}";
|
||||
selector = "rsa-default";
|
||||
headers = ["From" "To" "Cc" "Date" "Subject" "Message-ID" "Organization" "MIME-Version" "Content-Type" "In-Reply-To" "References" "List-Id" "User-Agent" "Thread-Topic" "Thread-Index"];
|
||||
algorithm = "rsa-sha256";
|
||||
canonicalization = "relaxed/relaxed";
|
||||
};
|
||||
"ed25519_${domain}" = {
|
||||
private-key = "%{file:/run/secrets/dkim_ed25519}%";
|
||||
domain = "${domain}";
|
||||
selector = "ed-default";
|
||||
headers = ["From" "To" "Cc" "Date" "Subject" "Message-ID" "Organization" "MIME-Version" "Content-Type" "In-Reply-To" "References" "List-Id" "User-Agent" "Thread-Topic" "Thread-Index"];
|
||||
algorithm = "ed25519-sha256";
|
||||
canonicalization = "relaxed/relaxed";
|
||||
};
|
||||
};
|
||||
in
|
||||
map signatureTemplate (["lists.mathebau.de"] ++ (map ({domain, ...}: domain) cfg.domains));
|
||||
|
||||
# Sign *our* outgoing mails with the configured signatures.
|
||||
auth.dkim.sign = [
|
||||
{
|
||||
"if" = "is_local_domain('', sender_domain) || sender_domain == 'lists.mathebau.de'";
|
||||
"then" = "['rsa_' + sender_domain, 'ed25519_' + sender_domain]";
|
||||
}
|
||||
{"else" = false;}
|
||||
];
|
||||
|
||||
authentication.fallback-admin = {
|
||||
user = "admin";
|
||||
# see passwd on azathoth for plaintext or machine secret in encoded format for HTTP Basic AUTH
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue