filter_readme nexthop lookup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

filter_readme nexthop lookup

fusillator
Hi all, I'm trying to follow the FILTER_README howto for educational purpose.
As suggested I added the following line to my master.cf

smtp      inet  n       -       n       -       -       smtpd
scan      unix  -       -       n       -       2       smtp  -o
smtp_send_xforward_command=yes -o disable_mime_output_conversion=yes -o
smtp_generic_maps=

and the following directive to my main.cf

content_filter = scan:localhost:10025
receive_override_options = no_address_mappings

I entered the following command as proof of concept

while :; do cat <(echo '220 filtro.catorcio.tld ESMTP Postfix') | nc -l
127.0.0.1 10025 < /dev/stdin; done

but it seems postfix tries to resolve localhost with a dns lookup so it
fails, definitily not what I want.

Oct 20 13:03:10 webhat postfix/smtp[2299]: 65C1B20816C6:
to=<[hidden email]>, relay=none, delay=0.38, delays=0.25/0.11/0.02/0,
dsn=5.4.4, status=bounced (Host or domain name not found. Name service error
for name=localhost type=AAAA: Host not found)

I read the syntax of next hop in smtp man page and I solved changing the
directive in main.cf as

content_filter = scan:127.0.0.1:10025

[vagrant@webhat postfix]$ echo "hello world" | mail -s "testina"
[hidden email]
[vagrant@webhat ~]$ while :; do cat <(echo '220 filtro.catorcio.tld ESMTP
Postfix') | nc -l 127.0.0.1 10025 < /dev/stdin; done
EHLO webhat.catorcio.tld

But i wander and wonder:
Does FILTER_README suppose you have a dns record for localhost?
Is there a way to use /etc/hosts to resolve localhost?
 




 





--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: filter_readme nexthop lookup

Wietse Venema
fusillator:
> Does FILTER_README suppose you have a dns record for localhost?
> Is there a way to use /etc/hosts to resolve localhost?

FILTER_README does none of that. It just describes how you use a
Postfix SMTP client (or other Postfix delivery agent) to send mail
into a filter, and how to get that mail back into Postfix.

In other words, if your SMTP client can't deliver to localhost,
then that has nothing to do with content filtering.

By default (smtp_host_lookup = dns) the SMTP client uses DNS to
look up destinations. You can change that; see
http://www.postfix.org/postconf.5.html#smtp_host_lookup

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: filter_readme nexthop lookup

fusillator
Thanks for your answer Mr Venema.
In the readme they define the service on the port 10025 directly in the master.cf using the spawn utility, maybe the smtp agent doesn't lookup a dns record if it finds the next host defined in the service column of master.cf. Unfortunately now I'm in the office and I have to wait to have further fun with postfix but the smtp_host_lookup will surely solve the problem.

Regards

Luca

 

On 20 October 2017 at 15:43, Wietse Venema <[hidden email]> wrote:
fusillator:
> Does FILTER_README suppose you have a dns record for localhost?
> Is there a way to use /etc/hosts to resolve localhost?

FILTER_README does none of that. It just describes how you use a
Postfix SMTP client (or other Postfix delivery agent) to send mail
into a filter, and how to get that mail back into Postfix.

In other words, if your SMTP client can't deliver to localhost,
then that has nothing to do with content filtering.

By default (smtp_host_lookup = dns) the SMTP client uses DNS to
look up destinations. You can change that; see
http://www.postfix.org/postconf.5.html#smtp_host_lookup

        Wietse