Postfix in Incus¶
Mailserver in Containern.
Container erstellen¶
incus launch ubuntu:22.04 mailserver
Container konfigurieren¶
incus exec mailserver -- bash
System aktualisieren¶
apt update && apt upgrade -y
Postfix installieren¶
apt install postfix mailutils dovecot-core dovecot-imapd dovecot-pop3d
Netzwerk-Konfiguration¶
Port-Forwarding auf Host¶
# SMTP (25)
incus config device add mailserver smtp25 proxy listen=tcp:0.0.0.0:25 connect=tcp:127.0.0.1:25
# SMTPS (465)
incus config device add mailserver smtps465 proxy listen=tcp:0.0.0.0:465 connect=tcp:127.0.0.1:465
# Submission (587)
incus config device add mailserver smtp587 proxy listen=tcp:0.0.0.0:587 connect=tcp:127.0.0.1:587
# IMAP (143)
incus config device add mailserver imap143 proxy listen=tcp:0.0.0.0:143 connect=tcp:127.0.0.1:143
# IMAPS (993)
incus config device add mailserver imaps993 proxy listen=tcp:0.0.0.0:993 connect=tcp:127.0.0.1:993
# POP3 (110)
incus config device add mailserver pop3110 proxy listen=tcp:0.0.0.0:110 connect=tcp:127.0.0.1:110
# POP3S (995)
incus config device add mailserver pop3s995 proxy listen=tcp:0.0.0.0:995 connect=tcp:127.0.0.1:995
Postfix-Konfiguration¶
# Postfix an Container-IP anpassen
incus config show mailserver | grep "eth0"
nano /etc/postfix/main.cf
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/8
inet_interfaces = all
Dovecot-Konfiguration¶
nano /etc/dovecot/dovecot.conf
listen = *
protocols = imap pop3
SSL-Zertifikate¶
# Zertifikate von Host kopieren
incus file push /etc/letsencrypt/live/example.com/fullchain.pem mailserver/etc/ssl/certs/
incus file push /etc/letsencrypt/live/example.com/privkey.pem mailserver/etc/ssl/private/
Container neustarten¶
incus restart mailserver
Test¶
# Von Host aus testen
telnet localhost 25
telnet localhost 587
Zurück zur Container-Übersicht