Cannot Setup email notifications

Hi there,

I have icinga2 with icingaweb2 basic setup. i would like to setup email notifications for a specific service.
I realized that the mailutils was not installed so i have installed it. There is an internal exchange 2007 in the lan so i set the posfix to use relay. When I test to send email from commandline it always fails.

–5D2A64A9.1573485635/srvcheckmk.mydomain.local
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; sserverk.mydomain.local
X-Postfix-Queue-ID: 5D2A64A9
X-Postfix-Sender: rfc822; root@sserverk
Arrival-Date: Mon, 11 Nov 2019 16:20:30 +0100 (CET)

Final-Recipient: rfc822; user2@domain.com
Original-Recipient: rfc822;user2@domain.com
Action: failed
Status: 5.7.1
Remote-MTA: dns; domain.axpe.com
Diagnostic-Code: smtp; 550 5.7.1 Sender ID (PRA) Domain Does Not Exist

Final-Recipient: rfc822; juserb@domain.com
Original-Recipient: rfc822;juserb@domain.com
Action: failed
Status: 5.7.1
Remote-MTA: dns; mail.domain.com
Diagnostic-Code: smtp; 550 5.7.1 Sender ID (PRA) Domain Does Not Exist

--5D2A64A9.1573485635/sserverk.mydomain.local
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <root@sserverk>
Received: by srvcheckmk.axpenet.local (Postfix, from userid 0)
        id 5D2A64A9; Mon, 11 Nov 2019 16:20:30 +0100 (CET)
Subject: Subject
To: <juserb@domain.com>,<fuserd@domain.com>
X-Mailer: mail (GNU Mailutils 2.99.99)
Message-Id: <20191111152030.5D2A64A9@srvcheckmk.mydomain.local>
Date: Mon, 11 Nov 2019 16:20:30 +0100 (CET)
From: root@srserverk (root)

Test body

--5D2A64A9.1573485635/srawecwek.mydomain.local--

?

This is my /etc/posfix/main.cf

root@serverubu:/etc/postfix# cat main.cf

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 (Ubuntu)
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

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 = serverk.mydomain.local
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, axpenet.local, srvcheckmk, localhost.localdomain, localhost
relayhost = [mail.axpe.com]
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.26.2.0/16 172.26.0.0/16
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
transport_maps = hash:/etc/postfix/transport
default_transport = smtp

enable SASL authentication

smtp_sasl_auth_enable = yes

disallow methods that allow anonymous authentication.

smtp_sasl_security_options =

where to find sasl_passwd

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

Enable STARTTLS encryption

smtp_use_tls = yes

where to find CA certificates

smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

Does posfix first need to be able to send emails before icinga can use it right?

thank you

  1. Yes, postfix needs to be capable of sending email before Icinga can send
    email through postfix.

  2. You need to ensure that both postfix and any onward email servers the
    message has to pass through accept the sender address which Icinga will be
    using.

  3. Obviously you need to send to a recipient address which is deliverable
    through your chain of mail servers (so, it may not need to be an Internet-
    resolvable address, just so long as it ends up on a mail server which can
    deliver it, possibly entirely within your own network).

If you are going to give further examples of log file extracts, please make it
clear which (server or email) addresses you have mangled to hide any real
addresses you don’t want to make public. In your existing log file output I
see:

sserverk.mydomain.local
root@sserverk
user2@domain.com
domain.axpe.com
juserb@domain.com
mail.domain.com
srvcheckmk.axpenet.local
fuserd@domain.com

This makes it quite difficult to work out which are “real” addresses and which
you have anonymised for privacy.

Regards,

Antony.

ok so i am still struggling with this… this is my main.cf

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 (Ubuntu)
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

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 = srvcheckmk.axpenet.local
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, axpenet.local, srvcheckmk, localhost.localdomain, localhost
relayhost = [mail.axpe.com]
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.26.2.0/16 172.26.0.0/16
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
transport_maps = hash:/etc/postfix/
default_transport = smtp

enable SASL authentication

smtp_sasl_auth_enable = yes

disallow methods that allow anonymous authentication.

smtp_sasl_security_options = noanonymous

where to find sasl_passwd

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

Enable STARTTLS encryption

smtp_use_tls = yes

and this is the log entry…

Nov 12 11:03:50 srvcheckmk postfix/qmgr[2142]: 0653346C: from=root@srvcheckmk, size=356, nrcpt=1 (queue active)
Nov 12 11:03:50 srvcheckmk postfix/trivial-rewrite[2170]: error: open database /etc/postfix/.db: No such file or directory
Nov 12 11:03:50 srvcheckmk postfix/trivial-rewrite[2170]: warning: hash:/etc/postfix/ is unavailable. open database /etc/postfix/.db: No such file or directory
Nov 12 11:03:50 srvcheckmk postfix/trivial-rewrite[2170]: warning: hash:/etc/postfix/ lookup error for “"
Nov 12 11:03:50 srvcheckmk postfix/trivial-rewrite[2170]: warning: hash:/etc/postfix/ is unavailable. open database /etc/postfix/.db: No such file or directory
Nov 12 11:03:50 srvcheckmk postfix/trivial-rewrite[2170]: warning: hash:/etc/postfix/ lookup error for "

Nov 12 11:03:50 srvcheckmk postfix/trivial-rewrite[2170]: warning: hash:/etc/postfix/ is unavailable. open database /etc/postfix/.db: No such file or directory
Nov 12 11:03:50 srvcheckmk postfix/trivial-rewrite[2170]: warning: hash:/etc/postfix/ lookup error for “fgarciad@axpe.com
Nov 12 11:03:50 srvcheckmk postfix/trivial-rewrite[2170]: warning: transport_maps lookup failure
Nov 12 11:03:50 srvcheckmk postfix/qmgr[2142]: 52C16483: from=root@srvcheckmk, size=356, nrcpt=1 (queue active)
Nov 12 11:03:50 srvcheckmk postfix/error[2171]: 0653346C: to=fgarciad@axpe.com, relay=none, delay=930, delays=930/0.02/0/0.01, dsn=4.3.0, status=deferred (address resolver failure)
Nov 12 11:03:50 srvcheckmk postfix/error[2172]: 52C16483: to=fgarciad@axpe.com, relay=none, delay=596, delays=596/0.02/0/0.01, dsn=4.3.0, status=deferred (address resolver failure)

I think this question currently belongs on a postfix list.

Once you have your email service operating, you can get Icinga to use it.

Antony.