Maddy: Difference between revisions
imported>Onny Update certificates option to latest upstream changes |
imported>Onny Add updated TLS section |
||
| Line 1: | Line 1: | ||
[https://maddy.email Maddy] is a composable, modern mail server written in Go. It includes everything required to manage users, inboxes, send and receive mails while supporting all important secure protocols and standards. | [https://maddy.email Maddy] is a composable, modern mail server written in Go. It includes everything required to manage users, inboxes, send and receive mails while supporting all important secure protocols and standards. | ||
{{Warning|Following example describes the usage of an experimental module which is still being reviewed as an [https://github.com/NixOS/nixpkgs/pull/153372 open PR] and might not be ready for production.}} | |||
== Installation == | == Installation == | ||
The following example enables the Maddy mail server on localhost, listening on mail delivery SMTP/Submission ports (<code>25, 587</code>) and IMAP port (<code>143</code>) for mail clients to connect to. Mailboxes for the accounts <code>postmaster@example.org</code> and <code>user1@example.org</code> get created if they don't exist yet. | |||
The following example enables the Maddy mail server listening on mail delivery SMTP/Submission ports (<code>25, 587</code>) and IMAP | |||
Mailboxes for the accounts <code>postmaster@example.org</code> and <code>user1@example.org</code> get created if they don't exist yet. | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
services.maddy = { | services.maddy = { | ||
enable = true; | enable = true; | ||
primaryDomain = "localhost"; | |||
primaryDomain = " | |||
ensureAccounts = [ | ensureAccounts = [ | ||
"user1@example.org" | "user1@example.org" | ||
| Line 38: | Line 24: | ||
</nowiki>}} | </nowiki>}} | ||
TLS | This local test setup doesn't provide secure TLS connections and should be used only for testing purpose. | ||
== Configuration == | |||
=== TLS === | |||
The following example changes the hostname for the mail server to the public domain <code>example.org</code>. TLS certificates are obtained using using the ACME dns-01 challenge. This requires API access to your domain provider. See [https://maddy.email/reference/tls-acme/ upstream documentation] for a list on supported providers and how to configure them. | |||
</ | Further the TLS connection is enabled on IMAP port <code>993</code> and Submission port <code>465</code>. | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
services.maddy = { | |||
enable = true; | |||
openFirewall = true; | |||
primaryDomain = "example.org"; | |||
tls = { | |||
loader = "acme"; | |||
extraConfig = '' | |||
email put-your-email-here@example.org | |||
agreed # indicate your agreement with Let's Encrypt ToS | |||
challenge dns-01 | |||
dns gandi { | |||
api_token "{env:GANDI_API_KEY}" | |||
} | |||
''; | |||
}; | |||
# Enable TLS listeners. Configuring this via the module is not yet | |||
# implemented. | |||
config = builtins.replaceStrings [ | |||
"imap tcp://0.0.0.0:143" | |||
"submission tcp://0.0.0.0:587" | |||
] [ | |||
"imap tls://0.0.0.0:993 tcp://0.0.0.0:143" | |||
"submission tls://0.0.0.0:465 tcp://0.0.0.0:587" | |||
] options.services.maddy.config.default; | |||
# Reading secrets from a file. Do not use this example in production | |||
# since it stores the keys world-readable in the Nix store. | |||
secrets = "${pkgs.writeText "secrets" '' | |||
GANDI_API_KEY=1234 | |||
''}"; | |||
}; | |||
</nowiki>}} | </nowiki>}} | ||
== | Alternativley certificates can be manually loaded with setting <code>tls.loader = "file";</code> and manually specifiying key and certificates file paths using the <code>tls.certificates = [];</code> option. In this case, more ACME protocols and providers are available when using the native NixOS [[ACME]] module. | ||
=== DNS records === | === DNS records === | ||