# mx.kaareskovgaard.net

This is a setup of a Mail eXchange server. The goal is to have a fast, secure, hassle-free mail server running.

The server is using a 2-disk setup in hetzner, with the data disk (storing the mails) being a zfs zpool disk. It is done this way to:

1. Be encrypted, I don't want my mails lying freely around on other peoples hardware.
2. Be easy to back up daily on my TrueNAS server. I want to be reasonably sure that my emails don't just disppear on me. It is not _critical_, but also I would like to avoid loosing them. Also they should compress nicely, so this might give a slight boost.

## Add new domains

To add new domains to the MX, simply add them to domains in `default.nix`. This will enable setting up cloudflare DNS records for the domain as well as enabling the address to be used. Accounts are specified in `users.nix`. User accounts are expected to have a user in kanidm on `security.kaareskovgaard.net`, and the user should have a POSIX account with a POSIX password set there to be able to authenticate over IMAP and SMTP. A future version of Kanidm may change this, as Application specific passwords over LDAP should become a thing.

## Loading of encryption key for the zpool

The encryption key for the zpool is stored in OpenBAO, and is loaded during boot and should just work. The key is never stored on the server disk itself, and should never hit the disk itself.

## Resizing zfs pool

Simply changing the disk size in the nix code and running the `provision-instance` script and then rebooting the instance should be enough.
