From 2cad90243ce03cd2cda7ea9e123b418553e57131 Mon Sep 17 00:00:00 2001 From: Andrey Igoshin Date: Sun, 6 May 2018 19:56:25 +0300 Subject: [PATCH] adding MTA hostname --- utils/cgp_rspamd.pl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/utils/cgp_rspamd.pl b/utils/cgp_rspamd.pl index 5a4bd109a..b1d30b905 100644 --- a/utils/cgp_rspamd.pl +++ b/utils/cgp_rspamd.pl @@ -33,11 +33,22 @@ GetOptions( pod2usage(1) if $help; pod2usage( -exitval => 0, -verbose => 2 ) if $man; +my $main_domain = cgp_main_domain(); my $scanned = 0; # Turn off bufferization as required by CGP $| = 1; +sub cgp_main_domain { + if ( open(my $fh, 'Settings/Main.settings') ) { + while (<$fh>) { + if ( /^\s+DomainName\s+=\s+([^;]+);/ ) { + return $1; + } + } + } +} + sub cgp_string { my ($in) = @_; @@ -232,10 +243,12 @@ sub rspamd_scan { if ($ip) { $headers->{IP} = $ip; } - if ($user) { $headers->{User} = $user; } + if ($main_domain) { + $headers->{'MTA-Tag'} = $main_domain; + } http_post( "http://$rspamd_host/checkv2", $data, -- 2.39.5