[pmg-devel] [PATCH pmg-api v2 3/4] config: postfix: make smtp-filter-timeout configurable

Stoiko Ivanov s.ivanov at proxmox.com
Fri Jan 12 20:21:50 CET 2024


accessing the value in the config-template needs to use the
item virtual method (`pmg.mail.item('filter-timeout')` instead of the
. operator, due to using kebab-case for 'filter-timeout' see [0].

the minimal value is set to 2 as we add 1 second for the rules
processing in the next patch, and postfix has 1 as minimum.

[0] http://template-toolkit.org/docs/manual/VMethods.html#section_item

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PMG/Config.pm        | 9 +++++++++
 src/templates/main.cf.in | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 7339e0d..43baec5 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -699,6 +699,14 @@ sub properties {
 	    type => 'boolean',
 	    default => 1
 	},
+	'filter-timeout' => {
+	    description => "Timeout for the processing of one mail (in seconds)  (postfix option"
+		." `smtpd_proxy_timeout` and `lmtp_data_done_timeout`)",
+	    type => 'integer',
+	    default => 600,
+	    minimum => 2,
+	    maximum => 86400
+	},
     };
 }
 
@@ -740,6 +748,7 @@ sub options {
 	before_queue_filtering => { optional => 1 },
 	ndr_on_block => { optional => 1 },
 	smtputf8 => { optional => 1 },
+	'filter-timeout' => { optional => 1 },
     };
 }
 
diff --git a/src/templates/main.cf.in b/src/templates/main.cf.in
index 51cdd8b..434d5cd 100644
--- a/src/templates/main.cf.in
+++ b/src/templates/main.cf.in
@@ -50,9 +50,10 @@ default_transport = smtp:[% pmg.mail.smarthost %]:[% pmg.mail.smarthostport %]
 [% END %]
 
 [% IF pmg.mail.before_queue_filtering -%]
-smtpd_proxy_timeout = 600s
+smtpd_proxy_timeout = [% pmg.mail.item('filter-timeout') %]s
 [% ELSE %]
 content_filter=scan:127.0.0.1:10024
+lmtp_data_done_timeout = [% pmg.mail.item('filter-timeout') %]s
 [%- END %]
 
 mail_name = Proxmox
-- 
2.39.2





More information about the pmg-devel mailing list