[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373

Aperta Adatta ai principianti
#137 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
django, docker, dockerfile, python, shell

Direzione di ricerca

Il bug si trova nello script di esecuzione del servizio s6 in /etc/s6-overlay/s6-rc.d/svc-healthchecks-smtpd/run, che passa EMAIL_PORT a manage.py smtpd e va in sleep quando la variabile non è impostata. Inizia da lì e verifica se il listener in ingresso dovrebbe invece leggere una propria variabile (come SMTPD_PORT) con il valore predefinito 2525. È completato quando il listener si collega alla porta 2525 con EMAIL_PORT impostata a 465, e si avvia quando EMAIL_PORT non è impostata; verifica con ps all'interno del container e con un'email di prova inviata alla porta 25.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

Healthchecks sends outbound emails via Django's built-in SMTP email backend. I configure my SMTP relay with EMAIL_PORT = 465.

Since 5.0.3-ls373 (the "Switch to gunicorn" change), the incoming SMTP listener follows EMAIL_PORT instead of staying on 2525. This broke incoming emails until I changed my Compose port map from 25:2525 to 25:465.

If EMAIL_PORT isn't set at all, the listener doesn't even start (the run script falls through to sleep infinity), so anyone relying on inbound email without configuring outbound SMTP is also broken with this update.

Expected Behavior

The inbound SMTP listener should ignore the outbound SMTP settings, and shouldn't fail to start when the outbound SMTP port is not configured.

Suggested fix: define another variable (e.g. SMTPD_PORT) to define the inbound port, and fall back to default 2525 when not set.

Steps To Reproduce
  1. Run 5.0.3-ls373 or later with EMAIL_PORT=465 and -p 25:2525.
  2. Send an email ping to the container.
  3. The connection is refused. ps inside the container shows manage.py smtpd --port 465.
Environment
Docker Compose, x86_64, image lscr.io/linuxserver/healthchecks:latest at 5.0.3-ls373, via NixOS Docker module, managed by Komodo.
CPU architecture

x86-64

Docker creation
services:
  healthchecks:
    image: lscr.io/linuxserver/healthchecks:5.0.3-ls373
    restart: unless-stopped
    volumes:
      - /opt/docker/healthchecks:/config
    ports:
      - 25:2525  # worked before ls373; now needs 25:465
    environment:
      PUID: "1000"
      PGID: "1000"
      SITE_ROOT: "https://healthchecks.example.com"
      ALLOWED_HOSTS: "healthchecks.example.com"
      PING_EMAIL_DOMAIN: "healthchecks.example.com"
      DEFAULT_FROM_EMAIL: "[email protected]"
      EMAIL_HOST: "smtp.example.com"
      EMAIL_PORT: "465"
      EMAIL_HOST_USER: "[email protected]"
      EMAIL_HOST_PASSWORD: "<redacted>"
      EMAIL_USE_TLS: "False"
      EMAIL_USE_SSL: "True"
      SECRET_KEY: "<redacted>"
Container logs
$ docker exec healthchecks-healthchecks-1 ps aux | grep smtpd
root    42  ...  s6-supervise svc-healthchecks-smtpd
abc    178  ...  python3 ./manage.py smtpd --port 465

$ cat /etc/s6-overlay/s6-rc.d/svc-healthchecks-smtpd/run
#!/usr/bin/with-contenv bash
cd /app/healthchecks || exit 1
if [[ -n ${EMAIL_PORT} ]]; then
    exec s6-setuidgid abc python3 ./manage.py smtpd --port "${EMAIL_PORT}"
else
    sleep infinity
fi
Lingua principale
Dockerfile
Stelle
205
Fork
39
Merge medio
3h 45m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su DevOps

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.