Custom Postfix SMTP relay image — builds via Kaniko, deploys on hermes
|
Some checks failed
Build smtp-relay / build (push) Failing after 1m10s
El correo saliente de manabo.org lo sostenian cuatro cambios aplicados con
postconf/adduser sobre el contenedor vivo. Llevaban 70 dias fuera de git: el
primer rollout restart, reschedule o actualizacion del Image Updater los borraba
y el relay volvia a quedar mudo -- sin aviso posible, porque la alerta ES el
correo.
La lista no se copio del README: se midio. Se arranco un contenedor de la imagen
que corre hoy (digest 38ebbe1d) y se diffeo su postconf -n/-M contra el pod vivo.
Son SEIS cambios, no cuatro:
master.cf falta el daemon tlsmgr -> smtpd ANUNCIA STARTTLS en el EHLO y luego
no puede hacerlo: 454 4.7.0 TLS not available due to local problem
master.cf falta postlog/postlogd -> Postfix escribe a syslog, aqui no hay
ninguno y kubectl logs sale VACIO (el incidente se diagnostico a
ciegas)
master.cf chroot y->n en los 20 servicios
main.cf falta maillog_file = /var/log/postfix.log
main.cf smtpd_sasl_local_domain: $myhostname -> el dominio real
Dockerfile postfix no estaba en el grupo sasl -> /etc/sasldb2 es root:sasl 0640
y smtpd no puede abrirlo: 454 Temporary authentication failure
Dos matices sobre lo que estaba anotado:
El chroot no se "pobla desde el build", se DESACTIVA. En el pod vivo
/var/spool/postfix/etc sigue vacio con fecha Mar 6 2024: nadie lo poblo nunca.
Poblarlo habria metido un mecanismo jamas ejercitado y dejado fuera el que
sostiene el correo. En un contenedor el chroot no aporta nada: el contenedor ES
el jail.
El realm no se fija a pelo en main.cf sino desde RELAY_AUTH_DOMAIN en el
entrypoint, que es la misma variable con la que saslpasswd2 crea la entrada del
sasldb. Declarados aparte pudieron divergir en silencio, y eso es exactamente lo
que causo el fallo de autenticacion.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|---|---|---|
| .gitea/workflows | ||
| scripts | ||
| Dockerfile | ||
| entrypoint.sh | ||
| main.cf | ||
| master.cf | ||
| README.md | ||
| smtpd.conf | ||
smtp-relay
Postfix SMTP relay with Cyrus SASL authentication and TLS.
Used by Mailu (personal + Solidaria NGO) on valhalla to route outbound mail through hermes, which has a trusted residential IP accepted by Gmail and Hotmail.
Image: harbor.manabo.org/library/smtp-relay
Deployed on: hermes (clusters/hermes/smtp-relay/ in asgard)
Build
./build.sh 1.0.0
Packages the Dockerfile context, uploads to MinIO, runs Kaniko in-cluster on valhalla, and pushes the resulting image to Harbor.
Configuration
Required Vault secrets (app/smtp-relay/smtp-relay-sasl)
| Key | Description |
|---|---|
relay_user |
SASL username (e.g. relayuser) |
relay_pass |
SASL password (plaintext — stored in Vault) |
relay_domain |
SASL domain (e.g. manabo.org) |
TLS (certs/smtp-relay-tls)
Wildcard cert for relay.manabo.org — pushed to Vault via PushSecret on valhalla.
Env vars (from ExternalSecret)
| Var | Source |
|---|---|
RELAY_AUTH_USER |
relay_user |
RELAY_AUTH_PASS |
relay_pass |
RELAY_AUTH_DOMAIN |
relay_domain |
How it works
- Listens on ports 25 (SMTP, TLS optional) and 587 (submission, TLS required)
- Uses
hostNetwork: true— ports exposed directly on the hermes host IP - Entrypoint creates a
sasldb2user from the env vars on every start - Only clients authenticated via SASL can relay mail
- TLS cert mounted from Vault ExternalSecret
Gotchas
- sasldb2 recreated on every restart: credentials are read from env vars and
saslpasswd2re-creates the sasldb. This is intentional (stateless SASL). - No DKIM: DKIM signing is not implemented in this image. Relay delivers mail as-is; DKIM signatures must be added by the sending MTA (Mailu).