Proxmox Postfix Relay einrichten

sakis2018

Active Member
Dec 25, 2018
53
0
26
49
Hallo,

ich habe auf meinem Proxmox ein Container erstellt und darauf habe ich MIAB installiert. Soweit funktioniert auch alles.

Nun möchte ich das die Email-Alerts von Proxmox über die MIAB laufen, also quasi ein Postfix SMTP Relay. Wie kann ich das machen?

Die main.cf vom Proxmox sieht so aus

Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = pve.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
mynetworks = 127.0.0.0/8 185.254.97.0/24 [::1]/128 [fe80::]/64
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all

smtp_tls_security_level = verify
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_password
smtp_sasl_tls_security_options =

die relay_password sieht so aus:
[box.domain.net]:587 root@domain.com:password
 
Proxmox scheint Postfix zu nutzen, dort in die von Dir beschriebene main.cf folgende Zeit zufügen (vorher prüfen, ob diese eventuell schon existiert, nicht das es zu Komplikationen kommt):

Code:
relayhost = [192.168.1.10]

Die IP Adresse mit der vom MIAB Container natürlich ersetzen! Abspeichern und Postfix neu laden "postfix reload".
Mit den eckigen Klammern wird verhindert, daß Postfix mittels DNS den MX für die Domain auflöst.

Viel Erolg,
Frank
 
Berechtigte Frage, einfache Antwort: Einen Login Mechanismus mit Benutzer und Passwort brauchst Du nicht.
Im Regelfall befinden sich die Mailsysteme in einem eigenen privaten Subnetz, wo kein Emailclient oder externer MTA Zugriff hat.
Bei einer ausgehenden Email (LAN ins Internet) nimmt das Relay jede Email an und leitete sie weiter.

MIAB muss nun diesem Netzwerk vertrauen. So wie ich gelesen habe, nutzt MIAB auch Postfix als MTA.
Also editierst Du dort auch die "main.cf" wie folgt:

Bei "mynetworks = 127.0.0.0/8" sollte dahinter bereits das interne Subnet stehen, z.B. "mynetworks = 127.0.0.0/8, 192.168.1.0/24"
MIAB und die PVE sollten eine IP innerhalb dieses Subnets (192.168.1.0/24) haben - wovon ich mal ausgehe, die Subnetzadresse muss natürlich auf Dein Netzwerk passen.

Weiter unter sollte es ein Konstrukt geben das mit folgendem Text beginnt:

smtpd_recipient_restrictions =
permit_mynetworks,
....

Wichtig ist hierbei, dass gleich als Erstes nach dem "=" der Text "permit_mynetworks" steht.

MIAP / Postfix nimmt dann jede Email an, die aus dem unter "mynetworks=" stehenden Subnetzen eingeliefert wird, ohne nach einem Login zu fragen.

Config speichern, Postfix neu laden, nun sollte es gehen.

Mehr ist es nicht, viel Erfolg.
Frank
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!