• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue BUG: minor bug in mailhandler - not reporting STDOUT message

hitd

Basic Pleskian
A long time ago, i wrote some mailhandlers ( check email for viruses using ClamAV and Sophos AV; wrapper for renattach ( a program which renames appended files ) ...
works fine since about Plesk 10

Works still on current Plesk 18 with a minor bug:

See following smtp session:

Code:
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 220 puck983.startdedicated.de ESMTP Postfix (Debian/GNU)
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> EHLO foxtrot452.startdedicated.de
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-puck983.startdedicated.de
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-PIPELINING
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-SIZE 10240000
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-ETRN
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-STARTTLS
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-ENHANCEDSTATUSCODES
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-8BITMIME
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-DSN
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250-SMTPUTF8
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250 CHUNKING
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> MAIL FROM:<[email protected]>
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250 2.1.0 Ok
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> RCPT TO:<[email protected]>
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 250 2.1.5 Ok
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> DATA
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 354 End data with <CR><LF>.<CR><LF>
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> Content-Disposition: inline
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> Content-Transfer-Encoding: 8bit
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> Content-Type: text/plain; charset=utf-8
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> MIME-Version: 1.0
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> X-Mailer: MIME::Lite 3.030 (F2.85; T2.17; A2.20; B3.15; Q3.13)
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> Date: Sat, 8 May 2021 09:34:27 +0200
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> From: [email protected]
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> To: [email protected]
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> Subject: virustest eicar
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> test ohne eicar-virus
MIME::Lite::SMTP=GLOB(0x564b72abadc0)>>> .
MIME::Lite::SMTP=GLOB(0x564b72abadc0)<<< 550 5.7.1 Command rejected
sending failed: Net::CMD (Net::SMTP) DATAEND command failed.
Last server message was:5.7.1 Command rejected

Mailhandler was:

Perl:
#! /usr/bin/perl -wtT
#

use strict;

use warnings;

print STDERR "REJECT\n";
print STDOUT "this should be seen during REJECT\n";

exit 1;

The other side should see "550 5.7.1 Command rejected - this should be seen during REJECT", not a reject without any comment. IIRC this works fine on earlier versions of plesk.

In my case my virushandler is affected, because it rejects the mail as expected, but don't deliver any cause to the other side. It's hard to guess why the mail couldn't be sent for the guys who try to send me a virus they don't know about.

handler is activated by

Bash:
#! /bin/bash
#
# should called with domain.tld as parameter.like
# 
# test-on-script example.com
# ins Verzeichnis wechseln
cd /usr/local/psa/admin/bin

CFG=`echo "$1" | tr "." "_"`

# Mailhandler zuweisen
./mail_handlers_control --add --priority=35 --name=test --mailname=$1 --queue=before-queue --type=recipient-domain --executable=/usr/l
ocal/bin/test --context=/usr/local/etc/test.d/${CFG}.ini

./mail_handlers_control --enable --priority=35 --name=test --mailname=$1 --queue=before-queue --type=recipient-domain --executable=/us
r/local/bin/test --context=/usr/local/etc/test.d/${CFG}.ini



exit 0

PS: of course i've read about the special forum for bugs. a try told me not have permission to view the page with the form.
 
PS: of course i've read about the special forum for bugs. a try told me not have permission to view the page with the form.
Only users with 5 or more helpful posts are allowed to create report there.
 
Just updated my mailhandler for viruses. Because sophos for linux isn't available free in version 9 ( no updated anymore ), i've added support for plesk's own drweb. The limit of 10 mailboxes went away. Of course clamav is working too. People using a payed license of sophos should be able to use this handler too.

But, that's why i post in this old tread, the bug noted about a year ago is still in effect.

The documentation said, that a mailhandler can write a smal message if he reject the mail. Simple example above. So in the SMTP session this caused to inform the user on the other system, why this mail is rejected.

regards peter
 

Attachments

  • hitd-virus-handler-06.tar.gz.zip
    10.3 KB · Views: 2
Back
Top