Change status code for "Host not found"

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Change status code for "Host not found"

Helmut Schneider
Hi,

I'm running postfix as a relay connected via VPN. If the VPN is down
mails are rejected:

relay=none, delay=0.09, delays=0.06/0.02/0.01/0, dsn=5.4.4,
status=bounced (Host or domain name not found. Name service error for
name=EXCHANGE01 type=AAAA: Host not found)

Is there a way to change the dsn to 4xx and deliver it when the VPN is
up again?

Thank you!

Reply | Threaded
Open this post in threaded view
|

Re: Change status code for "Host not found"

Wesley Peng-4
Hi

on 2019/9/12 22:01, Helmut Schneider wrote:
> relay=none, delay=0.09, delays=0.06/0.02/0.01/0, dsn=5.4.4,
> status=bounced (Host or domain name not found. Name service error for
> name=EXCHANGE01 type=AAAA: Host not found)

This is a network issue rather than postfix problem I may think.
You should fix up the network after VPN is down.

regards.
Reply | Threaded
Open this post in threaded view
|

Re: Change status code for "Host not found"

Wietse Venema
In reply to this post by Helmut Schneider
Helmut Schneider:
[ Charset ISO-8859-1 converted... ]
> Hi,
>
> I'm running postfix as a relay connected via VPN. If the VPN is down
> mails are rejected:
>
> relay=none, delay=0.09, delays=0.06/0.02/0.01/0, dsn=5.4.4,
> status=bounced (Host or domain name not found. Name service error for
> name=EXCHANGE01 type=AAAA: Host not found)

It's status=bounced (dsn=5.4.4) because Postfix received a DNS
NXDOMAIN (name does not exist) response for the name 'EXCHANGE01'.

> Is there a way to change the dsn to 4xx and deliver it when the VPN is
> up again?

http://www.postfix.org/postconf.5.html#default_delivery_status_filter
Look under the examples for smtp_delivery_status_filter. Here is
an untested variant that should work.

/etc/postfix/main.cf:
   smtp_delivery_status_filter = pcre:/etc/postfix/smtp_dsn_filter

/etc/postfix/smtp_dsn_filter:
    /^5(\.\d+\.\d+ Name service error for name=EXCHANGE01/ 4$1

You can't use http://www.postfix.org/postconf.5.html#smtp_dns_reply_filter
because that feature requires that the server returns a reply, not
NXDOMAIN.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Change status code for "Host not found"

Wietse Venema
Wietse Venema:

> Helmut Schneider:
> [ Charset ISO-8859-1 converted... ]
> > Hi,
> >
> > I'm running postfix as a relay connected via VPN. If the VPN is down
> > mails are rejected:
> >
> > relay=none, delay=0.09, delays=0.06/0.02/0.01/0, dsn=5.4.4,
> > status=bounced (Host or domain name not found. Name service error for
> > name=EXCHANGE01 type=AAAA: Host not found)
>
> It's status=bounced (dsn=5.4.4) because Postfix received a DNS
> NXDOMAIN (name does not exist) response for the name 'EXCHANGE01'.
>
> > Is there a way to change the dsn to 4xx and deliver it when the VPN is
> > up again?
>
> http://www.postfix.org/postconf.5.html#default_delivery_status_filter
> Look under the examples for smtp_delivery_status_filter. Here is
> an untested variant that should work.
>
> /etc/postfix/main.cf:
>    smtp_delivery_status_filter = pcre:/etc/postfix/smtp_dsn_filter
>
> /etc/postfix/smtp_dsn_filter:
>     /^5(\.\d+\.\d+ Name service error for name=EXCHANGE01/ 4$1

Should be:

    /^5(\.\d+\.\d+ Name service error for name=EXCHANGE01)/ 4$1

(i.e. there was no closing ')').

        Wietse
> You can't use http://www.postfix.org/postconf.5.html#smtp_dns_reply_filter
> because that feature requires that the server returns a reply, not
> NXDOMAIN.
>
> Wietse
>
Reply | Threaded
Open this post in threaded view
|

Re: Change status code for "Host not found"

Helmut Schneider
In reply to this post by Wietse Venema
Wietse Venema wrote:

> Helmut Schneider:
> [ Charset ISO-8859-1 converted... ]
> > Hi,
> >
> > I'm running postfix as a relay connected via VPN. If the VPN is down
> > mails are rejected:
> >
> > relay=none, delay=0.09, delays=0.06/0.02/0.01/0, dsn=5.4.4,
> > status=bounced (Host or domain name not found. Name service error
> > for name=EXCHANGE01 type=AAAA: Host not found)
>
> It's status=bounced (dsn=5.4.4) because Postfix received a DNS
> NXDOMAIN (name does not exist) response for the name 'EXCHANGE01'.
>
> > Is there a way to change the dsn to 4xx and deliver it when the VPN
> > is up again?
>
> http://www.postfix.org/postconf.5.html#default_delivery_status_filter
> Look under the examples for smtp_delivery_status_filter. Here is
> an untested variant that should work.
>
> /etc/postfix/main.cf:
>    smtp_delivery_status_filter = pcre:/etc/postfix/smtp_dsn_filter
>
> /etc/postfix/smtp_dsn_filter:
>     /^5(\.\d+\.\d+ Name service error for name=EXCHANGE01/ 4$1

Works like a charm, thank you!