Install · binary
Run it as a plain binary
No service manager, no container, nothing registered with the system. You download one file and run it. This is the shortest way to see mxhop work, and the right way to try it before you commit a domain to it.
-
Get the binary and check it
Pick the target that matches your machine:
x86_64-unknown-linux-musloraarch64-unknown-linux-musl. Both are static; neither needs a libc on the host.V=0.3.0; T=x86_64-unknown-linux-musl curl -fsSLO https://github.com/metronom72/mxhop/releases/download/v$V/mxhop-v$V-$T curl -fsSLO https://github.com/metronom72/mxhop/releases/download/v$V/SHA256SUMS-$T sha256sum -c SHA256SUMS-$T mxhop-v0.3.0-x86_64-unknown-linux-musl: OK
If that line does not say
OK, stop. Do not run the file. -
Put it somewhere on PATH
install -m 0755 mxhop-v$V-$T /usr/local/bin/mxhop mxhop --version mxhop 0.3.0
-
Write the config and the spool directory
The spool is where messages wait for a destination that is not taking them yet. It must be writable by whoever runs mxhop, and it must survive a restart — anything in it is mail somebody is waiting for.
mkdir -p /etc/mxhop /var/lib/mxhop/spool $EDITOR /etc/mxhop/mxhop.toml -
Check the config before anything is listening
checkreads the file, opens the certificate, the SRS secret and the ARC key, resolves everyviahost, and reports every problem it finds with the line it is on. It never binds a port.mxhop check /etc/mxhop/mxhop.toml: ok — mx.example.com on 0.0.0.0:25, 4 aliases for example.com, SRS at example.com (1 key, 7 day window), STARTTLS with /etc/letsencrypt/live/mx.example.com/fullchain.pem (read as mxhop), SPF/DKIM/DMARC checked, and a p=reject failure refused, a deferred message retried after 1, 5, 15, 60, 240 minutes and then every 4 hours, given up on after 48 hours, ARC sealed as example.com, /metrics and /healthz on 127.0.0.1:9779
That one line is the whole of what mxhop thinks it is about to do. Read it rather than trusting that the file says what you meant.
-
Run it
Port 25 is privileged, so binding it directly needs root or the capability. Running the whole process as root to get one socket is the thing the service install exists to avoid — but for a first look it is fine, and so is an unprivileged high port.
# a first look, on a port that needs no privilege sed -i 's/0.0.0.0:25/0.0.0.0:2525/' /etc/mxhop/mxhop.toml mxhop run --log info INFO mxhop is accepting mail address=0.0.0.0:2525 hostname=mx.example.com domains=1 aliases=4 srs=example.com queued=0 auth=dmarc tls=true
It logs one line on startup saying exactly what it came up as.
auth=dmarcmeans a forgery that fails ap=rejectpolicy gets refused rather than forwarded. -
Send something through it
printf 'EHLO test\r\nMAIL FROM:<me@test.example>\r\nRCPT TO:<hi@example.com>\r\nQUIT\r\n' \ | nc 127.0.0.1 2525 220 mx.example.com mxhop ready 250-mx.example.com greets test 250 ENHANCEDSTATUSCODES 250 2.1.0 sender accepted 250 2.1.5 recipient accepted 221 2.0.0 bye
What you do not get this way
- It does not come back after a reboot. Nothing is watching it. That is what the service install is for.
- Port 25 needs privilege. Either run as root, grant
CAP_NET_BIND_SERVICE, or let systemd hold the socket for you. - A stop is yours to make graceful. Send it
SIGTERM, notSIGKILL: onSIGTERMit stops accepting, gives open sessions 25 seconds to finish and answers anyone mid-command with421. Killed outright, a message being written to the spool is simply a.tmpfile that never got renamed, which is why that is the safe failure.