Open Bart1909 opened 4 months ago
Hi, did you ever figure out the issue? I'm facing the same now. I just noticed that the postfix process inside the addy container is sending out emails that have nothing to do with the domain I configured in addy. I had expected that addy would drop any email that was sent to email addresses that was not one of the configured aliases.
Figured out the issue. The postfix in the container is receiving the emails and sending them to addy. This is done via a virtual transport and anything that doesn't match, gets automatically sent to your relayhost.
The fix was more or less simple. You can create a shell script and have it mapped to /etc/cont-init.d which will get automatically picked up on container start. You will need to the recipient_access and transport files for your own situation.
#!/bin/sh
# 1. Comment out the relayhost line
sed -i 's/^relayhost =/#relayhost =/' /etc/postfix/main.cf
# 2. Add transport_maps
sed -i '/^virtual_transport/a transport_maps = texthash:/etc/postfix/transport' /etc/postfix/main.cf
# 3. Modify smtpd_recipient_restrictions
# First, save the existing configuration to a temporary file
sed -n '/^smtpd_recipient_restrictions/,/^[^ ]/p' /etc/postfix/main.cf > /tmp/smtpd_recipient_restrictions.tmp
# Now, modify the temporary file
sed -i '1c\
smtpd_recipient_restrictions =\
check_recipient_access texthash:/etc/postfix/recipient_access,\
reject_unauth_destination,\
permit_mynetworks,' /tmp/smtpd_recipient_restrictions.tmp
# Remove the last line (which is likely the start of the next configuration block)
sed -i '$d' /tmp/smtpd_recipient_restrictions.tmp
# Replace the original configuration in main.cf with our modified version
sed -i '/^smtpd_recipient_restrictions/,/^[^ ]/d' /etc/postfix/main.cf
cat /tmp/smtpd_recipient_restrictions.tmp >> /etc/postfix/main.cf
# Clean up
rm /tmp/smtpd_recipient_restrictions.tmp
# 4 & 5. Copy transport and recipient_access files
# This is where you will need to make your own changes for how you're loading these files into the container
cp /root/config/transport /etc/postfix/transport
cp /root/config/recipient_access /etc/postfix/recipient_access
# Ensure correct permissions
chown root:root /etc/postfix/transport /etc/postfix/recipient_access
chmod 644 /etc/postfix/transport /etc/postfix/recipient_access
Support guidelines
I've found a bug and checked that ...
Description
I'm using Addy as a docker container with AWS SES as SMTP Relay. As I'm not owning a static IP, I've set up a VPS which is connected via VPN and port 25 is being forwarded to my docker container.
It's working fine, but sometime I see outgoing unknown mails being send.
Sometimes it's a few per day but at some times it's being about hundreds in an hour.
Expected behaviour
No unknown mails are being sent
Actual behaviour
Sometimes unknown mails are being sent.
Steps to reproduce
Don't know
Docker info
Docker Compose config
Logs