git: a82b06f2fce1 - main - sysutils/logwatch: Add support of the upcoming postfix 3.11

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Fri, 21 Nov 2025 23:03:13 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a82b06f2fce175f9377c7008895a5a453c4c8626

commit a82b06f2fce175f9377c7008895a5a453c4c8626
Author:     Michael Grimm <trashcan@ellael.org>
AuthorDate: 2025-11-21 22:59:08 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-11-21 23:03:09 +0000

    sysutils/logwatch: Add support of the upcoming postfix 3.11
    
    - The upcoming postfix 3.11 stable and next postfix-current version
      will break the postfix service script:
      https://www.postfix.org/postconf.5.html#smtp_log_tls_feature_status
    - A patched postfix service script will deal with old and new status
      report lines.
    - This patch has been reported upstream:
      https://sourceforge.net/p/logwatch/patches/95/
    - Patch has been tested with a logfiles from past 360 days.
    - files/pkg-message.in has been updated accordingly.
    
    PR:     291130
---
 sysutils/logwatch/Makefile                         |  1 +
 .../logwatch/files/patch-scripts_services_postfix  | 43 ++++++++++++++++++++++
 sysutils/logwatch/files/pkg-message.in             |  4 ++
 3 files changed, 48 insertions(+)

diff --git a/sysutils/logwatch/Makefile b/sysutils/logwatch/Makefile
index c9f09d893f6e..5600ae6ac26f 100644
--- a/sysutils/logwatch/Makefile
+++ b/sysutils/logwatch/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	logwatch
 DISTVERSION=	7.13
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}-${DISTVERSION}
 
diff --git a/sysutils/logwatch/files/patch-scripts_services_postfix b/sysutils/logwatch/files/patch-scripts_services_postfix
new file mode 100644
index 000000000000..969b829560cb
--- /dev/null
+++ b/sysutils/logwatch/files/patch-scripts_services_postfix
@@ -0,0 +1,43 @@
+--- scripts/services/postfix.orig	2025-03-02 22:05:02 UTC
++++ scripts/services/postfix
+@@ -61,7 +61,8 @@ our $re_DSN     = qr/(?:(?:\d{3})?(?: ?\d\.\d\.\d+)?)/
+ our $re_QID;
+ 
+ our $re_DSN     = qr/(?:(?:\d{3})?(?: ?\d\.\d\.\d+)?)/;
+-our $re_DDD     = qr/(?:(?:conn_use=\d+ )?delay=-?[\d.]+(?:, delays=[\d\/.]+)?(?:, dsn=[\d.]+)?)/;
++# postfix >= 3.11 will log TLS feature information in delivery status logging by default (tls=)
++our $re_DDD     = qr/(?:(?:conn_use=\d+ )?delay=-?[\d.]+(?:, delays=[\d\/.]+)?(?:, tls=[^,]*)?(?:, dsn=[\d.]+)?)/;
+ 
+ #MODULE: ../Logreporters/Utils.pm
+ package Logreporters::Utils;
+@@ -3287,14 +3288,30 @@ sys     0m3.005s
+       }
+ 
+       ### sent, forwarded, bounced, softbounce, deferred, (un)deliverable
++      #
++      # postfix >= 3.11 will log TLS feature information in delivery status logging by default (tls=)
++      # modified $re_DDD detects the corresponding tls= part, now
++      #
+       elsif ($p1 =~ s/^to=<(.*?)>,(?: orig_to=<(.*?)>,)? relay=([^,]*).*, ($re_DDD), status=(\S+) //o) {
+          ($relay,$status) = ($3,$5);
+ 
+          my ($to,$origto,$localpart,$domainpart,$dsn,$p1) = process_delivery_attempt ($1,$2,$4,$p1);
+ 
++         my ($tlsfeatures) = $4 =~ /tls=([^,]+)/;
++         if ($tlsfeatures ne '') {
++            $domainpart = $domainpart . " (tls=" . $tlsfeatures . ")";
++         }
++
++         # postfix <= 3.10:
++         #
+          #TD 552B6C20E: to=<to@sample.com>, relay=mail.example.net[10.0.0.1]:25, delay=1021, delays=1020/0.04/0.56/0.78, dsn=2.0.0, status=sent (250 Ok: queued as 6EAC4719EB)
+          #TD 552B6C20E: to=<to@sample.com>, relay=mail.example.net[10.0.0.1]:25, conn_use=2 delay=1021, delays=1020/0.04/0.56/0.78, dsn=2.0.0, status=sent (250 Ok: queued as 6EAC4719EB)
+          #TD DD925BBE2: to=<to@example.net>, orig_to=<to-ext@example.net>, relay=mail.example.net[2001:dead:beef::1], delay=2, status=sent (250 Ok: queued as 5221227246)
++         #
++         # postfix >= 3.11:
++         #
++         #TD4d9bVw113Wz1SwX: to=<to@example.net>, relay=mail.example.org[10.0.01]:25, delay=3.2, delays=0.09/0.05/1.8/1.2, tls=dane, dsn=2.0.0, status=sent (250 OK id=1vLFwP-00000008xhU-3ZkI)
++         #TD4d9bVw113Wz1SwX: to=<to@example.net>, relay=mail.example.org[10.0.01]:25, delay=3.2, delays=0.09/0.05/1.8/1.2, tls=may, dsn=2.0.0, status=sent (250 OK id=1vLFwP-00000008xhU-3ZkI)
+ 
+          ### sent
+          if ($status eq 'sent') {
diff --git a/sysutils/logwatch/files/pkg-message.in b/sysutils/logwatch/files/pkg-message.in
index c885cea0b304..f790792b32b1 100644
--- a/sysutils/logwatch/files/pkg-message.in
+++ b/sysutils/logwatch/files/pkg-message.in
@@ -15,6 +15,10 @@ Important changes in logwatch-7.13:
 
  - postfix script detects modified 3.10+ log entries, now
 
+Important changes in logwatch-7.13_1:
+
+ - postfix script detects 3.11+ TLS feature information in delivery status logging (tls=), now
+
 EOM
 }
 ]