Hello,
after
relay_domains = hash:/etc/postfix/transport
i put
relay_recipient_maps = hash:/etc/postfix/relay_recipient
into main.cf
this way all mails to unused addresses are immediately rejected with
Recipient address rejected: User unknown in relay
recipient table (in reply to RCPT TO command)
As EFA already knows all my users and aliasses (filters) this should be an option in efa instead of manualy create the relay_recipient file
thank,
jens
accepting only known email addresses as inbound - relay_recipient map
Re: accepting only known email addresses as inbound - relay_recipient map
Hello
Better using a mysql query as mysql is enabled in postfix:
postconf -m
...
mysql
...
This way it could be used with AD sync as well
The trick here ist a UNION statement in as we have 2 diffrent tables for users and alias emails
for a nice explanation look at https://workaround.org/ispmail/jessie/postfix-mysql
in main.cf add
relay_recipient_maps = mysql:/etc/postfix/mysql_relay_recipients.cf
The file mysql_relay_recipients.cf
Test if it works:
gives result 1
no result
to list all email addresses from users and filter you can use the following querry
kind regards,
jens
Better using a mysql query as mysql is enabled in postfix:
postconf -m
...
mysql
...
This way it could be used with AD sync as well
The trick here ist a UNION statement in as we have 2 diffrent tables for users and alias emails
for a nice explanation look at https://workaround.org/ispmail/jessie/postfix-mysql
in main.cf add
relay_recipient_maps = mysql:/etc/postfix/mysql_relay_recipients.cf
The file mysql_relay_recipients.cf
Code: Select all
# The user name and password to log into the mysql server.
## maybe the values can somehow extracted from /etc/EFA-Config
hosts = localhost
user = mailwatch
password = password
dbname = mailscanner
query = select 1 FROM users WHERE username = '%s' UNION SELECT 1 from user_filters WHERE filter = '%s';
Test if it works:
Code: Select all
postmap -q existing@example.com mysql:/etc/postfix/mysql_relay_recipients.cf
Code: Select all
postmap -q not-existing@example.com mysql:/etc/postfix/mysql_relay_recipients.cf
to list all email addresses from users and filter you can use the following querry
Code: Select all
SELECT username FROM users WHERE username like '%@%' UNION SELECT filter from user_filters WHERE filter like '%@%' ;
kind regards,
jens