SpamCheck report

Julian Field MailScanner at ecs.soton.ac.uk
Fri Jun 1 10:34:59 IST 2007


It doesn't matter what you call your Custom Function, just call it 
whatever you put in the MailScanner.conf line, so

Spam Checks = &MyCustFunc

is just fine, your Custom Function is called MyCustFunc.
You don't normally need any parameters to the Custom Function.
The result of the Function is the value you want to supply to that 
configuration option, with one exception:
Instead of returning no or yes, you should return 0 or 1.
Other than that you return the value you want that config option to have.

Just like a ruleset applies tests to the from+to addresses of the 
message to work out the value, a Custom Function runs a bit of your code 
to work out the value.

Jason Ede wrote:
>
> Cheers,
>
>  
>
> I can't seem to make this work... Suspect I'm not calling it right...
>
>  
>
> Assuming I've renamed functions in the routine from VirusScanning to 
> SpamChecks
>
>  
>
> I call it via
>
>  
>
> Spam Checks = &SpamChecks
>
>  
>
> I get this in my logs...
>
> Jun  1 08:44:54 server02 MailScanner[19947]: Config: calling custom 
> init function SpamChecks
>
> Jun  1 08:44:54 server02 MailScanner[19947]: Syntax error in line 1, 
> value "" for spamchecks is not one of allowed values "yes","no"
>
>  
>
> So I assumed that the command line had to have the ruleset name 
> following it so I tried
>
>  
>
> Spam Checks = &SpamChecks %rules-dir%/scan-spam.rules
>
>  
>
> (tried both with and without "" enclosing rule)
>
>  
>
> I then get...
>
>  
>
> Jun  1 08:48:08 server02 MailScanner[20134]: Config: calling custom 
> init function MailWatchLogging
>
> Jun  1 08:48:08 server02 MailScanner[20134]: Started SQL Logging child
>
> Jun  1 08:48:08 server02 MailScanner[20134]: User's home directory 
> /var/spool/postfix is not writable
>
> Jun  1 08:48:08 server02 MailScanner[20134]: You need to set the 
> "SpamAssassin User State Dir" to a directory that the "Run As User" 
> can write to
>
> Jun  1 08:48:09 server02 MailScanner[20134]: Using SpamAssassin 
> results cache
>
> Jun  1 08:48:09 server02 MailScanner[20134]: Connected to SpamAssassin 
> cache database
>
> Jun  1 08:48:09 server02 MailScanner[20134]: Enabling SpamAssassin 
> auto-whitelist functionality...
>
>  
>
> And mailscanner restarts every few seconds... (SpamAssassin User State 
> Dir is set and has been fine till now!)
>
>  
>
> What am I missing?
>
>  
>
> Jason
>
>  
>
>  
>
> *From:* mailscanner-bounces at lists.mailscanner.info 
> [mailto:mailscanner-bounces at lists.mailscanner.info] *On Behalf Of 
> *Julian Field
> *Sent:* 31 May 2007 17:47
> *To:* MailScanner discussion
> *Subject:* Re: SpamCheck report
>
>  
>
>
>
> Jason Ede wrote:
>
> X-BHL-MailScanner- Spamcheck: Authenticated
> X-BHL-MailScanner-Information: Please contact the ISP for more information
> X-BHL-MailScanner: Found to be clean
> X-BHL-MailScanner-SpamCheck: 
> X-BHL-MailScanner-From: j.ede at birchenallhowden.co.uk <mailto:j.ede at birchenallhowden.co.uk>
> X-Spam-Status: No
>  
> Ok, I've found the custom ruleset from function file... I think I can see roughly what's going on, but I've a couple of questions...
>  
> The $option is the external name of the config option... I can't seem to work out what this should be... (I'm using the custom function on the 'Spam Checks' config option, but that doesn't comply with what $option should be
>  
> How do I then specify what ruleset is then used?
>   
>
> The External name is the same as the MailScanner.conf name but with 
> all in lowercase, with all spaces and punctuation removed, so in your 
> case it's just "spamchecks".
>
>  
> Jason
>  
>   
>
>     -----Original Message-----
>
>     From: mailscanner-bounces at lists.mailscanner.info <mailto:mailscanner-bounces at lists.mailscanner.info> [mailto:mailscanner-
>
>     bounces at lists.mailscanner.info <mailto:bounces at lists.mailscanner.info>] On Behalf Of Julian Field
>
>     Sent: 28 May 2007 12:32
>
>     To: MailScanner discussion
>
>     Subject: Re: SpamCheck report
>
>      
>
>      
>
>      
>
>     Jason Ede wrote:
>
>         
>
>         Hmmm.... Simple, but neat :-)
>
>          
>
>         Can you use a custom function and a ruleset at the same time?
>
>               
>
>     Yes. Take a look in the example in the
>
>     /usr/lib/MailScanner/MailScanner/CustomFunctions directory.
>
>         
>
>         i.e. using the authenticated header check along with an ordinary
>
>         ruleset containing a list of whitelisted addresses?
>
>          
>
>         Jason
>
>          
>
>         ---------------------------------------------------------------------
>
>               
>
>     ---
>
>         
>
>         *From:* mailscanner-bounces at lists.mailscanner.info <mailto:mailscanner-bounces at lists.mailscanner.info> on behalf of
>
>               
>
>     Pascal
>
>         
>
>         Maes
>
>         *Sent:* Sun 27/05/2007 19:26
>
>         *To:* MailScanner discussion
>
>         *Subject:* Re: SpamCheck report
>
>          
>
>          
>
>         Le 27 mai 07 à 15:51, Jason Ede a écrit :
>
>          
>
>               
>
>             Hi,
>
>              
>
>             I don't suppose you'd be willing to share that custom function?
>
>                     
>
>     We'd
>
>         
>
>             like to do the same, but the only way I can see to do that so far
>
>             is to
>
>             have postfix include the SASL login username in the header which
>
>                     
>
>     I'm
>
>         
>
>             loathe to do if I can really avoid it.
>
>              
>
>             Jason
>
>                     
>
>          
>
>         Why not ?
>
>         The first idea comes from the list so I could post it again.
>
>         But first, thanks to Julian for his quick answer.
>
>          
>
>         ------8<------8<------8<------8<------8<------8<------8<------8<-----
>
>               
>
>     -8<
>
>         
>
>         ------8<------
>
>          
>
>         package MailScanner::CustomConfig;
>
>          
>
>         use strict 'vars';
>
>         use strict 'refs';
>
>         no  strict 'subs'; # Allow bare words for parameter %'s
>
>          
>
>         use vars qw($VERSION);
>
>          
>
>         ### The package version, both in 1.23 style *and* usable by
>
>               
>
>     MakeMaker:
>
>         
>
>         $VERSION = substr q$Revision: 2331 $, 10;
>
>          
>
>         sub InitCheckSMTPAuth
>
>         {
>
>             # Empty
>
>         }
>
>          
>
>         sub EndCheckSMTPAuth
>
>         {
>
>             # Empty
>
>         }
>
>          
>
>         sub CheckSMTPAuth
>
>         {
>
>             my ($message) = @_;
>
>             return 1 unless $message;
>
>          
>
>             foreach (@{$message->{headers}})
>
>             {
>
>                  if (/PUT HERE THE STRING ABOUT THE AUTHENTICATION/)
>
>                  {
>
>                      MailScanner::Log::InfoLog("Message %s from (%s) is
>
>         authenticated ($1)", $message->{id}, $message->{
>
>         fromuser});
>
>                      $global::MS->{mta}->AddHeader($message, 'X-MailScanner-
>
>         Spamcheck:', 'Authenticated');
>
>                      return 0;
>
>                  }
>
>              }
>
>              return 1;
>
>         }
>
>          
>
>         1;
>
>          
>
>         ------8<------8<------8<------8<------8<------8<------8<------8<-----
>
>               
>
>     -8<
>
>         
>
>         ------8<------
>
>          
>
>          
>
>         --
>
>         Pascal
>
>          
>
>         --
>
>         MailScanner mailing list
>
>         mailscanner at lists.mailscanner.info <mailto:mailscanner at lists.mailscanner.info>
>
>         http://lists.mailscanner.info/mailman/listinfo/mailscanner
>
>          
>
>         Before posting, read http://wiki.mailscanner.info/posting
>
>          
>
>         Support MailScanner development - buy the book off the website!
>
>          
>
>          
>
>         -----------------------------------------------------------
>
>         The information in this e-mail and any attachments is confidential.
>
>               
>
>     It
>
>         
>
>         is intended solely for the attention and use of the named
>
>         addressee(s). If you are not the intended recipient, or person
>
>         responsible for delivering this information to the intended
>
>               
>
>     recipient,
>
>         
>
>         please notify the sender or email postmaster at birchenallhowden.co.uk <mailto:postmaster at birchenallhowden.co.uk>
>
>         and delete it from your computer systems. Unless you are the intended
>
>         recipient or his/her representative you are not authorised to, and
>
>         must not, read, copy, distribute, use or retain this message or any
>
>         part of it. All messages are scanned by Mailscanner and are believed
>
>         to be clean. Recipients are advised to apply their own virus checks
>
>               
>
>     to
>
>         
>
>         any message on delivery. No liability is accepted by BirchenallHowden
>
>         Ltd for any losses caused by viruses contracted during transit over
>
>         the internet or present in any receiving system. BirchenallHowden
>
>               
>
>     Ltd,
>
>         
>
>         233 Edmund Road, Sheffield S2 4EL.
>
>         ----- *BirchenallHowden* <http://www.birchenallhowden.co.uk/>
>
>               
>
>     Jules
>
>      
>
>     --
>
>     Julian Field MEng CITP
>
>     www.MailScanner.info <http://www.MailScanner.info>
>
>     Buy the MailScanner book at www.MailScanner.info/store <http://www.MailScanner.info/store>
>
>      
>
>     MailScanner customisation, or any advanced system administration help?
>
>     Contact me at Jules at Jules.FM <mailto:Jules at Jules.FM>
>
>      
>
>     PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
>
>     For all your IT requirements visit www.transtec.co.uk <http://www.transtec.co.uk>
>
>      
>
>      
>
>      
>
>      
>
>     --
>
>     This message has been scanned for viruses and
>
>     dangerous content by MailScanner, and is
>
>     believed to be clean.
>
>     For all your IT requirements visit www.transtec.co.uk <http://www.transtec.co.uk>
>
>      
>
>     --
>
>     MailScanner mailing list
>
>     mailscanner at lists.mailscanner.info <mailto:mailscanner at lists.mailscanner.info>
>
>     http://lists.mailscanner.info/mailman/listinfo/mailscanner
>
>      
>
>     Before posting, read http://wiki.mailscanner.info/posting
>
>      
>
>     Support MailScanner development - buy the book off the website!
>
>         
>
>  
> -----------------------------------------------------------
> The information in this e-mail and any attachments is confidential. It is intended solely for the attention and use of the named addressee(s). If you are not the intended recipient, or person responsible for delivering this information to the intended recipient, please notify the sender or email postmaster at birchenallhowden.co.uk <mailto:postmaster at birchenallhowden.co.uk> and delete it from your computer systems. Unless you are the intended recipient or his/her representative you are not authorised to, and must not, read, copy, distribute, use or retain this message or any part of it. All messages are scanned by Mailscanner and are believed to be clean. Recipients are advised to apply their own virus checks to any message on delivery. No liability is accepted by BirchenallHowden Ltd for any losses caused by viruses contracted during transit over the internet or present in any receiving system. BirchenallHowden Ltd, 233 Edmund Road, 
> Sheffield, S2 4EL
>  
>  
>   
>
>
>
> Jules
>  
> -- 
> Julian Field MEng CITP
> www.MailScanner.info <http://www.MailScanner.info>
> Buy the MailScanner book at www.MailScanner.info/store <http://www.MailScanner.info/store>
>  
> MailScanner customisation, or any advanced system administration help?
> Contact me at Jules at Jules.FM <mailto:Jules at Jules.FM>
>  
> PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
> For all your IT requirements visit www.transtec.co.uk <http://www.transtec.co.uk>
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
> For all you IT requirements visit transtec Computers 
> <http://www.transtec.co.uk/>.
>
>
> -----------------------------------------------------------
> The information in this e-mail and any attachments is confidential. It 
> is intended solely for the attention and use of the named 
> addressee(s). If you are not the intended recipient, or person 
> responsible for delivering this information to the intended recipient, 
> please notify the sender or email postmaster at birchenallhowden.co.uk 
> and delete it from your computer systems. Unless you are the intended 
> recipient or his/her representative you are not authorised to, and 
> must not, read, copy, distribute, use or retain this message or any 
> part of it. All messages are scanned by Mailscanner and are believed 
> to be clean. Recipients are advised to apply their own virus checks to 
> any message on delivery. No liability is accepted by BirchenallHowden 
> Ltd for any losses caused by viruses contracted during transit over 
> the internet or present in any receiving system. BirchenallHowden Ltd, 
> 233 Edmund Road, Sheffield S2 4EL.
> ----- *BirchenallHowden* <http://www.birchenallhowden.co.uk/> 

Jules

-- 
Julian Field MEng CITP
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store

MailScanner customisation, or any advanced system administration help?
Contact me at Jules at Jules.FM

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
For all your IT requirements visit www.transtec.co.uk


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
For all your IT requirements visit www.transtec.co.uk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20070601/1b326e2a/attachment-0001.html


More information about the MailScanner mailing list