Created Friday 01 December 2023
I'm using Postfix to send out emails from all the vm's that need to send emails out. It's pre-installed most of the time. If not just do an
To send out emails, if the hosts domain is not real, then you need to change myorigin to a valid domain and also use the bse-mailx package instead of mailutils. If you do use mail from mailutils, then use the -r option. If you don't, the from field of your outgoing messages will be invalid, which will cause the message to be rejected.
send options
this as the from address. By default on ubuntu, this is set to a file
localy.
Install as a standard CT template in Proxmox. No need for a valid external domain, can just use fake internal domain.
Configure
Relaying
Default Relay: foreman.jmsh-home.dtdns.net - ip or name of host to receive mail from external
Relay Port: 25 - port of above host
Disable MX lookup (SMTP): yes - we don't want to look up MX records, just use these settings instead
Smarthost: smtp.dodo.com.au:25 - our external relay
REF: https://electrictoolbox.com/configure-postfix-external-connections/
to get foreman.jmsh-home.dtdns.net to accept email requites;
or
inet_interfaces = locahost ip_address
in /etc/postfix/main.cf
but this did not work. I also had to change /etc/postfix/master.cf
to
smtp inet n - - - - smtpd
Relay Domains
A list of all domains tha we will receive and forward from external. Everything else will be rejected.
Ports
I ended up swapping input and output ports. By default, port 25 is the external port, and 26 is the internal. Since I'm forwarding from the firewall, I created a rule to forward external port 25 to port 26 on the GW.
External SMTP Port 26
External SMTP Port 25
Networks
A list of networks that are considered local. We will relal from everyone on this list
Mail Filter
Added Action - Has Been Scanned Notice
Just adds a message to outgoing mail. More as a test and to make sure incoming mail gets tagged.
scanned by Proxmox Mail Gateway
created filter - Add Disclaimer
Enabled disclaimer on outgoing mail Priority 60
created filter - Add Scanned Notice
Add Scanned Notice on incoming mail, Priority 60
to do
- Add Postfix settings to Ansible, make sure we exclude the Proxmox mail gateway and make different settings for our internal mail receiver