O
O
Ockonal2013-05-18 12:42:04
Debian
Ockonal, 2013-05-18 12:42:04

Email forwarding

Hello, I have a server on debian, it has exim4 installed, all mail is redirected to one mailbox, i.e. you can send letters to *** domain .com and they all add up to one place. The domain is hosted on godaddy, in order to send mail correctly, I made the following entries:

A (Host)
@ IP

CNAME (Alias)
imap @
mail @
pop @
smtp @

MX (MailExchanger)
0 @ @

There is an item in the exim-config:

collector_router:
driver = redirect
domains = MYDOMAIN.org
data = [email protected]

All this works, but the problem is that you need to add another domain to this heap so that any mail on it is redirected to this server. I made the entries for the new domain as follows:

imap MYDOMAIN.ORG
mail MYDOMAIN.ORG
pop MYDOMAIN.ORG
smtp MYDOMAIN.ORG
MX:
0 @ @

Mail is not redirected with this config. I think the reason for this is the MX record, it is impossible to register a domain name there, it resaves it in @.

Tell me if this is so, and what needs to be added to Exim so that it picks up another domain.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
merlin-vrn, 2013-05-18
@Ockonal

First, it is difficult to read DNS zone data in this form. Still, it's better not to draw origins in such quantities, and write everything in the BIND zone format, which is the industry standard and described in the bearded RFC1034 and RFC1035.
Did I understand your zones correctly:

$ORIGIN domain.com
domain.com. A <ip-address>
domain.com. MX0 domain.com.
mail CNAME domain.com.
imap CNAME domain.com.
pop CNAME domain.com.
smtp CNAME domain.com.

and for the new domain you did:
$ORIGIN mydomain.org.
mydomain.org. MX0 mydomain.org.
imap CNAME mydomain.org.
mail CNAME mydomain.org.
pop CNAME mydomain.org.
smtp CNAME mydomain.org.

If so, then it shouldn't work. At a minimum, I don't see an A-record corresponding to mydomain.org, which will indicate which host all these cname and mx refer to, which means that the zone is incorrect. Perhaps you just forgot to put it here.
Secondly, the indicated RFCs (and another one about IPv6) explicitly state that the MX record specifies the server name, and the corresponding RR must be either A or AAAA records - no CNAME and the like. For example, this is how you can (although it makes no sense - if there is no MX record, mail servers are required to fallback and try to send mail to the server using the A record):
domain.com MX 0 domain.com
domain.com A 192.0.2.1

And so - you can't
domain.com MX 0 192.0.2.1
domain.com A 192.0.2.1

domain.com MX 0 mail.domain.com
domain.com A 192.0.2.1
mail.domain.com CNAME domain.com

So your supposed reason doesn't exist at all, the MX record always contains the name and it's not a bug, it's an ancient feature. This is, if you like, the only "special version of the SRV record" that has survived to this day (MX indicates the location of the mail exchanger, and there are no special types of records for the rest of the services - they all - ldap, kerberos, xmpp, sip - use standard SRV).
Third. I think the second zone should be something like this:
mydomain.org. MX0 domain.com.

We specify that in order to send mail to the mydomain.org domain, we must connect to a host named domain.com; a dot at the end of the name means that the name is absolute and the origin does not need to be assigned to it. For mail to work, the rest of the content of the zone does not matter.
The second option - you make exactly the same zone as in the first case, with the same IP address. The same, but you have more zones to change in case of a move.
In general, our mailer serves several dozen domains, for which it was actually simply given a separate name (ie A-records) mail.example.org. and mail2.example.org., and all of the several dozen domains list another.org. MX 10 mail.example.org. and another.org. MX 20 mail2.example.org.
So when changing the address of any of the mail or mail2 servers, we change only one record in one zone (it was like that).
Now we have to observe in the Exim logs on the domain.com server how mail for the mydomain.or domain arrives. Well, how it will process it is a matter of Exim configuration. From now on, I cannot help, because. I use postfix everywhere ;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question