I would like to build a docker that accepts all emails from the local network without a password and only sends them a predefined email.
Unfortunately, the Contianer is crashing, but I have no idea why. The logs I know show no error. maybe i'm looking in the wrong place.
What I have so far
Dockerfile
# W hle ein Basis-Image mit Postfix
FROM debian:buster
Installiere Postfix und andere ben tigte Pakete
RUN apt-get update &&
apt-get install -y postfix mailutils
Konfigurationsdateien kopieren
COPY main.cf /etc/postfix/main.cf
COPY run.sh /usr/local/bin/run.sh
COPY sasl_passwd /etc/postfix/sasl_passwd
Startskript ausf hrbar machen
RUN chmod +x /usr/local/bin/run.sh
Port f r SMTP
EXPOSE 25
Startskript als Entrypoint
ENTRYPOINT ["/usr/local/bin/run.sh"]
main.cf
# /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
Email-Rejektionsregeln
smtpd_relay_restrictions = permit_mynetworks reject_unauth_destination
myhostname = localhost
mydestination = localhost
Netzwerkbereich, der Mails senden darf
mynetworks = 192.168.0.0/24
Weiterleitungsadresse
relayhost = [smtp.your-email-provider.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_use_tls = yes
sasl_password
smtp.server:587 user:password
run.sh
#!/bin/bash
# sasl_passwd in das richtige Format umwandeln und die Berechtigungen setzen
postmap /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
Postfix starten
service postfix start
recipient_canonical
/.*/ user@mail.de