What I need to configure for my Debian 12 VM:
- no public or LAN DNS whatsoever
- ability to fetch a single MX record for a single domain
I don't think I can add MX to /etc/hosts which only works for A records.
I'm after a similarly simple, "one liner" solution.
What I need to configure for my Debian 12 VM:
- no public or LAN DNS whatsoever
- ability to fetch a single MX record for a single domain
I don't think I can add MX to /etc/hosts which only works for A
records.
I'm after a similarly simple, "one liner" solution.
---
Adam
On Mon, Jul 15, 2024 at 14:00:03 +0100, Adam Weremczuk wrote:
What I need to configure for my Debian 12 VM:
- no public or LAN DNS whatsoever
- ability to fetch a single MX record for a single domain
I don't think I can add MX to /etc/hosts which only works for A records.
I'm after a similarly simple, "one liner" solution.
I'm *so* confused by this question. You want to be able to *fetch* an MX record? You don't want to configure your MTA in a static way so that
it delivers mail properly for this domain right now? You need to be able
to *fetch* the MX record in real time in case it changes?
And you want to do that *without* being able to contact the real DNS?
How does one reconcile these goal statements? It's beyond me.
Given you want to send mail to foo.com whose mx record is mail.foo.com
whose IP is 1.2.3.4
Then write this entry in hosts file:
1.2.3.4 foo.com
Which should work for sending mail.
Regards
On 2024-07-15 21:00, Adam Weremczuk wrote:
What I need to configure for my Debian 12 VM:
- no public or LAN DNS whatsoever
- ability to fetch a single MX record for a single domain
I don't think I can add MX to /etc/hosts which only works for A records.
I'm after a similarly simple, "one liner" solution.
---
Adam
It doesn't work.
mail.example.com record doesn't exist to start with.
Even if I add:
1.2.3.4 example.com
5.6.7.8 mail.example.com
to /etc/hosts
I get:
0A032940922 657 Mon Jul 15 14:40:01 user1@mymachine
(Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
user2@example.com
On 15/07/2024 14:17, Jeff Pang wrote:
Given you want to send mail to foo.com whose mx record is mail.foo.com
whose IP is 1.2.3.4
Then write this entry in hosts file:
1.2.3.4 foo.com
Which should work for sending mail.
Regards
On 2024-07-15 21:00, Adam Weremczuk wrote:
What I need to configure for my Debian 12 VM:
- no public or LAN DNS whatsoever
- ability to fetch a single MX record for a single domain
I don't think I can add MX to /etc/hosts which only works for A
records.
I'm after a similarly simple, "one liner" solution.
---
Adam
I get:
0A032940922 657 Mon Jul 15 14:40:01 user1@mymachine
(Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
I want to achieve the first objective and the values are static.
I just hoped there is a one liner hack (like A records in /etc/hosts) to achieve this vs reconfiguring my MTA.
I'm using Postfix and this all that was needed:
/etc/hosts
1.2.3.4 example.com
/etc/postfix/main.cf
disable_dns_lookups = yes
smtp_host_lookup = native
I get:
0A032940922 657 Mon Jul 15 14:40:01 user1@mymachine
(Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
Any SMTP client which does not fall back to the A record when no MX records exists is fundamentally broken.
I assume that you are not trying to achieve "smart host" configuration
for sending mail.
Perhaps you can run a dedicated dnsmasq instance with no upstream DNS servers. Option that might help: --dns-rr, --mx-host, --mx-target.
It's probably worth noting that `disable_dns_lookups` has
been deprecated for a long time. The postconf(5) man page
says:
As of Postfix 2.11, this parameter is deprecated; use
smtp_dns_support_level instead.
(Debian 12 has postfix-3.7.11; well past postfix-2.11.)
I don't know if `smtp_dns_support_level` is needed at all
with `smtp_host_lookup = native`. I've never run an MTA
where I wanted DNS lookups disabled, so I don't have any
direct experience.
If it is needed, you'd surely be better off avoiding the
long-deprecated `disable_dns_lookups` parameter which will
just set you up for failure with some future update.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (1 / 15) |
Uptime: | 160:35:20 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,056 |
Messages: | 6,416,493 |