1

Topic: mail relay and alias domains

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: Red Hat Enterprise Linux Server release 7.4 (Maipo)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx): ngnix
- Manage mail accounts with iRedAdmin-Pro? yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

===

Hi,
When I set a per domain relay it works as expected. Relays all mail to another server.
For the same domain I have set alias domains. Sending mails to an 'alias domain" reads MX from DNS and forwards a message there instead of relaying to specified server.

----

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

2

Re: mail relay and alias domains

Check file /etc/postfix/mysql/relay_domains.cf, i think we need to improve the SQL query in this file to handle alias domain.

Do you have any interest to help fix it?

3

Re: mail relay and alias domains

Yes I do.
What I'd like to achieve is to have one common black and whitelist for a couple of domains which I host.

To be more specific.
I have about 15 domains.
4 of them is relaying to an exchange server of one of my clients.
Let's name them domain.com , domain.co.uk, domain2.com, domian2.co.uk.
Iredmail acts there as a spamfilter without recipent verification.
In can specify 4 different domains and everything is fine, however than client needs to modify each white and blacklist 4 times.

I wanted to set one domain to avoid this.
I've specified domain.com as domain and the rest as alias domains
I also want a domain to stays the same (no change like domain.co.uk->domain.com)

Thought that alias domain can handle it.

4

Re: mail relay and alias domains

What's the related log of white/blacklisting in iRedAPD? You can turn on debug mode in iRedAPD for debugging:
https://docs.iredmail.org/debug.iredapd.html

Also, we need to improve SQL query in /etc/postfix/mysql/relay_domains.cf to handle alias domain.

5

Re: mail relay and alias domains

Hi @misieq,

Could you please help test this SQL query in /etc/postfix/mysql/relay_domains.cf? Replace old "query =" line by lines below. it works for me during testing.

query       = (SELECT domain
                 FROM domain
                WHERE domain='%s'
                      AND backupmx=1
                      AND active=1
                LIMIT 1)
                UNION
              (SELECT alias_domain.target_domain
                 FROM alias_domain, domain
                WHERE alias_domain.alias_domain='%s'
                      AND alias_domain.target_domain=domain.domain
                      AND domain.backupmx=1
                      AND domain.active=1
                LIMIT 1)

6

Re: mail relay and alias domains

It didn't work for me.
I've enabled iredapd debug, however no information about relay query can be found there.

7

Re: mail relay and alias domains

*) How did you test it?
*) iRedAPD is not related to this issue.

8 (edited by misieq 2018-05-08 16:03:05)

Re: mail relay and alias domains

I'm setting emails from my other server.

I've enabled debug_peer_list in main.cf and I can see following differenece:

for alias domain

May  8 09:42:29 mdr4 postfix/10025/smtpd[17086]: private/rewrite socket: wanted attribute: nexthop
May  8 09:42:29 mdr4 postfix/10025/smtpd[17086]: input attribute name: nexthop
May  8 09:42:29 mdr4 postfix/10025/smtpd[17086]: input attribute value: NAME_OF_ALIAS_DOMAIN.com

for main domain

May  8 09:39:01 mdr4 postfix/10025/smtpd[17069]: private/rewrite socket: wanted attribute: nexthop
May  8 09:39:01 mdr4 postfix/10025/smtpd[17069]: input attribute name: nexthop
May  8 09:39:01 mdr4 postfix/10025/smtpd[17069]: input attribute value: [10.10.136.119]:25

However this sql statement looks fine. It gives the main domain in both cases.