1 (edited by Peter 2015-07-01 18:59:02)

Topic: Addition/Always accept messages for special aliases

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
====

We want a general setting for postmaster@ / abuse@ for ALL domains.

I found this wiki page link below. Is this still the way to go or do you recommend another configuration?

http://www.iredmail.org/wiki/index.php? … al_aliases

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Addition/Always accept messages for special aliases

I suggest using mail alias accounts to avoid updating config file on file system.

3

Re: Addition/Always accept messages for special aliases

Is it possible to define this once and it applies for all domains? Something like:



postmaster@* -> admin@reportOnlyToThisDomain.com

4

Re: Addition/Always accept messages for special aliases

Peter wrote:

Is it possible to define this once and it applies for all domains? Something like:
postmaster@* -> admin@reportOnlyToThisDomain.com

You can add a hash file in Postfix 'virtual_alias_maps', map 'postmaster@*' to 'admin@reportOnlyToThisDomain.com'.

5

Re: Addition/Always accept messages for special aliases

That sounds good. I did the following:

vi /etc/postfix/main.cf
virtual_alias_maps =
        hash:/etc/postfix/maps/virtual_alias_maps, <------- new
        proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf,
        proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf,
        proxy:mysql:/etc/postfix/mysql/catchall_maps.cf,
        proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf

vi /etc/postfix/maps/virtual_alias_maps
postmaster@*    admin@reportOnlyToThisDomain.com

postmap /etc/postfix/maps/virtual_alias_maps

postfix reload

Test didn't succeed:

from my iredmail account (submission)

550 5.1.1 <postmaster@example.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<user@example.com> to=<postmaster@example.com> proto=ESMTP helo=<[xx.xx.xx.xx]>

from remote

NOQUEUE: reject: RCPT from mail-lb0-f171.google.com[209.85.217.171]: 550 5.1.1 <postmaster@example.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<someuser@gmail.com> to=<postmaster@example.com> proto=ESMTP helo=<mail-0-f171.google.com>

6

Re: Addition/Always accept messages for special aliases

According to Postfix manual page virtual(5), 'user@*' is not supported. This way you have to use SQL/LDAP lookup map instead (query 'user' part only). This new lookup file should be added before the catchall lookup in 'virtual_alias_maps'.

7

Re: Addition/Always accept messages for special aliases

I did more research and found a working solution:

vi /etc/postfix/main.cf
virtual_alias_maps =
        proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf,
        regex:/etc/postfix/maps/virtual_alias_maps.regex, <------- new
        proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf,
        proxy:mysql:/etc/postfix/mysql/catchall_maps.cf,
        proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf

vi /etc/postfix/maps/virtual_alias_maps.regex
/^(postmaster|abuse)@/  admin@reportOnlyToThisDomain.com

postfix reload

Thanks for your help you can close this topic.

8

Re: Addition/Always accept messages for special aliases

Thanks for sharing. smile

9

Re: Addition/Always accept messages for special aliases

Peter wrote:

This rule applies to receiving and sending emails which is wrong. It should only apply to receiving!

I had to list all Domains in the regex which is not acceptable with hundreds of domains:

/^(postmaster|abuse)@/(domain1.com|domain2.org|domain-other.com)  admin@reportOnlyToThisDomain.com

Is there a way to restrict the regex map for receiving emails?

Maybe you can try SQL/LDAP query instead of regex?

10 (edited by Peter 2015-08-04 23:08:44)

Re: Addition/Always accept messages for special aliases

Thanks for your Input. This seems to work as expected:


Map file
=================================
vi /etc/postfix/mysql/virtual_postmaster_maps.cf

user        = vmail
password    = [password]
hosts       = 127.0.0.1
port        = 3306
dbname      = vmail
query       = SELECT 'admin@reportOnlyToThisDomain.com' FROM domain WHERE domain = '%d' AND active=1 AND '%u' in ('abuse','postmaster')

Check it
==========================
# postmap -q abuse@yourdomain.com  mysql:/etc/postfix/mysql/virtual_postmaster_maps.cf
admin@reportOnlyToThisDomain.com

Postfix configuration
==========================
vi /etc/postfix/main.cf
virtual_alias_maps =
        proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf,
        proxy:mysql:/etc/postfix/mysql/virtual_postmaster_maps.cf, <------- new
        proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf,
        proxy:mysql:/etc/postfix/mysql/catchall_maps.cf,
        proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf

postfix reload

11

Re: Addition/Always accept messages for special aliases

Glad to hear that you got it working. Thanks for sharing. smile