fix(friendica): stop forcing SMTP AUTH the resolver already disabled

env.j2 emitted SMTP_TLS and SMTP_STARTTLS but never SMTP_AUTH, while always
emitting SMTP_AUTH_USER. The image turns that into "auth on":

  /setup_msmtp.sh:9   smtp_auth="${SMTP_AUTH:=on}"
  /setup_msmtp.sh:32  if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth $smtp_auth"; fi

Against an onion relay that offers no authentication, msmtp then aborts with
"the server does not support authentication ... tls=off auth=on ...
exitcode=EX_UNAVAILABLE". The role was contradicting its own resolver:
plugins/lookup/email.py:175-179 returns auth = tls, i.e. False for an onion.

That single failure took the whole stack down, because the healthcheck chains
the mail smoke test ahead of the web probe with && and only touches its
marker on success -- so curl never ran, the container was health-killed every
cycle, and the swarm stack never converged. Friendica 0 and Fediwall 0 both
died this way; Friendica 1 and 2, which have email disabled, converge fine.

Emit SMTP_AUTH from email.auth and gate the credentials on it, matching
sys-svc-mail-msmtp/templates/msmtprc.conf.j2:6,15-18. In the auth-off case the
effective mechanism is dropping SMTP_AUTH_USER -- line 32 only writes an auth
line when that variable exists, so msmtp falls back to its own default of off.
The explicit SMTP_AUTH stays because it states the intent and covers a future
caller that sets the user independently.

Not fixed here, deliberately: the healthcheck's && chaining. That is the
amplifier, not the cause, and decoupling it would let friendica report healthy
while unable to send a single mail.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-08-10 12:45:44 +02:00
1 parent 3ebd6e9507
commit 563da9e5b0
1 file changed
+3
+3
View File
@@ -18,8 +18,11 @@ MYSQL_PASSWORD={{ lookup('database', application_id, 'password') | dotenv_quote
SMTP={{ email.host }}
SMTP_DOMAIN={{ email.domain }}
SMTP_PORT={{ email.port }}
SMTP_AUTH={{ email.auth | on_off }}
{% if email.auth | bool %}
SMTP_AUTH_USER={{ email.username }}
SMTP_AUTH_PASS={{ email.password }}
{% endif %}
SMTP_TLS={{ 'on' if email.tls else 'off' }}
SMTP_STARTTLS={{ 'on' if email.start_tls else 'off' }}
SMTP_FROM=no-reply