[pmg-devel] [PATCH pmg-api] pmgpolicy, pmg-smtp-filter: set sensible PATH

Stoiko Ivanov s.ivanov at proxmox.com
Wed Jun 28 17:38:04 CEST 2023


these 2 services are the only ones that don't have this set (the
additions are copied over from pmgproxy)

with bookworm pmgpolicy throws an error (when invoking 'journalctl'
via run_command (in PMG::Utils::scan_journal_for_rbl_rejects)

did not come to a conclusion why it just resurfaced now, and ran fine
in a bullseye environment

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/bin/pmg-smtp-filter | 4 ++++
 src/bin/pmgpolicy       | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/bin/pmg-smtp-filter b/src/bin/pmg-smtp-filter
index 911e9cd..13da635 100755
--- a/src/bin/pmg-smtp-filter
+++ b/src/bin/pmg-smtp-filter
@@ -49,6 +49,10 @@ use PMG::Statistic;
 
 use base qw(Net::Server::PreFork);
 
+$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
+
+delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+
 my $opt_commandline = [$0, @ARGV];
 my $opt_max_dequeue = 1;
 my $opt_dequeue_time = 30;
diff --git a/src/bin/pmgpolicy b/src/bin/pmgpolicy
index f5335de..38c3621 100755
--- a/src/bin/pmgpolicy
+++ b/src/bin/pmgpolicy
@@ -27,6 +27,10 @@ use PMG::ClusterConfig;
 
 use base qw(Net::Server::PreForkSimple);
 
+$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
+
+delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+
 my $greylist_delay = 3*60;            # greylist window
 my $greylist_lifetime = 3600*24*2;    # retry window
 my $greylist_awlifetime = 3600*24*36; # expire window
-- 
2.39.2





More information about the pmg-devel mailing list