diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:18:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:18:56 +0000 |
commit | b7c15c31519dc44c1f691e0466badd556ffe9423 (patch) | |
tree | f944572f288bab482a615e09af627d9a2b6727d8 /auxiliary/collate/tlstype.pl | |
parent | Initial commit. (diff) | |
download | postfix-b7c15c31519dc44c1f691e0466badd556ffe9423.tar.xz postfix-b7c15c31519dc44c1f691e0466badd556ffe9423.zip |
Adding upstream version 3.7.10.upstream/3.7.10upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'auxiliary/collate/tlstype.pl')
-rw-r--r-- | auxiliary/collate/tlstype.pl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/auxiliary/collate/tlstype.pl b/auxiliary/collate/tlstype.pl new file mode 100644 index 0000000..1e5cf9a --- /dev/null +++ b/auxiliary/collate/tlstype.pl @@ -0,0 +1,31 @@ +#! /usr/bin/env perl + +use strict; +use warnings; + +local $/ = "\n\n"; + +while (<>) { + my $qid; + my %tls; + my $smtp; + foreach my $line (split("\n")) { + if ($line =~ m{ postfix(?:\S*?)/qmgr\[\d+\]: (\w+): from=<.*>, size=\d+, nrcpt=\d+ [(]queue active[)]$}) { + $qid //= $1; + next; + } + if ($line =~ m{ postfix(?:\S*?)/smtp\[(\d+)\]: (\S+) TLS connection established to (\S+): (.*)}) { + $tls{$1}->{lc($3)} = [$2, $4]; + next; + } + if ($line =~ m{.*? postfix(?:\S*?)/smtp\[(\d+)\]: (\w+): (to=.*), relay=(\S+), (delay=\S+, delays=\S+, dsn=2\.\S+, status=sent .*)}) { + next unless $qid eq $2; + if (defined($tls{$1}->{lc($4)}) && ($tls{$1}->{lc($4)}->[2] //= $5) eq $5) { + printf "qid=%s, relay=%s, %s -> %s %s\n", $qid, lc($4), $3, @{$tls{$1}->{lc($4)}}[0..1]; + } else { + delete $tls{$1}; + printf "qid=%s, relay=%s, %s -> cleartext\n", $qid, lc($4), $3; + } + } + } +} |