3 # written by David Schweikert and adapted to Debian by Adrian von Bidder
4 # adapted to PLD Linux Distribution Micha³ Lipka
5 # this script is in the public domain
7 # This script will output all clients that were automatically whitelisted
8 # by postgrey's --auto-whitelist-clients option.
9 # Set the default number of mails your to fit your needs (generally it
10 # should be the same as N i --auto-whitelist-clients=N)
15 my $dbdir = '/var/spool/postfix/postgrey/';
20 my $iaddr = inet_aton($host);
21 return gethostbyaddr($iaddr, AF_INET) || $host;
29 my $dbenv = BerkeleyDB::Env->new(
31 -Flags => DB_INIT_TXN|DB_INIT_MPOOL|DB_INIT_LOG,
32 ) or die "ERROR: can't open DB environment: $!\n";
34 tie(%db, 'BerkeleyDB::Btree',
35 -Filename => "postgrey_clients.db",
38 ) or die "ERROR: can't open database $dbdir/postgrey_clients.db: $!\n";
45 # go through the database
46 my $db = dbopen($dbdir);
47 while (my ($key, $value) = each %$db) {
48 my ($c,$l) = split(/,/,$value);
50 my $host = resolv($key);
51 print "$host [$key] ($c)\n";