Re: How to make Postfix use hostnames from /etc/hosts ?

2019-10-07 Thread Viktor Dukhovni
> On Oct 7, 2019, at 7:46 PM, Jaroslaw Rafa  wrote:
> 
>> Unless your system sends all mail to statically configured
>> relays listed in /etc/hsots, you MUST NOT set:
>> 
>>  smtp_host_lookup = native
> 
> But "native" doesn't mean /etc/hosts only! Native means system-configured
> name resolution and this is defined by /etc/nsswitch.conf and/or
> /etc/host.conf. nsswitch.conf contains the entry "hosts: files dns" and
> host.conf contains "order hosts,bind". Both entries mean - try to resolve
> using /etc/hosts first, and if the name is not found in /etc/hosts, resolve
> using normal DNS. And this is the way it's working for me right now.

Native is wrong for resolving DNS MX hostnames since, it may
try to erroneously append default domains (from the resolv.conf
search list) to fully-qualified DNS names.

While a sufficiently small "ndots" might keep you out of trouble,
"native" also breaks visibility of DNSSEC and is therefore
incompatible with DANE.

It also precludes use of the Postfix "smtp_dns_reply_filter".

It may mostly work for you, but is NOT recommended.

-- 
Viktor.



Re: How to make Postfix use hostnames from /etc/hosts ?

2019-10-07 Thread Jaroslaw Rafa
Dnia  7.10.2019 o godz. 19:40:40 Viktor Dukhovni pisze:
> 
> Unless your system sends all mail to statically configured
> relays listed in /etc/hsots, you MUST NOT set:
> 
>   smtp_host_lookup = native

But "native" doesn't mean /etc/hosts only! Native means system-configured
name resolution and this is defined by /etc/nsswitch.conf and/or
/etc/host.conf. nsswitch.conf contains the entry "hosts: files dns" and
host.conf contains "order hosts,bind". Both entries mean - try to resolve
using /etc/hosts first, and if the name is not found in /etc/hosts, resolve
using normal DNS. And this is the way it's working for me right now.
-- 
Regards,
   Jaroslaw Rafa
   r...@rafa.eu.org
--
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."


Re: How to make Postfix use hostnames from /etc/hosts ?

2019-10-07 Thread Viktor Dukhovni
> On Oct 7, 2019, at 6:09 PM, Jaroslaw Rafa  wrote:
> 
> I found in the documentation that I have to add the parameter
> "smtp_host_lookup=native" to main.cf to make Postfix use system configured
> name resolution instead of trying to resolve names by itself.

Unless your system sends all mail to statically configured
relays listed in /etc/hsots, you MUST NOT set:

smtp_host_lookup = native

for all destinations.  Instead, create a second transport
in master.cf:

nativesmtp unix ... smtp
   -o smtp_host_lookup=native

And then use "nativesmtp:[nativehost]" in the transport table
for all destinations that need to avoid DNS.

You could set:

smtp_host_lookup = dns, native

but then all your native names will still trigger DNS lookups
first, and that's not ideal when the name is a priori known
to be native.

-- 
Viktor.



Re: How to make Postfix use hostnames from /etc/hosts ?

2019-10-07 Thread Rich Shepard

On Tue, 8 Oct 2019, Jaroslaw Rafa wrote:


(However, it didn't help with my original Gmail issue - even mail relayed
via another server still goes to spam on the receiving side :()


Jaroslaw,

While not directly related to your issue, I've found that some clients who
use gmail end up with messages I send in their spam folder. Many folks use
gmail and only a few have had this problem. I'm certain that it's an issue
with their ISP and not postfix or google (directly).

They'll call and ask why they've not received the information they requested
and I ask them to look in their spam folder. Sure enough, there sits the
original message (and attachments) I sent. That they don't think of looking
there on a daily basis, or when not receiving expected communications, is a
non-technical issue.

Glad you fixed your problem.

Rich


Re: How to make Postfix use hostnames from /etc/hosts ?

2019-10-07 Thread Jaroslaw Rafa
Dnia  8.10.2019 o godz. 00:09:34 Jaroslaw Rafa pisze:
> As I have trouble with sending emails to Gmail (I wrote about it in a
> different thread), I try to configure Postfix to send mail to Gmail via a
> different mail server as a relay. However, for reasons too long to explain
> here, I would like Postfix to refer to that server via hostname that I
> defined in /etc/hosts file and not via actual DNS hostname.
[...]
> What am I doing wrong?

Replying to myself, but it looks that the issue is solved - I need to
*restart* Postfix after these changes, only reloading is not enough.

(However, it didn't help with my original Gmail issue - even mail relayed
via another server still goes to spam on the receiving side :()
-- 
Regards,
   Jaroslaw Rafa
   r...@rafa.eu.org
--
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."