Where do I put an existing exim rules file?

iandouglas736

Verified User
Joined
Nov 12, 2007
Messages
8
I have dozens of rules from an alternate hosting provider for a site that I'm transferring to my new dedicated box, and the file says it's full of exim filters, so I'm ust curious where I'd place this for my virtual domain for exim to pick up on the rules and act accordingly.

Snippet:
# Exim filter

if not first_delivery and error_message then finish endif

if
$h_X-Spam-Status: matches "Yes, score=([1-9][0-9]).([0-9])"
or $header_to: contains "bitbucket"
or $header_to: matches "([a-zA-Z0-9]{4}).([0-9]{3})@mydomain.com"
then
save "/dev/null" 660
endif

I'm just not sure where I'd place that file for DA/Exim to use it for a virtual domain. Having a DA interface to manage this would be nice too, if anyone knows of any that already exist?

[EDIT]

So after poking around, it looks like I'd append these rules to /etc/virtual/mydomain.com/filters but I'm worried that modifying the list of rules within DA will erase what I manually append. I'd appreciate any thoughts on the matter.

Thanks,
Ian
 
Last edited:
So I added some custom rules to /etc/virtual/mydomain.com/filter then logged into DA and sure enough my custom rules didn't show up anywhere (I'm guessing the DA interface uses /etc/virtual/mydomain.com/filter.conf). I made a minor change in DA and sure enough the /etc/virtual/mydomain.com/filter file was rebuilt, and lost my custom changes.
 
So I'm guessing that because of lack of response that there is NO way to add custom exim filtering rules?
 
Hello,

The /etc/virtual/domain.com/filter files are written from templates.
To edit them, just edit the templates.

The 4 template files are:

/usr/local/directadmin/data/templates/filter_base
/usr/local/directadmin/data/templates/filter_delete
/usr/local/directadmin/data/templates/filter_spamfolder
/usr/local/directadmin/data/templates/filter_userspamfolder

The base is the main starting point that all other filters are inserted into.
If you want to do a global change for everyone, the filter_base if the one you want.

delete, spamfolder and userspamfolder are for the redirect options for email when they're tagged as spam. This is a user option so the one you want here depends on the option chosen by the user in his spamassassin settings.

Also, make sure you first copy the one you want to edit to the:
/usr/local/directadmin/data/templates/custom
folder. Failure to do so will result in your changes being overwritten with an update. (Eg, make your changes to the data/templates/custom/filter_base file)

The last step once you've setup your filter templates is to issue a template rewrite for the filters. Type
Code:
echo "action=rewrite&value=filter" >> /usr/local/directadmin/data/task.queue
John
 
Back
Top