On 2013-05-02 11:08:13 -0500, Noel Jones wrote:
> If the DNS lookup fails with a temporary error, the mail will be
> deferred.
> 
> It's important to note that not all clients labeled as "unknown"
> will be rejected by reject_unknown_reverse_client_hostname.
> 
> For enlightenment, compare the docs on
> reject_unknown_client_hostname (a strict test not widely used), with
> the docs on reject_unknown_reverse_client_hostname (a generally safe
> check).
[...]

In order to be sure, I decided to check against my mail archive.
I've written a small Perl script for that (attached). Some clients
don't seem to have a reverse hostname. Both IPv4 and IPv6 are
concerned. For instance:

Received: from carotte.tilapin.org (unknown [95.138.72.61])
        by ioooi.vinc17.net (Postfix) with ESMTPS id EFA4959
        for <vinc...@vinc17.net>; Tue,  2 Oct 2012 03:15:23 +0200 (CEST)

$ host 95.138.72.61
Host 61.72.138.95.in-addr.arpa. not found: 3(NXDOMAIN)

and this is from a Debian developer.

There's something that is quite strange with one of the mail I've
sent from my machine at work (ypig):

Received: from ypig.lip.ens-lyon.fr (unknown 
[IPv6:2002:8c4d:d7f:1:21f:29ff:fe04:3efb])
        by ioooi.vinc17.net (Postfix) with ESMTPS id A053EA4
        for <vincent-h...@vinc17.net>; Tue, 12 Feb 2013 14:12:33 +0100 (CET)

An IPv6 address is listed while it was an IPv4 connection (IPv6
doesn't work at ens-lyon.fr as shown by "ping6" and "ssh -6" from
ypig to ioooi, which give a "Network is unreachable" error). It
seems to be the only exception for this machine (the IPv4 address
with the associated reverse hostname is normally given). Is there
any explanation?

Note: for this date, I no longer have any logs.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
#!/usr/bin/env perl

# List messages of a maildir folder which have been received from
# a client without a reverse hostname.
#
# 1st argument: name of the mail server receiving the messages.
# 2nd argument: directory (e.g. maildir folder).

use strict;
use AnyEvent::DNS;
use File::Find;

my ($proc) = '$Id: smtp-unknown-reverse 60197 2013-05-06 00:16:56Z vinc17/xvii 
$'
  =~ /^.Id: (\S+) / or die;

@ARGV == 2 or $! = 1, die "Usage: $proc <server> <maildir>\n";
my ($server,$dir) = @ARGV;
find(\&wanted, $dir);

sub check ($)
  {
    my ($ip) = $_[0] =~
      /^Received:.*\(unknown\s+\[(.+)\]\)\s+by \Q$server\E\s/si
        or return;
    $ip =~ s/IPv6://;
    my $cv = AnyEvent->condvar;
    AnyEvent::DNS::reverse_lookup $ip, $cv;
    defined $cv->recv or print "$File::Find::name [$ip]\n";
  }

sub wanted
  {
    -f $_ or return;
    open FILE, '<', $_
      or die "$proc: can't open file $File::Find::name";
    my $header;
    while ((my $line = <FILE>) !~ /^$/)
      {
        if (defined $header)
          {
            $line =~ /^\s/ and $header .= $line, next;
            check $header;
            undef $header;
          }
        $line =~ /^Received:/i and $header = $line;
      }
    check $header if defined $header;
    close FILE
      or die "$proc: can't close file $File::Find::name";
  }

# $Id: smtp-unknown-reverse 60197 2013-05-06 00:16:56Z vinc17/xvii $

Reply via email to