crazy-max / diun

Receive notifications when an image is updated on a Docker registry
https://crazymax.dev/diun/
MIT License
2.78k stars 108 forks source link

Domain is being stripped from username during SMTP auth. #1201

Open sbuller opened 5 days ago

sbuller commented 5 days ago

Support guidelines

I've found a bug and checked that ...

Description

I'm getting authentication failures from diun, and I've traced the problem to the username being supplied without the domain. I'm using a docker compose file, where I've set:

environment:
  - DIUN_NOTIF_MAIL_USERNAME=diun_notifications@nova3.ca

But when I check the mail server logs, I'm seeing

... AUTH user="diun_notifications" host=... success=false

I'm expecting the username to be sent unmodified.

Expected behaviour

I'm expecting the username to be sent unmodified.

Actual behaviour

The username is being supplied without the domain portion.

Steps to reproduce

Try to authenticate using a username with a domain portion

Diun version

v4.28.0

Docker info

Client: Docker Engine - Community
 Version:    26.1.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.14.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.27.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 5
  Running: 5
  Paused: 0
  Stopped: 0
 Images: 11
 Server Version: 26.1.3
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e377cd56a71523140ca6ae87e30244719194a521
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-107-generic
 Operating System: Ubuntu 22.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 11.64GiB
 Name: docker1
 ID: 95d48002-b7b4-461a-8b48-9778496e30e7
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Docker Compose config

services:
  diun:
    image: crazymax/diun:latest
    command: serve
    volumes:
      - diun-data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - TZ=America/Winnipeg
      - LOG_LEVEL=info
      - LOG_JSON=false
      - DIUN_WATCH_WORKERS=10
      - "DIUN_WATCH_SCHEDULE=0 */6 * * *"
      - DIUN_WATCH_JITTER=30s
      - DIUN_PROVIDERS_DOCKER=true
      - DIUN_NOTIF_MAIL_HOST=mail.example.com
      - DIUN_NOTIF_MAIL_PORT=587
      - DIUN_NOTIF_MAIL_LOCALNAME=diun.example.com
      - DIUN_NOTIF_MAIL_USERNAME=diun_notifications@example.com
      - DIUN_NOTIF_MAIL_PASSWORDFILE=/run/secrets/diun-mail
      - DIUN_NOTIF_MAIL_FROM=diun_notifications@example.com
      - DIUN_NOTIF_MAIL_TO=stefan_buller@example.com
    restart: unless-stopped
    secrets:
      - diun-mail
    labels:
      - diun.enable=true

Logs

diun: error: rpc error: code = Unknown desc = 535 5.7.8 Authentication failed

Additional info

No response