Jump to content

Recommended Posts

Posted

Hey ho,

I was playing with my zimbra install last night again, I really need a hobby.

Has anyone used the badword filter from the wiki?

I was having a go at the word filter and Igot as far as the creating the script bit here...

We now need to create and edit the script that ties it all together, probably you can copy it from here. This script was modified from the postfix website. Check that INSPECT_DIR points to your filter directory, SENDMAIL points to your putmail.py program, BADWORDS points to the location of your words file and that MAILADMIN is set to the email address of the administrator.

I can't find where I need to save this, am i missing something or can I just save it anywhere?

 

Thanks

Posted

Thanks webman or should I call you grasshopper :wink:

 

Has anyone else used this filter in there zimbra install?

 

I have completed all the instructions but not sure what to do now.

 

Wondering if the script needs to be run from cron?

Posted
Once you have modified the postfix files, the script should run when any message is sent/received - no need to schedule it or anything like that.
Posted

I'm using it.

The script doesn't need to be run from cron - it should be called from postfix.

There is a /opt/zimbra/postfix/master.cf (or master.cf.in if it exists) file that needs to be edited. (backup this file first)

 

The idea is that the email gets passed out of the postfix process by the master.cf configuration. the email is then filtered and dropped back into postfix by putmail if it passes the badword filter and dropped if it doesn't.

Posted

I must have missed something then as I can't see anywhere that references my script!

I created the script but saved it with a name of filterwords.sh as in the section of the wiki that starts...

 

We now need to create and edit the script that ties it all together, probably you can copy it from here. This script was modified from the postfix website. Check that INSPECT_DIR points to your filter directory, SENDMAIL points to your putmail.py program, BADWORDS points to the location of your words file and that MAILADMIN is set to the email address of the administrator.

!/bin/sh

# Simple shell-based filter. It is meant to be invoked as follows:

#       /path/to/script -f sender recipients...
# Localize these. The -G option does nothing before Postfix 2.3.

 

As it doesn't tell me where to save it and what as, I called it filterwords.sh and saved it it /usr/local/bin.

 

I'm assuming Iv'e messed up again somewhere!

Posted
I must have missed something then as I can't see anywhere that references my script!

 

the master.cf file should reference it

 

disclaimer  unix  -       n       n       -       -       pipe
 flags=Rq user=zimbra argv=/usr/local/sbin/filter -f ${sender} -- ${recipient}

  • Thanks 1
Posted

Thanks for that cybernerd. It did sort of say to do that in the wiki but it was a bit vague.

 

Now I have your attention you couldn't let me know how the heck the badword list works could you?

 

The example is...

\

\

\

\

\

 

You couldn't show me how that should look with a couple of words in it could you?

 

I can't see the logic in it at the moment!

Posted
Thanks for that cybernerd. It did sort of say to do that in the wiki but it was a bit vague.

 

It's a wiki, so it's waiting for you to update it ;)

 

\
\
\

Posted

I'm sure I'm getting closer to getting this to work now!

 

When i send an email out at the moment it gets returned with an error...

 

Command died with status 1: "/usr/local/sbin/filter".
Command output: Error: HOME environment variable not set

 

I can get rid of this error by returning to my original master.cf so I'm not overly worried but it does mean I'm not getting my words filtered!

 

Just wondering if it means HOME not set in the filter file or in the master.cf?

Posted
I'm sure I'm getting closer to getting this to work now!

 

When i send an email out at the moment it gets returned with an error...

 

Command died with status 1: "/usr/local/sbin/filter".
Command output: Error: HOME environment variable not set

 

I can get rid of this error by returning to my original master.cf so I'm not overly worried but it does mean I'm not getting my words filtered!

 

Just wondering if it means HOME not set in the filter file or in the master.cf?

 

I think it may be referring to the putmail.py configuration file.

I have a file called /opt/zimbra/.putmail/putmailrc (the location is defined in the putmail.py script ) it determines where the email ends up if it matches a filter

 

[config]
server = localhost
email = [email protected]
port = 10026

also check perms on that file

  • Thanks 1
Posted
I think it may be referring to the putmail.py configuration file.

I have a file called /opt/zimbra/.putmail/putmailrc (the location is defined in the putmail.py script ) it determines where the email ends up if it matches a filter

 

[config]
server = localhost
email = [email protected]
port = 10026

also check perms on that file

 

I have checked that file and I do have it set up with my settings just like yours.

Could you help with how I check the permissions?

Is that with chmod ?

 

Thanks

Posted
ls -l /opt/zimbra/.putmail/

total 8

-rw-r--r-- 1 zimbra zimbra 183 Feb 6 2007 putmail.log

-rw-r--r-- 1 zimbra zimbra 77 Jun 15 2006 putmailrc

 

 chown zimbra:zimbra /opt/zimbra/.putmail -R

check that the putmail.py script has all the variables set correctly.

  • Thanks 1
Posted

-

rw-r--r-- 1 zimbra zimbra 77 Jun 15 2006 putmailrc

 

Mine had

 

-rw-r--r-- 1 root root 77 Jun 15 2006 putmailrc

 

so I used chown and now it looks like yours.

 

Cheers I'll let you know how this fairs.

Posted
I remember having to make a change of some sort to my putmail.py file. Attached mine with .txt extension, which you should be able to use as a direct replacement for the one you have (but rename to .py)

putmail.txt

  • Thanks 3
Posted

OMG, it works!!!

 

Thanks webman, when I edited my putmail.py by replacing the text with yours it worked!

 

Wow.

 

Once again thanks guys for all the help.

 

One step closer to a decent email server.

:D :D :D :D :D :D :D :D

  • 7 months later...
Posted

Thanks to Cybernerd and Webman for giving me hope! I have moved on from the 'HOME variable unset' message to:

 

Command died with status 1:

"/usr/local/sbin/filter.sh". Command output: Error: the server rejected the

envelope address

 

I have tried checking and changing the email address set in putmail.rc and in putmail.py (although I suspect this one is ignored?)

 

Can any of you help?

Carol

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...