This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| computing:chatmail [2026/09/08 02:02] – created oemb1905 | computing:chatmail [2026/09/08 02:20] (current) – oemb1905 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Chatmail Relay: https:// | + | ------------------------------------------- |
| + | * **chatmail** | ||
| + | * **Jonathan Haack** | ||
| + | * **Haack' | ||
| + | * **webmaster@haacksnetworking.org** | ||
| - | Official docs: https:// | + | ------------------------------------------- |
| - | Ticket for Trixie: https:// | + | |
| + | // | ||
| + | |||
| + | ------------------------------------------- | ||
| + | |||
| + | This tutorial contains my setup notes for creating my chatmail instance. | ||
| + | |||
| + | * Official docs: [[https:// | ||
| + | | ||
| + | * Chatmail Relay: [[https:// | ||
| Set up Debian 12 machine and a dedicated non-root user that will ssh into the root user and deploy the instance. Exchange keys etc., and make sure to use a ed25519 key. Once that's done, setup all DNS before starting and make sure all required packages are installed: | Set up Debian 12 machine and a dedicated non-root user that will ssh into the root user and deploy the instance. Exchange keys etc., and make sure to use a ed25519 key. Once that's done, setup all DNS before starting and make sure all required packages are installed: | ||
| sudo apt install git rsync python3-venv python3-dev gcc libcrypt-dev | sudo apt install git rsync python3-venv python3-dev gcc libcrypt-dev | ||
| - | | + | |
| + | Make sure the following DNS records are established to begin with: | ||
| + | |||
| + | * A | ||
| + | * AAAA | ||
| + | * MX | ||
| Then, as worker | Then, as worker | ||
| | | ||
| Line 13: | Line 32: | ||
| chmod 700 ~/.ssh | chmod 700 ~/.ssh | ||
| chmod 600 ~/ | chmod 600 ~/ | ||
| - | | + | |
| + | Let's now create a config file for ssh so we don't go out and back in but instead ssh directly into localhost: | ||
| + | |||
| + | su - worker | ||
| + | nano ~/ | ||
| + | |||
| + | Inside that, put the following: | ||
| + | |||
| + | < | ||
| + | Host mail.haacknet.org | ||
| + | HostName 127.0.0.1 | ||
| + | User root | ||
| + | IdentityFile ~/ | ||
| + | IdentitiesOnly yes | ||
| + | </code> | ||
| + | |||
| + | When exchanging keys, you will need to use the '' | ||
| chmod 600 ~/ | chmod 600 ~/ | ||
| git clone https:// | git clone https:// | ||
| Line 26: | Line 62: | ||
| scripts/ | scripts/ | ||
| - | This creates '' | + | This creates '' |
| - | --- | + | scripts/ |
| - | ## 2. First deploy | + | I had to run this twice. The second time it created the LE records. After that, run its DNS checker and then create all the records it requests |
| + | |||
| + | su - worker | ||
| + | cd ~/ | ||
| + | scripts/ | ||
| - | ``` | + | After setup, |
| - | cd ~/ | + | |
| - | scripts/ | + | |
| - | ``` | + | |
| - | This SSHes as root, installs the stack, writes Postfix/Dovecot/OpenDKIM/nginx, issues certs, starts services. | + | su - worker |
| + | cd ~/Repositories/relay | ||
| + | scripts/cmdeploy status | ||
| + | scripts/ | ||
| - | If it fails mid-way: fix the cause (SSH key, DNS A/AAAA already pointing at the box for HTTP-01, port 80 open), run `cmdeploy run` again. It is meant to be idempotent. | + | To upgrade |
| - | --- | + | cd ~/ |
| + | git pull origin main --rebase | ||
| + | scripts/ | ||
| + | scripts/ | ||
| - | ## 3. DNS at Hurricane Electric | + | You can see new accounts here: |
| - | TTL on HE for these was **14400** (4 hours). That is why Google `8.8.8.8` lagged. Authoritative check is `@ns1.he.net`, not `@8.8.8.8`. | + | find / |
| + | |||
| + | If a flood of new accounts comes in and/or you suspect bots, then disable public reg: | ||
| - | Minimum records (names relative to zone `haacknet.org` or FQDN as you entered them): | + | |
| - | + | ||
| - | | Name | Type | Value | | + | The primary page I used for setup was here: |
| - | |---|---|---| | + | |
| - | | `mail` | A | VPS IPv4 | | + | |
| - | | `mail` | AAAA | VPS IPv6 | | + | |
| - | | `mail` | MX | `10 mail.haacknet.org.` | | + | |
| - | | `www.mail` | CNAME | `mail.haacknet.org.` | | + | |
| - | | `mta-sts.mail` | CNAME | `mail.haacknet.org.` | | + | |
| - | | `mail` | TXT | `v=spf1 a ~all` | | + | |
| - | | `_dmarc.mail` | TXT | `v=DMARC1; | + | |
| - | | `opendkim._domainkey.mail` | TXT | exact string from `cmdeploy dns` (DKIM `p=`) | | + | |
| - | + | ||
| - | Plus whatever else `scripts/ | + | |
| - | + | ||
| - | Print the checklist from the laptop: | + | |
| - | + | ||
| - | ``` | + | |
| - | cd ~/ | + | |
| - | scripts/ | + | |
| - | ``` | + | |
| - | + | ||
| - | Verified live from the VPS after records existed: | + | |
| - | + | ||
| - | ``` | + | |
| - | dig @ns1.he.net TXT mail.haacknet.org | + | |
| - | # " | + | |
| - | + | ||
| - | dig @ns1.he.net TXT _dmarc.mail.haacknet.org | + | |
| - | # " | + | |
| - | + | ||
| - | dig @1.1.1.1 TXT mail.haacknet.org | + | |
| - | # same SPF | + | |
| - | ``` | + | |
| - | + | ||
| - | `cmdeploy dns` on the laptop still warned until the **laptop** resolver cache was cleared (reboot of netcmnd fixed it). Then: | + | |
| - | + | ||
| - | ``` | + | |
| - | Great! All your DNS entries are verified and correct. | + | |
| - | ``` | + | |
| - | + | ||
| - | Do not install Unbound on the VPS to “fix SPF”. Unbound is already there. Stale `8.8.8.8` is not the mail host. | + | |
| - | + | ||
| - | --- | + | |
| - | + | ||
| - | ## 4. Status and tests | + | |
| - | + | ||
| - | ``` | + | |
| - | scripts/ | + | |
| - | scripts/ | + | |
| - | ``` | + | |
| - | + | ||
| - | **Status:** all units listed above `active running`. Good. | + | |
| - | + | ||
| - | **Test result this session:** 25 passed, 7 skipped, 2 failed. | + | |
| - | + | ||
| - | Failures (not a broken relay): | + | |
| - | + | ||
| - | 1. `test_hide_senders_ip_address` — laptop could not `GET http:// | + | |
| - | 2. `test_no_vrfy` — `TimeoutError` connecting to `mail.haacknet.org: | + | |
| - | + | ||
| - | Skips for `CHATMAIL_DOMAIN2` are normal (no second relay configured). | + | |
| - | + | ||
| - | Re-run one test: | + | |
| - | + | ||
| - | ``` | + | |
| - | scripts/ | + | |
| - | ``` | + | |
| - | + | ||
| - | Skip the two environmental failures: | + | |
| - | + | ||
| - | ``` | + | |
| - | scripts/ | + | |
| - | ``` | + | |
| - | + | ||
| - | `pytest -x` stops at first failure; that is why the first run looked “stalled.” | + | |
| - | + | ||
| - | --- | + | |
| - | + | ||
| - | ## 5. Day-to-day on any build machine | + | |
| - | + | ||
| - | ``` | + | |
| - | cd ~/ | + | |
| - | scripts/ | + | |
| - | scripts/ | + | |
| - | scripts/cmdeploy run # apply git + chatmail.ini to the VPS | + | |
| - | scripts/cmdeploy test # online pytest | + | |
| - | ``` | + | |
| - | + | ||
| - | **Upgrade relay software** (not daily): | + | |
| - | + | ||
| - | ``` | + | |
| - | cd ~/ | + | |
| - | git pull origin main --rebase --autostash | + | |
| - | scripts/ | + | |
| - | scripts/ | + | |
| - | ``` | + | |
| - | + | ||
| - | Or pin a tag: `git pull origin 1.10.0` (example; use a real tag from the repo). | + | |
| - | + | ||
| - | You do **not** need to git pull just to run `dns` / `status`. | + | |
| - | + | ||
| - | --- | + | |
| - | + | ||
| - | ## 6. Several laptops + the VPS checkout | + | |
| - | + | ||
| - | Rules that bit you in discussion: | + | |
| - | + | ||
| - | - Copy **one** `chatmail.ini`. Do not `cmdeploy init` on machine #2. | + | |
| - | - Same git revision is nice-to-have; | + | |
| - | - Whoever runs `cmdeploy run` last overwrites the server to **that** tree + **that** ini. | + | |
| - | - `cmdeploy` always uses root SSH. | + | |
| - | + | ||
| - | Copy ini + tree to another laptop: | + | |
| - | + | ||
| - | ``` | + | |
| - | scp ~/ | + | |
| - | ``` | + | |
| - | + | ||
| - | SSH config on a remote laptop can stay `Host mail.haacknet.org` → public name. No need to force `HostName 127.0.0.1` unless you are on the VPS itself **and** hairpin to the public IP fails. | + | |
| - | + | ||
| - | --- | + | |
| - | + | ||
| - | ## 7. Management checkout on the VPS (`worker`) | + | |
| - | + | ||
| - | You put the repo and the laptop’s `id_ed25519` on `/ | + | |
| - | + | ||
| - | Already done from netcmnd: | + | |
| - | + | ||
| - | ``` | + | |
| - | scp ~/ | + | |
| - | scp -r ~/ | + | |
| - | ``` | + | |
| - | + | ||
| - | On the VPS, as root: | + | |
| - | + | ||
| - | ``` | + | |
| - | apt install -y python3-venv python3-dev gcc libcrypt-dev rsync git | + | |
| - | ``` | + | |
| - | + | ||
| - | Then: | + | |
| - | + | ||
| - | ``` | + | |
| - | su - worker | + | |
| - | chmod 700 ~/.ssh | + | |
| - | chmod 600 ~/ | + | |
| - | cd ~/relay | + | |
| - | scripts/ | + | |
| - | scripts/ | + | |
| - | ``` | + | |
| - | + | ||
| - | `authorized_keys` on root: **already has** this pubkey if that is how you SSH in from netcmnd. Do not append again unless `ssh root@mail.haacknet.org` from the `worker` account fails. | + | |
| - | + | ||
| - | Do **not** add an SSH `HostName 127.0.0.1` stanza unless `cmdeploy` from `worker` cannot connect to `mail.haacknet.org` (hairpin). You explicitly rejected that complexity; hairpin first. | + | |
| - | + | ||
| - | Do **not** run `cmdeploy init` on `worker`. | + | |
| - | + | ||
| - | --- | + | |
| - | + | ||
| - | ## 8. What not to do | + | |
| - | + | ||
| - | - Dist-upgrade the mail VM to Trixie/ | + | |
| - | - `apt install unbound` on the mail VM. | + | |
| - | - Hand-edit Dovecot/ | + | |
| - | - Second `cmdeploy init`. | + | |
| - | - Treat `8.8.8.8` as authority | + | |
| - | - Assume `cmdeploy test` from a LAN that blocks outbound 25 is a mail outage. | + | |
| - | - Put this relay on the same policy as your full Postfix+Dovecot mailbox servers (`jonathanhaack.com` etc.). Different job. | + | |
| - | + | ||
| - | --- | + | |
| - | + | ||
| - | ## 9. Clients | + | |
| - | + | ||
| - | In Delta Chat / Arcane Chat, add account / use chatmail onboarding against **`mail.haacknet.org`**. Instant account create on first login is the point of doveauth. | + | |
| - | + | ||
| - | Federation to other chatmail relays needs the full DNS set (`cmdeploy dns` green), not just A/AAAA. | + | |
| - | + | ||
| - | --- | + | |
| - | + | ||
| - | ## 10. Session outcome | + | |
| - | + | ||
| - | - Relay installed and services up. | + | |
| - | - SPF + DMARC published at HE; Cloudflare already seeing SPF; laptop `cmdeploy dns` green after reboot. | + | |
| - | - Online tests: stack works; two failures are client-network (`icanhazip: | + | |
| - | - Management copy: `worker@mail` + `~/relay` + `id_ed25519` + `initenv.sh` still to confirm with `cmdeploy status` from that user. | + | |
| - | + | ||
| - | Check from `worker` when you next log in: | + | |
| - | + | ||
| - | ``` | + | |
| - | su - worker | + | |
| - | cd ~/relay | + | |
| - | scripts/ | + | |
| - | scripts/ | + | |
| - | ``` | + | |
| + | --- // | ||