public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pmg-api v2 0/2] small improvements for log-header functionality
@ 2026-06-11 10:15 Stoiko Ivanov
  2026-06-11 10:15 ` [PATCH pmg-api v2 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2026-06-11 10:15 UTC (permalink / raw)
  To: pmg-devel

v1->v2:
* trim whitespace after restricting the length - based on Dominik's feedback
  thx!!

v1:
https://lore.proxmox.com/pmg-devel/20260611085708.1121041-1-s.ivanov@proxmox.com/T/#t

Stoiko Ivanov (2):
  config: add log-headers to pmg-smtp-filter parameters
  pmg-smtp-filter: log-headers: trim trailing whitespace

 src/PMG/Config.pm       | 1 +
 src/bin/pmg-smtp-filter | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

-- 
2.47.3





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH pmg-api v2 1/2] config: add log-headers to pmg-smtp-filter parameters
  2026-06-11 10:15 [PATCH pmg-api v2 0/2] small improvements for log-header functionality Stoiko Ivanov
@ 2026-06-11 10:15 ` Stoiko Ivanov
  2026-06-11 10:15 ` [PATCH pmg-api v2 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace Stoiko Ivanov
  2026-06-11 11:12 ` applied: [PATCH pmg-api v2 0/2] small improvements for log-header functionality Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2026-06-11 10:15 UTC (permalink / raw)
  To: pmg-devel

changing this setting via our API (and eventually via GUI) should
notify pmg-smtp-filter that the workers should reload their
configuration.

tested by sending testmails and running:
`pmgsh set  /config/mail --log-headers (0|1)`

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/Config.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 83d687bd..943ae1ea 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -1926,6 +1926,7 @@ my $pmg_service_params = {
         ndr_on_block => 1,
         smtputf8 => 1,
         'accept-broken-mime' => 1,
+        'log-headers' => 1,
     },
     admin => {
         dkim_selector => 1,
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH pmg-api v2 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace
  2026-06-11 10:15 [PATCH pmg-api v2 0/2] small improvements for log-header functionality Stoiko Ivanov
  2026-06-11 10:15 ` [PATCH pmg-api v2 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
@ 2026-06-11 10:15 ` Stoiko Ivanov
  2026-06-11 11:12 ` applied: [PATCH pmg-api v2 0/2] small improvements for log-header functionality Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2026-06-11 10:15 UTC (permalink / raw)
  To: pmg-devel

Reported-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/bin/pmg-smtp-filter | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/bin/pmg-smtp-filter b/src/bin/pmg-smtp-filter
index 7f9cdb85..a746a074 100755
--- a/src/bin/pmg-smtp-filter
+++ b/src/bin/pmg-smtp-filter
@@ -714,7 +714,9 @@ sub handle_smtp {
                 $value = PMG::Utils::decode_rfc1522($value);
                 # remove non-printable and Unicode format chars to avoid log injection and spoofing
                 $value =~ s/[^\p{XPosixPrint}]|\p{Cf}/ /g;
-                return encode('UTF-8', substr($value, 0, 512));
+                $value = substr($value, 0, 512);
+                $value =~ s/^\s+|\s+$//g;;
+                return encode('UTF-8', $value);
             };
             # separate line on purpose, so the log-tracker does not parse it as an event
             $self->log(
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* applied: [PATCH pmg-api v2 0/2] small improvements for log-header functionality
  2026-06-11 10:15 [PATCH pmg-api v2 0/2] small improvements for log-header functionality Stoiko Ivanov
  2026-06-11 10:15 ` [PATCH pmg-api v2 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
  2026-06-11 10:15 ` [PATCH pmg-api v2 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace Stoiko Ivanov
@ 2026-06-11 11:12 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2026-06-11 11:12 UTC (permalink / raw)
  To: pmg-devel, Stoiko Ivanov

On Thu, 11 Jun 2026 12:15:05 +0200, Stoiko Ivanov wrote:
> v1->v2:
> * trim whitespace after restricting the length - based on Dominik's feedback
>   thx!!
> 
> v1:
> https://lore.proxmox.com/pmg-devel/20260611085708.1121041-1-s.ivanov@proxmox.com/T/#t
> 
> [...]

Applied, with the double-semicolon in the second patchdropped, thanks!

[1/2] config: add log-headers to pmg-smtp-filter parameters
      commit: e90aab6f82d7e62e797cd8434e74bb7f53efc393
[2/2] pmg-smtp-filter: log-headers: trim trailing whitespace
      commit: 09158948b9568e8123f4319f47ddb10b9a292a78




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-11 11:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11 10:15 [PATCH pmg-api v2 0/2] small improvements for log-header functionality Stoiko Ivanov
2026-06-11 10:15 ` [PATCH pmg-api v2 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
2026-06-11 10:15 ` [PATCH pmg-api v2 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace Stoiko Ivanov
2026-06-11 11:12 ` applied: [PATCH pmg-api v2 0/2] small improvements for log-header functionality Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal