Where to edit the template for $header_subject condition in filter file

lonea

Verified User
Joined
Jan 3, 2009
Messages
45
Currently the default template contains the following

$header_subject: contains "****" or $message_headers contains "****" or $header_from: contains "****"
or $header_subject: contains "****" or $message_headers contains "****" or $header_from: contains "****"
or $header_subject: contains " ass " or $message_headers contains " ass " or $header_from: contains " ass "
or $header_subject: contains "asshole" or $message_headers contains "asshole" or $header_from: contains "asshole"
or $header_subject: contains "bitch" or $message_headers contains "bitch" or $header_from: contains "bitch"
or $header_subject: contains " **** " or $message_headers contains " **** " or $header_from: contains " **** "
or $header_subject: contains " whore " or $message_headers contains " whore " or $header_from: contains " whore "
or $header_subject: contains " sex " or $message_headers contains " sex " or $header_from: contains " sex "
or $header_subject: contains " sexy " or $message_headers contains " sexy " or $header_from: contains " sexy "
or $header_subject: contains " sexiest " or $message_headers contains " sexiest " or $header_from: contains " sexiest "
or $header_subject: contains " **** " or $message_headers contains " **** " or $header_from: contains " **** "
or $header_subject: contains " ****ty " or $message_headers contains " ****ty " or $header_from: contains " ****ty "


How do I add/remove/edit this template ? Can't find a relative find in /usr/local/directadmin/data/templates/

TIA
 
I just checked; the /etc/system_filter.exim file is NOT where you're getting these. You're getting them in the /etc/virtual/DOMAIN.NAME/filter file (where DOMAIN.NAME) is the domain name in question. The reason you're getting them is that you've got Enable adult filter enabled at the domain level. Disabling the adult filter there will remove these. I don't think there are templates for the user-level filters; hopefully John from DirectAdmin will respond and let us know.

Jeff
 
How do I add/remove/edit this template ? Can't find a relative find in /usr/local/directadmin/data/templates/

TIA

Hello,

I'd rather say, it's hardcoded into directadmin binary, so you can not edit it directly. Use POST/PRE custom scripts to achieve the desired, or submit a feature request.
 
Alex, I think we were posting at the same time. Read my post carefully and you'll see how it seems to work.

It appears there is a master template for the file in the main /usr/local/directadmin/data/templates directory, but not for the user level files. And the user level files are where those filters are coming from.

It can easily be edited from the DirectAdmin user level login.

Jeff
 
Jeff, yes it seems we were posting at the same time. My post is answering only that one part of the question, which asks about modifying a template. The other part is good answered by you.
 
Hello,

The file:
/etc/virtual/domain.com/filter

is generated based on the data from the file /etc/virtual/domain.com/filter.conf, using the templates:
/usr/local/directadmin/data/templates/filter_*

Note that the main file you'd want to look at for word filters would be filter_base.
However, many of the tokens are indeed filled via values created internally in DA.

Looking at the code, no "username" is assigned to the tokenizer for that spot, so you won't be able to run |*/bin/sh| type scripting in these particular templates.
You will be able to use if-then-else style, but the token values are not likely going to be in a comparison sort of state.

John
 
I'm sorry I'm adding to an old thread, but there should be a way to change this behavior. Let me explain:

I have a client receiving email tagged with some "X-Brightmail-Tracker" line in message headers. This header in containing some encrypted text, usable by the sender (I assume), and the encrypted text may sometime contain one of the famous 4 letter words filtered out by the Adult filters. Still, they want this adult filter to reject mail coming from forged addresses, or the subject contening these words. But why is DirectAdmin's exim looking at all the headers? At the very least, there should be a space in front of those words in the generated filter file, as a minimum attempt to filter out false positives.

How can I change the generated lines to look like:
if $header_subject: contains "****" or $header_from: contains "****" ...

instead of (bold part removed above)
if $header_subject: contains "****" or $message_headers contains "****" or $header_from: contains "****" ...

The quick solution is obviously to disable the adult filters, but this should be filed as a bug (or at least as a future enhancement) in my opinion.

Thanks

-- Pierre
 
Last edited:
Back
Top