I have two ubuntu servers 22.04 in the same network 172.16.0.0/24. One is setup as a webserver and the other as a mailserver using mailcow.
For starters my objective is to send an email notification when ever the server has been updated with an security update.
I installed postfix and mailx and configured it to the best of my knowledge.
I am unable to receive the test email using command line
echo "this is a test email." | mailx -r someone@mydomain.com -s hello karl@mydomain.com
when sending it from my webserver. When using telnet I’m able to send from my webserver and receive from my mailserver.
Below is from the log file from the webserver and the postfix main.cf file configuration I currently have setup.
Your help will much appreciated.
mail.log
Oct 6 08:45:25 cit-serv1 postfix/pickup[126772]: 86AAFFE040F: uid=0 from<karl@mydomain.com>
Oct 6 08:45:25 cit-serv1 postfix/cleanup[127005]: 86AAFFE040F: message-id=<20221006124525.86AAFFE040F@mydomain.com>
Oct 6 08:45:25 cit-serv1 postfix/qmgr[126773]: 86AAFFE040F: from=<karl@mydomain.com>, size=405, nrcpt=1 (queue active)
Oct 6 08:45:25 cit-serv1 postfix/local[127007]: 86AAFFE040F: to=<karl@mydomain.com>, relay=local, delay=0.07, delays=0.05/0/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
Oct 6 08:45:25 cit-serv1 postfix/qmgr[126773]: 86AAFFE040F: removed
postfix main.cf
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
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 3.6 on
# fresh installs.
compatibility_level = 3.6
# 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_tls_security_level=may
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, mail.mydomain.com, localhost.localdomain, localhost
relayhost = [mail.mydomain.com]:587
mynetworks = 127.0.0.0/8 172.16.0.0/24
mailbox_size_limit = 0
recipient_delimiter = +
#inet_interfaces = all
inet_interfaces = loopback-only
inet_protocols = all
# outbound relay configurations
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000