Oefenweb / ansible-postfix

Ansible role to set up postfix in Debian-like systems
MIT License
173 stars 82 forks source link

Add posibility to use DNS MX records for relayhost #77

Closed schuetzi99 closed 4 years ago

schuetzi99 commented 4 years ago

To use the MX records of a domain as relay host, there must be no square brackets around the relayhost. The advantage is that multiple hosts can be specified in the DNS with type MX.

tersmitten commented 4 years ago

Any reason you did not configure postfix_relayhost with square brackets around it?

schuetzi99 commented 4 years ago

From http://www.postfix.org/BASIC_CONFIGURATION_README.html "The form enclosed with [] eliminates DNS MX lookups." But I want to do MX lookups to use multiple relayhosts, configured in DNS.

tersmitten commented 4 years ago

But wouldn't:

postfix_relayhost: '[yourdomain.org]'

work too? Without any role change.

schuetzi99 commented 4 years ago

That would do a request to the A-records for the domain. In our case that would be answered with the domain controllers, which aren't the mail relay hosts, and additionally I don't want to configure round robin, because round robin gives you not really a HA. I want to configure, that postfix does a MX lookup to the configured domain and is using the configured mail hosts one after another, considering their priority. And for this to work, you have to configure the domain without []. That's what I understand, reading the documentation linked above.

tersmitten commented 4 years ago

I misread the diff. I now see why your change is needed.

schuetzi99 commented 4 years ago

OK. My changes are made in that way, so that the default behavior remains the same.