1

Topic: Domain alias does not work

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7
- Linux/BSD distribution name and version:  Ubuntu 16.04 (all patches installed)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hello Zhang,

now in a new post.

Steps to reproduce the issue:

1. Create new domain with a mailbox. e.g. abcde.de
2. Now configure the domain to have an alias "abcde.com"
3. Now send an email to mailbox@abcde.com

I get following error message on my iRedMail installation:

Nov 14 08:10:40 mail postfix/smtpd[16963]: NOQUEUE: reject: RCPT from mail-wm0-f45.google.com[74.125.82.45]: 550 5.1.1 <info@abcde.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<xxx@gmail.com> to=<info@abcde.com> proto=ESMTP helo=<mail-wm0-f45.google.com>
abcde.com is an alias for domain abcde.de

Why is this happening? Postfix seem to igore the alias domain.
I can apply the workaround to create domain, mailbox and forward but I rather would prefer the alias domain to be working.

Thank you!

Best regards,
Bernhard

----

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

2

Re: Domain alias does not work

Removing the alias domain, hitting "Save" and adding it again makes no difference at all.

3

Re: Domain alias does not work

*) Is it a fresh new iRedMail-0.9.7 installation? or you upgraded it from an old iRedMail release?
*) Show us content of file /etc/postfix/ldap/catchall_maps.cf.
*) Show us output of commands below:

cd /etc/postfix/ldap/
for i in $(ls *cf); do echo $i; postmap -q 'mailbox@abcde.com' ldap:./$i; done

mailbox@abcde.com is the alias domain.

4 (edited by broth 2017-11-19 03:25:46)

Re: Domain alias does not work

- It was a fresh 0.9.6 installation and then manually upgraded to 0.9.7
- This is a MySQL installation, not LDAP. I will show you the contents of /etc/postfix/mysql/catchall_maps.cf

hosts       = 127.0.0.1
port        = 3306
user        = vmail
password    = xxxx
dbname      = vmail
query       = SELECT forwardings.forwarding FROM forwardings,domain WHERE forwardings.address='%d' AND '%u' NOT LIKE '%%+%%' AND forwardings.address=domain.domain AND forwardings.active=1 AND domain.active=1 AND domain.backupmx=0

Using the existing mailbox the result of your command is below.
It does find it and show the correct mailbox path.

root@debmail3:/etc/postfix/mysql# for i in $(ls *cf); do echo $i; postmap -q 'mailbox@abcde.de' mysql:./$i; done
catchall_maps.cf
domain_alias_catchall_maps.cf
domain_alias_maps.cf
recipient_bcc_maps_domain.cf
recipient_bcc_maps_user.cf
relay_domains.cf
sender_bcc_maps_domain.cf
sender_bcc_maps_user.cf
sender_dependent_relayhost_maps.cf
sender_login_maps.cf
mailbox@abcde.de
transport_maps_domain.cf
transport_maps_user.cf
virtual_alias_maps.cf
virtual_mailbox_domains.cf
virtual_mailbox_maps.cf
vmail1/abcde.de/m/a/i/mailbox-2012.04.27.18.35.31//Maildir/

Now with the alias domain, no result:

root@debmail3:/etc/postfix/mysql# for i in $(ls *cf); do echo $i; postmap -q 'mailbox@abcde.com' mysql:./$i; done
catchall_maps.cf
domain_alias_catchall_maps.cf
domain_alias_maps.cf
recipient_bcc_maps_domain.cf
recipient_bcc_maps_user.cf
relay_domains.cf
sender_bcc_maps_domain.cf
sender_bcc_maps_user.cf
sender_dependent_relayhost_maps.cf
sender_login_maps.cf
transport_maps_domain.cf
transport_maps_user.cf
virtual_alias_maps.cf
virtual_mailbox_domains.cf
virtual_mailbox_maps.cf
root@debmail3:/etc/postfix/mysql#

I can't tell since when it does not work anymore.
I just had some customers telling they were unable to send me email smile

I hope we can find the problem.

