Adding Signature based on header?

Paul Hutchings paul.hutchings at
Wed Apr 4 10:57:06 IST 2007


Thanks very much for this!  I have to say it'll probably be several days
before I get chance to read what I need to do to try it out so I may be
back with (dumb) questions, but thank you.


Paul Hutchings
Network Administrator, MIRA Ltd.
Tel: 44 (0)24 7635 5378, Fax: 44 (0)24 7635 8378
mailto:paul.hutchings at

-----Original Message-----
From: mailscanner-bounces at
[mailto:mailscanner-bounces at] On Behalf Of Steve
Sent: 04 April 2007 01:00
To: MailScanner discussion
Subject: Re: Adding Signature based on header?

Hi Dhawal,

Dhawal Doshy wrote:
> Steve Freegard wrote:
>> Hi Dhawal/Paul,
>> Dhawal Doshy wrote:
>>> Paul Hutchings wrote:
>>>> I have MailScanner on a Postfix box.
>>>> I run one instance on Postfix and 2 Postfix listeners, normal SMTP,
>>>> a separate Authenticated SMTP listener.
>>>> I have a Signature rule to only sign email from my internal mail
>>>> servers
>>>> IP address. How would I apply this signature to email sent via the
>>>> Authenticated
>>>> SMTP listener?
>>>> AIUI Postfix adds some sort of "Authenticated User" header, can I
>>>> have a
>>>> From: rule based on that?
>>> MailScanner doesn't support header based rules, however you can
>>> a custom function to do this..  <quoting Ken A>The headers are
>>> available as @{$message->{headers}} in the Message Object, so you
>>> use a Custom Function to get the result of a header check and a
>>> yes/no result for a rule.</quoting Ken A>
>>> Has anyone on the list written a header based custom function that
>>> can be trivially modified for such a purpose?
>> No - but if one of you can mail me some examples - I have some code
>> MailScanner that does something similar that I should be able to
>> modify and put on the Wiki as this would seem to be pretty useful in
>> lot of cases.
> Would this be enough?? See the part "(Authenticated sender:
> dhawal at"
> Return-Path: <dhawal at>
> Received: (qmail 2963 invoked from network); 3 Apr 2007 14:47:12 -0000
> Received: from (
>   by with SMTP; 3 Apr 2007 14:47:12 -0000
> Received: from (
>     (Authenticated sender: dhawal at
>     by (Postfix) with ESMTP id 0934B40109F
>     for <dhawal at>; Tue,  3 Apr 2007 20:15:26
> (IST)
> Message-Id: <20070403144528.0934B40109F at>
> Date: Tue,  3 Apr 2007 20:15:26 +0530 (IST)
> From: dhawal at
> To: undisclosed-recipients:;
> Thanks a ton, Steve..

I've done an initial version which is attached and that I have done some
basic testing with, it takes a list of trusted IPs and the regexps that
should be checked against the headers from the trusted IPs to see if the
connection is authenticated.

Any problems - run set my($debug) = 1; and run MailScanner --debug to
see what it is doing.



Watling Street, Nuneaton, Warwickshire, CV10 0TU, England.

Registered in England No. 402570
VAT Registration  GB 114 5409 96

The contents of this e-mail are confidential and are solely for the use of the intended recipient.
If you receive this e-mail in error, please delete it and notify us either by e-mail, telephone or fax.
You should not copy, forward or otherwise disclose the content of the e-mail as this is prohibited.

More information about the MailScanner mailing list