Fourhundred Thecat:
> Hello,
>
> I am using simple python script to parse postfix logs, and ban offending
> IP addresses. One of the patterns I am matching is unknown host:
>
> NOQUEUE: reject: RCPT from unknown[195.133.40.183]: 450 4.7.25
> Client host rejected: cannot find your hostname
>
> The problem is, postfix does not seem to distinguish between IP having
> no DNS record, and my DNS server being temporarily unavailable.
Actually it does. 450 means temporary error.
Wietse
> I don't want to ban IP only because my DNS server did not respond (for
> whatever reason)
>
> How can I solve this?
> Can Postfix give different errors?
>
> Here is how I would do it in python:
>
> try:
> return socket.gethostbyaddr(addr)
> except socket.herror as e:
> if e.errno == 1:
> return None
> else:
> return -1
>
> None is having no record, -1 is DNS temporarily unavailable
>
> any other comments or suggestions are welcome
>
> thanks,
>