Maddy: Difference between revisions

imported>Onny
mNo edit summary
imported>Onny
Automatically read DKIM key from filesystem
Line 39: Line 39:
     "::"
     "::"
   ];  
   ];  
   zones."example.org.".data = ''
   zones."example.org.".data = let
    domainkey = ''
      v=DKIM1; k=rsa; p=${
        lib.fileContents( /var/lib/maddy/dkim_keys/example.org_default.dns )}'';
    segments = ((lib.stringLength domainkey) / 255);
    domainkeySplitted = map (x: lib.substring (x*255) 255 domainkey) (lib.range 0 segments);
  in ''
     @ SOA ns.example.org noc.example.org 666 7200 3600 1209600 3600
     @ SOA ns.example.org noc.example.org 666 7200 3600 1209600 3600
     @ A 1.2.3.4
     @ A 1.2.3.4
Line 51: Line 57:
     _mta-sts TXT "v=STSv1; id=1"
     _mta-sts TXT "v=STSv1; id=1"
     _smtp._tls TXT "v=TLSRPTv1;rua=mailto:postmaster@example.org"
     _smtp._tls TXT "v=TLSRPTv1;rua=mailto:postmaster@example.org"
     default._domainkey TXT "v=DKIM1; k=ed25519; p=nAcUUozPlhc4VPhp7hZl+owES7j7OlEv0laaDEDBAqg="
     default._domainkey TXT "${lib.concatStringsSep "\" \"" domainkeySplitted}"
   '';
   '';
};
};
</nowiki>}}
</nowiki>}}


Update the IPv4 and IPv6 addresses after <code>A</code> and <code>AAAA</code> to the one which points to the publc IP addresses of your mail server. The last entry is used by the <code>DKIM</code> authentication mechanism which enables recipients to verify the authenticity of mails send by your server. Create the following DNS record by using the value of the file Maddy generated on first startup <code>/var/lib/maddy/dkim_keys/example.org_default.dns</code>.
Update the IPv4 and IPv6 addresses after <code>A</code> and <code>AAAA</code> to the one which points to the publc IP addresses of your mail server. The last entry is used by the <code>DKIM</code> authentication mechanism which enables recipients to verify the authenticity of mails send by your server. They key is read from the file generated by Maddy on the first startup at <code>/var/lib/maddy/dkim_keys/example.org_default.dns</code>.


Now that your server also runs a DNS daemon besides the mail server, you have to configure it as the external nameserver of your domain <code>example.org</code>. Please consult your domain provider on how to do that.
Now that your server also runs a DNS daemon besides the mail server, you have to configure it as the external nameserver of your domain <code>example.org</code>. Please consult your domain provider on how to do that.