i have a problem with postfix. I now have a freshly installed Ubuntu 18.04. I install Postfix and during the installation, I say that the mails should go out via a relay. Because the proxy accepts only one domain as a sender, I need a rewrite for sender Mail so I added this line to main.cf:
sender_canonical_classes = envelope_sender, header_sender
sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps
smtp_header_checks = regexp:/etc/postfix/header_check
# cat /etc/postfix/sender_canonical_maps
/.+/ my@new.mail
# cat /etc/postfix/header_check
/From:.*/ REPLACE From: my@new.mail
Otherwise I don't even touch the configuration. Postfix also runs for the first time and I can test everything successfully.
It can run for a few minutes or even hours. But at some point Postfix just turns itself off.
See log:
# tail -f /var/log/mail.log
Jun 3 09:20:06 my-server postfix/postfix-script[11813]: refreshing the Postfix mail system
Jun 3 09:20:06 my-server postfix/master[7467]: reload -- version 3.3.0, configuration /etc/postfix
Jun 3 09:24:07 my-server postfix/pickup[11826]: 9C62E4209A: uid=33 from=<adress1@mail.com>
Jun 3 09:24:07 my-server postfix/cleanup[11858]: 9C62E4209A: message-id=<JRKi3qQ2QaLr7QtriyHqTzCrODX1JYZ5wh7S1ED9o@umfragen.testbed.gdi-de.org>
Jun 3 09:24:07 my-server postfix/qmgr[11824]: 9C62E4209A: from=<adress2@mail.com>, size=3230, nrcpt=1 (queue active)
Jun 3 09:24:07 my-server postfix/smtp[11860]: 9C62E4209A: replace: header From: Test <adress2@mail.com>: From: adress2@mail.com
Jun 3 09:24:07 my-server postfix/smtp[11860]: 9C62E4209A: to=<adress1@mail.com>, relay=my.proxy[IP.IP.IP.IP]:25, delay=0.07, delays=0.02/0.01/0.01/0.02, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as A836F285F)
Jun 3 09:24:07 my-server postfix/qmgr[11824]: 9C62E4209A: removed
Jun 3 10:31:06 my-server postfix/postfix-script[20360]: stopping the Postfix mail system
Jun 3 10:31:06 my-server postfix/master[7467]: terminating on signal 15
You see at this log, that I have testet everything and at jun 3 10:31 postfix is turned off.
So if I try now to start it, the service is "masked"
# service postfix start
Failed to start postfix.service: Unit postfix.service is masked.
# systemctl start postfix
Failed to start postfix.service: Unit postfix.service is masked.
If I try to unmask Postfix. It works, but Postfix is not addressable.
# systemctl unmask postfix.service
Removed /etc/systemd/system/postfix.service.
# systemctl start postfix
# systemctl status postfix
● postfix.service - LSB: Postfix Mail Transport Agent
Loaded: loaded (/etc/init.d/postfix; generated)
Active: active (exited) since Fri 2020-06-05 13:59:57 CEST; 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 17347 ExecStart=/etc/init.d/postfix start (code=exited, status=0/SUCCESS)
Main PID: 7472 (code=exited, status=0/SUCCESS)
Jun 05 13:59:57 my-server systemd[1]: Starting LSB: Postfix Mail Transport Agent...
Jun 05 13:59:57 my-server systemd[1]: Started LSB: Postfix Mail Transport Agent.
# telnet localhost 25
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
For this progress, there are no new entries in the mail.log and mail.err
The only way to get it run again is to remove it clear apt and install postfix again. But after a few minutes or hours, the postfix service turned off again.
At this point I have exhausted my knowledge on this.