Hello Wietse Venema,

This will print recipient addresses that were sent over TLS.

Based on your suggestion I improved it a bit. In case someone else has the same problem here the full script. It prints outgoing non TLS and at the end a summary.

I'm sending mainly TLS except many DMARC reports and government addresses. While I could simply not sent the DMARC mails, the government is another issue. It seems government here in Germany means compliance instead of real security (OTOH at least two agencies use DANE, so maybe there is a bit of hope :-).

#!/usr/bin/perl -w

use strict;

my %encrypted;
my %targets;

# journalctl _SYSTEMD_UNIT=postfix.service | postfixunencrypted

while (<>)
{
  if(/^\S+ \S+ \S+ \S+ (\S+) \S+ TLS connection established to (\S+):/)
  {
    my ($id, $server) = ($1, $2);
    $encrypted{"$id$server"} = $_;
  }
elsif(/^\S+ \S+ \S+ \S+ (\S+) \S+ to=(\S+), relay=(\S+),.*status=(\S+)/)
  {
    my ($id, $mail, $server, $status) = ($1, $2, $3, $4);
    next if ($server eq 'local') || ($status ne 'sent');
    if(!$encrypted{"$id$server"})
    {
      print "$mail ($id $server $status)\n";
      $targets{$mail}++;
    }
  }
}

for my $t (sort keys %targets)
{
  printf "%3d $t\n", $targets{$t};
}

Thanks for the help.

For Freedom In peace
--
https://www.dstoecker.eu/ (PGP key available)
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to