ONLYOFFICE / Docker-MailServer

ONLYOFFICE Mail Server is a full-featured mail server solution developed on the base of the iRedMail package, containing the following components: Postfix, Dovecot, SpamAssassin, ClamAV, OpenDKIM, Fail2ban.
Other
79 stars 54 forks source link

Postfix: "do not list domain … in BOTH mydestination and virtual_mailbox_domains" #11

Open Daniel-Beardsmore opened 6 years ago

Daniel-Beardsmore commented 6 years ago

Setup:

Version 9.6.3.663 installed in Debian 8 under Docker. Community Server is connected to Mail Server to handle mail for a dedicated domain, using Mail → Settings → Mail Server → Add your own domain.

This is causing Postfix to log (in /var/log/maillog):

postfix/trivial-rewrite[2355]: warning: do not list domain $DOMAIN in BOTH mydestination and virtual_mailbox_domains

andrewborell commented 5 years ago

Not an expert on the matter, but I am a confident user with regard to postfix and saw this too. I think this may be (at least partly) due to a configuration I would never use but seems to be required by the mail server for DNS verification in combination with the instructions on creating the mail server docker.

When you create the docker for the mail server you are told to use DOMAIN.TLD but your mail server will almost never be DOMAIN.TLD. Rather it should be something like MAIL.DOMAIN.TLD and you should have a HOST A record for MAIL pointing to the IP of the mail server, then configure your MX record to refer to the HOST A. An example in godaddy dns would be :

HOST A Record

MX Record

In the case of this script and software however, the software does a DNS Verification when adding a domain that appears to require your MX to match the name of the domain for reasons I cannot understand but if I were to hazard a guess I would say this relates to multi-tenant hosting. Using godaddy as an example, you are told to create an MX record like this:

That is simultaneously the easiest and stupidest way possible to create an MX record, and no one does it in production, so I assume enterprise clients are directed to do something different.

Just do a DIG to see if any major mail host does this if you are bored and you will not find this configuration e.g.)

Google

drew@mail:/etc# dig google.com mx ;; ANSWER SECTION: google.com. 600 IN MX 30 alt2.aspmx.l.google.com. google.com. 600 IN MX 10 aspmx.l.google.com. google.com. 600 IN MX 50 alt4.aspmx.l.google.com. google.com. 600 IN MX 40 alt3.aspmx.l.google.com. google.com. 600 IN MX 20 alt1.aspmx.l.google.com.

Zoho

drew@mail:/etc# dig zoho.com mx ;; ANSWER SECTION: zoho.com. 191 IN MX 50 smtpin3.zoho.com. zoho.com. 191 IN MX 20 smtpin2.zoho.com. zoho.com. 191 IN MX 10 smtpin.zoho.com.

What I was thinking should work to resolve this problem is to configure the HOST A and MX in your hosted DNS as described above, then change up the docker run command as seen below: . . . -v /app/onlyoffice/MailServer/logs:/var/log \ -h MAIL.DOMAIN.TLD \ onlyoffice/mailserver

So when you go to create your virtual domain, the mail server is using the FQDN and the domain itself is not in use. I haven't tried this yet so let us know how it goes if you get it resolved before I can find the time to work on it again. Also please excuse my CAPS. I only used them as contrast to get point across, but the values are not case-sensitive and would normally be lower-case.