Disclaimer problem
Plant, Dean
dean.plant at ROKE.CO.UK
Mon Jun 2 13:58:08 IST 2003
I have upgraded to v4.21-9 but mail still goes out without being signed when I have an attachment but no message body text.
Below is shows the header of a mail which is not signed
Return-Path: <dean.plant at roke.co.uk>
Received: from rsys000x.roke.co.uk (193.118.201.103) by mk-cpfrontend.uk.tiscali.com (6.7.018)
id 3ED7738504402501 for dean_plant at lineone.net; Mon, 2 Jun 2003 13:41:01 +0100
Received: from rsys002a.roke.co.uk (rsys002a.roke.co.uk [193.118.192.251])
by rsys000x.roke.co.uk (8.12.8/8.12.8) with ESMTP id h52CjOQ5004085
for <dean_plant at lineone.net>; Mon, 2 Jun 2003 13:45:24 +0100
Received: by rsys002a.roke.co.uk with Internet Mail Service (5.5.2653.19)
id <M1DA9L4Z>; Mon, 2 Jun 2003 13:44:16 +0100
Message-ID: <76C92FBBFB58D411AE760090271ED41805B33A33 at rsys002a.roke.co.uk>
From: "Plant, Dean" <dean.plant at roke.co.uk>
To: "Dean Plant Lineone (E-mail)" <dean_plant at lineone.net>
Subject:
Date: Mon, 2 Jun 2003 13:44:15 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: image/jpeg;
name="fluorescence6.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="fluorescence6.jpg"
X-MailScanner: Found to be clean
And this header shows mail which is correctly signed.
Return-Path: <dean.plant at roke.co.uk>
Received: from rsys000x.roke.co.uk (193.118.201.103) by mk-cpfrontend.uk.tiscali.com (6.7.018)
id 3ED765CA042FB1B4 for dean_plant at lineone.net; Mon, 2 Jun 2003 13:00:51 +0100
Received: from rsys002a.roke.co.uk (rsys002a.roke.co.uk [193.118.192.251])
by rsys000x.roke.co.uk (8.12.8/8.12.8) with ESMTP id h52C5sO9003378
for <dean_plant at lineone.net>; Mon, 2 Jun 2003 13:05:54 +0100
Received: by rsys002a.roke.co.uk with Internet Mail Service (5.5.2653.19)
id <M1DA9LSG>; Mon, 2 Jun 2003 13:04:47 +0100
Message-ID: <76C92FBBFB58D411AE760090271ED41805B33A31 at rsys002a.roke.co.uk>
From: "Plant, Dean" <dean.plant at roke.co.uk>
To: "Dean Plant Lineone (E-mail)" <dean_plant at lineone.net>
Subject:
Date: Mon, 2 Jun 2003 13:04:47 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: multipart/mixed;
boundary="----_=_NextPart_000_01C328FF.28639AF6"
X-MailScanner: Found to be clean
-----Original Message-----
From: Julian Field [mailto:mailscanner at ECS.SOTON.AC.UK]
Sent: 30 May 2003 09:32
To: MAILSCANNER at JISCMAIL.AC.UK
Subject: Re: Disclaimer problem
At 08:39 30/05/2003, you wrote:
>Hello,
>
>I am currently evaluating MailScanner and have come across a small problem
>regarding signing of mail. I have added a disclaimer to all out going mail
>using a ruleset but have noticed that any mail that has an attachment but
>does not have any body text does not get signed. All other mail is signed
>correctly.
>
>I have upgraded to the latest version and started with an new
>MailScanner.conf but the problem persists.
>
>I am using Redhat8/Sendmail/F-prot.
>
>Does anyone have any idea's as to what I may be doing wrong.
>
>Thanks in advance.
>
>Dean Plant
Try applying this patch to /usr/lib/MailScanner/MailScanner/Message.pm.
Read the man page for the "patch" command if you don't know how to drive
it, saves you doing it by hand :)
It appears to work okay for me, and will be in the next stable release (due
this weekend).
--- Message.pm 2003-05-30 09:09:21.000000000 +0100
+++ Message.pm.new2 2003-05-30 09:24:43.000000000 +0100
@@ -1447,6 +1447,7 @@
# If multipart, try to sign our first part
if ($top->is_multipart) {
+ my $sigcounter = 0;
# JKF Signed and encrypted multiparts must not be touched.
# JKF Instead put the sig in the epilogue. Breaks the RFC
# JKF but in a harmless way.
@@ -1456,18 +1457,33 @@
@signature = map { "$_\n" } split(/\n/, $signature);
unshift @signature, "\n";
$top->epilogue(\@signature);
- return;
+ return 1;
}
- $this->SignCleanEntity($top->parts(0));
- $this->SignCleanEntity($top->parts(1))
+ $sigcounter += $this->SignCleanEntity($top->parts(0));
+ $sigcounter += $this->SignCleanEntity($top->parts(1))
if $top->head and $top->effective_type =~ /multipart\/alternative/i;
- return;
+
+ if ($sigcounter == 0) {
+ # If we haven't signed anything by now, it must be a multipart
+ # message containing only things we can't sign. So add a text/plain
+ # section on the front and sign that.
+ my $text = $this->ReadVirusWarning('inlinetextsig') . "\n\n";
+ my $newpart = build MIME::Entity
+ Type => 'text/plain',
+ Disposition => 'inline',
+ Data => $text,
+ Encoding => 'quoted-printable',
+ Top => 0;
+ $top->add_part($newpart, 0);
+ $sigcounter = 1;
+ }
+ return $sigcounter;
}
$MimeType = $top->head->mime_type if $top->head;
- return unless $MimeType =~ m{text/}i; # Won't sign non-text message.
+ return 0 unless $MimeType =~ m{text/}i; # Won't sign non-text message.
# Won't sign attachments.
- return if $top->head->mime_attr('content-disposition') =~ /attachment/i;
+ return 0 if $top->head->mime_attr('content-disposition') =~ /attachment/i;
# Get body data as array of newline-terminated lines
$top->bodyhandle or return undef;
@@ -1489,6 +1505,9 @@
$io->print("\n$signature\n");
}
$io->close;
+
+ # We signed something
+ return 1;
}
--
Julian Field
www.MailScanner.info
MailScanner thanks transtec Computers for their support
-------------- next part --------------
Registered Office: Roke Manor Research Ltd, Siemens House, Oldbury, Bracknell,
Berkshire. RG12 8FZ
The information contained in this e-mail and any attachments is confidential to Roke
Manor Research Ltd and must not be passed to any third party without permission. This
communication is for information only and shall not create or change any contractual
relationship.
More information about the MailScanner
mailing list