setup filetype and filename rules per domain

Gordon Colyn gordon at itnt.co.za
Mon Aug 7 19:49:56 IST 2006


Thanks!

----- Original Message ----- 
From: "Julian Field" <mailscanner at ecs.soton.ac.uk>
To: "MailScanner discussion" <mailscanner at lists.mailscanner.info>
Sent: Monday, August 07, 2006 6:58 PM
Subject: Re: setup filetype and filename rules per domain


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Stephen Swaney wrote:
>> -----Original Message-----
>> From: mailscanner-bounces at lists.mailscanner.info [mailto:mailscanner-
>> bounces at lists.mailscanner.info] On Behalf Of Gordon Colyn
>> Sent: Monday, August 07, 2006 11:41 AM
>> To: mailscanner at lists.mailscanner.info
>> Subject: setup filetype and filename rules per domain
>>
>> ITNT Banner CampaignIs there a way to setup filetype and filename rules
>> per
>> domain or user?
>>
>> I have some client domains and users that want to accept .mp3 and .wav
>> files
>> and others that don't
>>
>> Thanks
>> Gordon Colyn

In recent versions (version 4.49 and onwards) there are some new
configuration settings,
Allow Filenames
Deny Filenames
Allow Filetypes
Deny Filetypes
These are not as flexible as the filename.rules.conf and
filetype.rules.conf files, but you may find them easier to use and good
enough for your requirements.

For an example, let's say that domain xyz.com wants to be able to email
files called "*.mp3" and "*.wav". You would still need to do similar
setups to stop the "filetype.rules.conf" file trapping movies in
general. But let's keep it simple for this example.

1) We need to tell MailScanner to create a ruleset for "Allow Filenames"
so we can vary the value of this setting depending on where the mail is
going to.
In MailScanner.conf, set
Allow Filenames = %rules-dir%/allow.filenames.rules

2) Create the ruleset. This just needs to allow *.mp3 and *.wav for mail
going to anyone at xyz.com.
In /etc/MailScanner/rules/allow.filenames.rules, put
To: xyz.com \.mov$ \.mp3$

Note that the text to the right of "xyz.com" is a space-separated list
of regular expressions. You need to put the "\" before the "." as
otherwise "." would just match any character, not just the actual "full
stop" character. "$" matches the "end of line", ensuring that the ".mov"
appears at the end of the filename.

3) Run the command "service MailScanner restart" to enable all of this.

That's it!

- ------------------------

Note for advanced users:
The order of checking all of these settings is
Allow Filenames
Deny Filenames
filename.rules.conf
The first rule that matches is the result used.

- ------------------------


> You need to create a rule sets that uses different filename/filetype
> configuration files for mail from different domains for attachment 
> filename
> and filetype checking. If you have a Red Hat, CentOS or SuSE system, the
> following paths will be correct. They will vary on other systems but the
> same principals will work.
>
> First create two files:
>
> /etc/MailScanner/filename.rules.xyz.conf
> /etc/MailScanner/filetype.rules.xyz.conf
>
> Copy these existing files to create the new files:
>
> cp /etc/MailScanner/filename.rules.conf \
>         /etc/MailScanner/filename.rules.xyz.conf
>
> cp /etc/MailScanner/filenatype.rules.conf \
>         /etc/MailScanner/filename.rules.xyz.conf
>
> Then edit both the new files to allow or deny the files for xyz.domain
>
> Then create the file /etc/MailScanner/rules/filename.rules. The contents 
> of
> this file should be:
>
> # Allow certain filenames from xyz.com
> From:    /\*@xyz\.com/      /etc/MailScanner/filename.rules.xyz.conf
> # Default entry
> FromOrTo:       default         /etc/MailScanner/filename.rules.conf
>
> Then create the file /etc/MailScanner/rules/filetype.rules. The contents 
> of
> this file should be:
>
> # Allow certain filetypes from xyz.com
> From:    /\*@xyz\.com/      /etc/MailScanner/filetype.rules.xyz.conf
> # Default entry
> FromOrTo:       default         /etc/MailScanner/filename.rules.conf
>
> Then edit /etc/MailScanner.conf to call the new rulesets. Change the 
> setting
> for Filename Rules to be:
>
> Filename Rules = %rules-dir%/filename.rules
>
> And change the setting for Filetype Rules to be:
>
> Filetype Rules = %rules-dir%/filetype.rules
>
> Then reload MailScanner.
>
> I hope this helps,
>
> Steve
>
> Stephen Swaney
> Fort Systems Ltd.
> stephen.swaney at fsl.com
> www.fsl.com
>

- -- 
Julian Field
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 MailScanner.biz

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Get your PCs and servers from Transtec.de, very well built and reliable!

-----BEGIN PGP SIGNATURE-----
Version: PGP SDK 3.7.0
Charset: ISO-8859-1

wj8DBQFE13FZEfZZRxQVtlQRAjI/AJ9QL/Glz1wAkjODkfnQ3DQoD/NY9QCfU6xt
SzbgyRdd3lhVIdpvR9r0d3g=
=lg1E
-----END PGP SIGNATURE-----

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

-- 
MailScanner mailing list
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!



More information about the MailScanner mailing list