Postfix : configure postmaster, hostmaster, and abuse catchall for RFC compliance
Par Mathieu le samedi 29 août 2015, 18:02 - Hacks - Lien permanent
This short howto will show you how to set up a catchall for common required email addresses. Some mail servers are testing if mail is accepted on this addresses to detect spammymail servers. Hostmaster address can also be used for domain Trading, to check the ownership of the domain.
1. Create a file named /etc/postfix/regexp-catchall.cf with the following content:
# Catchall to comply with RFC standards /^postmaster@/ youshouldreadit@mydomain.com /^hostmaster@/ youshouldreadit@mydomain.com /^abuse@/ youshouldreadit@mydomain.com
Replace youshouldreadit@mydomain.com with a mail address you actually read.
2. Open /etc/postfix/main.cf and locate (or create) the line virtual_alias_maps, and add at the end regexp:/etc/postfix/regexp-catchall.cf, for instance:
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, regexp:/etc/postfix/regexp-catchall.cf
3. Restart Postfix.
Warning : read comment #4 for issues with this setup.
Commentaires
Very usefull, but…
Making this modification cause tha’t you cannot add anymore a user mailbox by virtualmin
The “Primary email address enabled?” reset alway to “NO” event you select “YES” and save.
In fact, the user are not added anymore to /etc/postfix/virtual.
Any idea who’s cause this?
I found the problem.
This is caused by the comma “,” between the previous virtual_alias_maps content and the added “, regexp:/etc/postfix/regexp-catchall.cf”.
So, the is :
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf regexp:/etc/postfix/regexp-catchall.cf
and NOT : virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, regexp:/etc/postfix/regexp-catchall.cf
It works with the comma from my point of view, but actually I do not use virtualmin .Thank you for sharing your solution.
Using this catch-all from some time now, I have found a very annoying issue :-/
Recently, I received a message SENT by a customer to a postmaster address (with an external address of my server).
I have investigate and have found that the “catchall” not only redirect “INCOMING” postmaster (as abuse and hostmaster) email address, but also redirect “OUTGOING” postmaster (as abuse and hostmaster) email address !
This is very annoying, because if a customer sent an email to a “external” postmaster email address, the mail is catched and redirected to the main postmaster address !
Or, he shouldn’t for the outgoing message, only for the incoming message !
Do you have an idea to solve this problem ?
Hello again,
I can confirm the issue.
I did some researches and found this topic : http://www.textndata.com/forums/why-do-virtual_alias_maps-apply-outgoing-601829.html that quite buries the hope of a “simple” solution with the existing setup.
In my case, using ISPConfig, I had to simply replace the regexp-based configuration with a MySQL-based query, that will apply for all my domains, and only these domains.
I created the file /etc/postfix/mysql-virtual_catchall.cf :
And changed
by :
In my Postfix configuration (beware of simple quotes, they are translitterated by my blog).
Here is the source of my solution.
Do you have a MySQL table for retrieving all your mail domains with Virtualmin, that can lead us to the same type of solution for you ?
Hi,
Thanks for your reply.
I don't user MySql for Postfix (also I'm not on ISPConfig but on Webmin, but this is unimportant).
I think I will do a kind of solution like this : http://www.textndata.com/forums/glo...
This is another approch, not so good, but I think there is no other way (without MySql)...
Also, I think I will add a cron task to run the script if they are new domain, to update the catchall file and then do a postmap + postfix reload to apply...
Yes, creating virtual_alias_map from virtual domains on a regular basis (crontab) can be the simple workaround you need if you have no other source than the postifx files for your virtual domains. I thought webmin may be storing the virtual domains in specific files/database-like system, but I am obviously wrong.
I don't know if virtual_mailbox_domain is set in your configuration, but it may be simpler to use the file referenced by this directive than using /etc/virtual to make your virtual_alias_map ?