Einrichten Emailversand mit Postfix
Damit auch Emailbenachrichtungen raus gehen, richten wir uns einen Postfix SMTP Server ein.
Abhängigkeiten installieren
apt-get install -y postfix bsd-mailx
NunInternet Site auswählen
Email Name ausfüllen: checkmk.local.lan
Nun den Emailempfänger für root eingeben.
weitere zeile, einfach so lassen
bei Synchrone Aktualiseirungen... Nein auswählen
Postfachgröße 0 einfach weiter klicken
Zeichen für Adresserweiterung
Alle auswählen
nun die Postfix datei /etc/postfix/main.cf öffnen
nano /etc/postfix/main.cf
Inhalt unter smtp_tls session diese 3 Zeilen einfügen
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
Nun noch den relyhost anpassen. Bei mir ist es rs001871.fastrootserver.de
Nun die Password File anlegen
nano /etc/postfix/sasl_passwd
Inhalt, SMTP Host, Benutzername, Kennwort
[rs001871.fastrootserver.de]:587 monitoring@star-module.com *****
Nun die Password File eine Postmap draus machen
postmap /etc/postfix/sasl_passwd
Nun den Postfix-Server neustarten
service postfix restart
Testemail senden
echo "Dies ist eine Test E-Mail vom checkmk-Server" | mailx -s "Test" <ihre_notification_e-mail-adresse@gmail.com>
in der /var/log/mail.log kann man das ergebnis sehen.
hier ein Fehler beispiel, bei der Authentifizierung. Ganz am ende steht authetication failed. So weiß man, okay Kennwort falsch.
Nov 29 11:38:45 checkmk postfix/postfix-script[26039]: starting the Postfix mail system
Nov 29 11:38:45 checkmk postfix/master[26041]: daemon started -- version 3.5.13, configuration /etc/postfix
Nov 29 11:40:53 checkmk postfix/postfix-script[26644]: stopping the Postfix mail system
Nov 29 11:40:53 checkmk postfix/master[26041]: terminating on signal 15
Nov 29 11:40:54 checkmk postfix/postfix-script[27198]: starting the Postfix mail system
Nov 29 11:40:54 checkmk postfix/master[27200]: daemon started -- version 3.5.13, configuration /etc/postfix
Nov 29 11:41:10 checkmk postfix/pickup[27201]: A9F0D2075B: uid=0 from=<root>
Nov 29 11:41:10 checkmk postfix/cleanup[27249]: A9F0D2075B: message-id=<20221129104110.A9F0D2075B@checkmk.local.lan>
Nov 29 11:41:10 checkmk postfix/qmgr[27202]: A9F0D2075B: from=<root@checkmk.local.lan>, size=440, nrcpt=1 (queue active)
Nov 29 11:41:10 checkmk postfix/smtp[27251]: A9F0D2075B: to=<bonkersdeluxe@gmail.com>, relay=rs001871.fastrootserver.de[213.202.247.147]:25, delay=0.24, delays=0.02/0.02/0.21/0, dsn=4.7.8, status=deferred (SASL authentication failed; server rs001871.fastrootserver.de[213.202.247.147] said: 535 5.7.8 Error: authentication failed: authentication failure)
So sähe ein erfolgreicher Versand aus
Jan 20 10:22:03 checkmk postfix/pickup[603605]: 317CB20BB6: uid=0 from=<root>
Jan 20 10:22:03 checkmk postfix/cleanup[606550]: 317CB20BB6: message-id=<20230120092203.317CB20BB6@checkmk.local.lan>
Jan 20 10:22:03 checkmk postfix/qmgr[1102]: 317CB20BB6: from=<root@checkmk.local.lan>, size=443, nrcpt=1 (queue active)
Jan 20 10:22:03 checkmk postfix/smtp[606552]: 317CB20BB6: to=<monitoring@star-module.com>, relay=rs001871.fastrootserver.de[213.202.247.147]:25, delay=0.36, delays=0.02/0.01/0.19/0.14, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 65D0A18806E2)
Jan 20 10:22:03 checkmk postfix/qmgr[1102]: 317CB20BB6: removed