Thank you!

5

Re: Domain alias does not work

Seems domain_alias_maps.cf  has something wrong.
Please try this:

postmap -v -q 'mailbox@<alias-domain>' mysql:/etc/postfix/mysql/domain_alias_maps.cf

Compare the SQL query with the real data, any difference?

6

Re: Domain alias does not work

broth wrote:

1. Create new domain with a mailbox. e.g. abcde.de
2. Now configure the domain to have an alias "abcde.com"
3. Now send an email to mailbox@abcde.com

Question: did you create mail user "mailbox@abcde.de"?

7 (edited by broth 2017-11-21 19:22:42)

Re: Domain alias does not work

postmap returns no result with the alias address.

...
postmap: dict_open: mysql:/etc/postfix/mysql/domain_alias_maps.cf
postmap: dict_mysql_get_active: attempting to connect to host 127.0.0.1
postmap: dict_mysql: successful connection to host 127.0.0.1
postmap: dict_mysql: successful query from host 127.0.0.1
postmap: dict_mysql_lookup: retrieved 0 rows

I used your perl command lines to convert the domain_alias_maps.cf (v. 0.9.6) to domain_alias_maps.cf (v. 0.9.7)

The file contains following query:

SELECT forwardings.forwarding FROM forwardings,alias_domain,domain WHERE alias_domain.alias_domain='%d' AND forwardings.address=CONCAT('%u', '@', alias_domain.target_domain) AND alias_domain.target_domain=domain.domain AND forwardings.active=1 AND alias_domain.active=1 AND domain.backupmx=0

Strange enough, where can I find the alias domain?

8

Re: Domain alias does not work

Compare all files under /etc/postfix/mysql/ with the default iRedMail config:
https://bitbucket.org/zhb/iredmail/src/ … fix/mysql/

9

Re: Domain alias does not work

There is a difference in virtual_alias_maps.cf:

forwardings.domain=domain.domain

My version (upgraded from 0.9.6 to 0.9.7)

SELECT forwardings.forwarding FROM forwardings,domain WHERE forwardings.address='%s' AND forwardings.domain='%d' AND forwardings.domain=domain.domain AND forwardings.active=1 AND domain.backupmx=0 AND domain.active=1

Bitbucket version:

SELECT forwardings.forwarding FROM forwardings,domain WHERE forwardings.address='%s' AND forwardings.domain=domain.domain AND forwardings.active=1 AND domain.backupmx=0 AND domain.active=1

I will ignore the files which have been changed 4 days ago. These are sender_bcc_maps_user.cf and recipient_bcc_maps_user.cf

domain_alias_maps.cf matches.

10

Re: Domain alias does not work

@Zhang: I wonder if I did something wrong during upgrade. In particular in the section "Update Postfix config files" at
https://docs.iredmail.org/upgrade.iredm … 0.9.7.html

11

Re: Domain alias does not work

I cannot reproduce this issue. Could you please try to setup a new VM with iRedMail-0.9.7 and test this issue again?

12

Re: Domain alias does not work

Thanks for your message!
I suspect that something must have gone wrong during upgrade.
Just yesterday another customer told me about one of his email aliases not working anymore.
All mails were in the catchall mailbox and it was obviously full.

In which table should I find the domain alias?
Is there a way to debug postfix to know what exactly it's doing?

Well, is absolutely necessary I can make a new VM with 0.9.7 but then how shall I test? I can't use my production environment for testing. Only live debugging is possible (and even this is not great).

13

Re: Domain alias does not work

broth wrote:

In which table should I find the domain alias?
Is there a way to debug postfix to know what exactly it's doing?

Hard to tell without troubleshooting. First step is comparing Postfix SQL queries with default ones shipped in iRedMail.

broth wrote:

Well, is absolutely necessary I can make a new VM with 0.9.7 but then how shall I test? I can't use my production environment for testing. Only live debugging is possible (and even this is not great).

For testing, no need to be in production, just create few (fake) domains, the create alias domains, send email to the testing account.