Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-04-2005, 05:00 AM
Senior Member
 
Posts: 51
Default Rewrote zmtrainsa for DSPAM

I rewrote zmtrainsa to make it a bit more scalable as a training tool for spam filters. My version now grabs the spam or ham messages, and stores them temporarily so more then one spam trainer can take a look at it. Currently I have to split these functions up into two files because of fetchmail's limitations. Right now SA Bayes and DSPAM will be trained. If DSPAM is not installed it will ignore training DSPAM. Also I assumed that dspam was installed in /opt/dspam/bin. If your install is elsewhere change the DSPAMDIR variable in each file. Also, the temp location used is /tmp/sa. That can be changed with the TEMPDIR variable in zmtrainfilter. Run zmtrainsa with its normal usage, zmtrainfilter is really just a support file. Take a look at the files if you need them. The zmtrainsa script now needs zmtrainfilter to run. Although zmtrainfilter doesn't necessarily need zmtrainsa for single file input. I'll comment the code better when I get time. If you have any problems, or don't know why I did something let me know.

-Ben

Download latest fix on the second page of posts.
The files are compressed and attached as zmtrainsa.tgz
Attached Files
File Type: tgz zmtrainsa.tgz (1.7 KB, 270 views)

Last edited by unilogic : 12-06-2005 at 06:49 PM.
Reply With Quote
  #2 (permalink)  
Old 12-05-2005, 06:23 AM
Zimbra Consultant & Moderator
 
Posts: 11,518
Default

Hi

Unfortunately your scripts don't work for me. the first problem is that zmtrainsa doesn't recognise that zmtrainfilter is in the same directory and I've previously had a problem with zmtrainsa that was resolved by a new script from marcmac in this thread zmtrainsa

Although the new zmtrainsa script was for a problem with spaces in folder names your script exhibits the same problem even if the folder has a single name i.e. Junk.
__________________
Regards


Bill
Reply With Quote
  #3 (permalink)  
Old 12-05-2005, 09:35 AM
Senior Member
 
Posts: 51
Default

Try out this fix, it should fix the above problems. Although I have no idea why it can't filter zmtrainfilter, but I did change that around a bit so hopfully it'll work. The folders with spaces problem carried over from the orignal zmtrainsa that came with M2. Sorry about that. Let me know if it still doesn't work.

Ben
Attached Files
File Type: tgz zmtrainsa.tgz (1.8 KB, 283 views)
Reply With Quote
  #4 (permalink)  
Old 12-05-2005, 11:26 AM
Zimbra Consultant & Moderator
 
Posts: 11,518
Default

Tried that fix and it now finds the zmtrainfilter but gives the following error:

Code:
$ zmtrainsa server user password spam junk
/opt/zimbra/bin/zmtrainsa: line 70: /opt/zimbra/.fetchmailrc: No such file or directory
chmod: cannot access `/opt/zimbra/.fetchmailrc': No such file or directory
Enter password for bpye@chinook:
fetchmail: lock creation failed.

Syncing SA bayes database

Cleaning up DSpam, this may take a while
dspam_clean starting
PROCESSING USER: zimbra
Processing sigs; age: 14
Signature: 438f67a5116903652140007
    Created: Thu Dec  1 00:00:00 2005

Signature: 438f67a5116911847784999
    Created: Thu Dec  1 00:00:00 2005

...... plus a lot more of the above messages.......
I did enter the correct user password when asked.
__________________
Regards


Bill
Reply With Quote
  #5 (permalink)  
Old 12-05-2005, 02:38 PM
Senior Member
 
Posts: 51
Default

Ah yes, the problem is that its trying to create a file as the zimbra user in the /opt/zimbra folder which zimbra actually has no rights to. So I can either put the .fetchmailrc file in a different place say $TMPDIR or you can chown zimbra:zimbra to /opt/zimbra. Sorry about these mistakes. I've done alot to my install so alot of things aren't at default anymore and I overlook them. I've attached the fixed scripts. Let me know if you have any problems.

-Ben
Attached Files
File Type: tgz zmtrainsa.tgz (1.8 KB, 280 views)
Reply With Quote
  #6 (permalink)  
Old 12-06-2005, 04:38 AM
Zimbra Consultant & Moderator
 
Posts: 11,518
Default

Hi

I'm not sure if you wanted me to make any changes for this test but I ran it 'as is' and got these results:

Code:
rm: cannot get current directory: Permission denied
mkdir: cannot create directory `/tmp/sa': File exists
fetchmail: lock creation failed.

Syncing SA bayes database

Cleaning up DSpam, this may take a while
dspam_clean starting
PROCESSING USER: zimbra
Processing sigs; age: 14
Signature: 438f67a5116903652140007
    Created: Thu Dec  1 00:00:00 2005

.................. lots more of the above and then this 

Processing probabilities; age: 0
Processing unused; any: 90 quota: 30 nospam: 15 onehit: 15

Cleaning up temp files
rm: cannot get current directory: Permission denied
Done!
Thanks for your effort with this.
__________________
Regards


Bill
Reply With Quote
  #7 (permalink)  
Old 12-06-2005, 06:36 AM
Senior Member
 
Posts: 51
Default

You've run the script as another user then zimbra at some point and its left /tmp/sa. Simply remove that directory manually and all should work. I'll write into the script later today checking that you have permissions for $TMPDIR and throwing an error if you don't. Thanks for being my beta test

-Ben
Reply With Quote
  #8 (permalink)  
Old 12-06-2005, 07:35 AM
Zimbra Consultant & Moderator
 
Posts: 11,518
Default

I don't think I've run this as anything other than the zimbra user, the /tmp/sa file was still there with zimbra as the owner/group so I deleted it and ran the test again. This is the results I got this time:

Code:
fetchmail: lock creation failed.

Syncing SA bayes database
bayes: synced databases from journal in 2 seconds: 237 unique entries (531 total entries)

Cleaning up DSpam, this may take a while
dspam_clean starting
PROCESSING USER: zimbra
Processing sigs; age: 14
Signature: 438f67a5116903652140007
    Created: Thu Dec  1 00:00:00 2005

----- lots more of the above

Signature: 4395997a87243611876707
    Created: Tue Dec  6 00:00:00 2005

Processing probabilities; age: 0
Processing unused; any: 90 quota: 30 nospam: 15 onehit: 15

Cleaning up temp files
rm: cannot get current directory: Permission denied
Done!
The /tmp/sa directory also still exists and the owner/group is zimbra.
__________________
Regards


Bill

Last edited by phoenix : 12-06-2005 at 07:43 AM.
Reply With Quote
  #9 (permalink)  
Old 12-06-2005, 11:37 AM
Senior Member
 
Posts: 51
Default

Give this a try. I think what was happening by chance did you su to zimbra, and you ran zmtrainsa. But the current working directory you are still in zimbra doesn't have rights to. I made the scripts change to zimbra's home dir so give it a try. Also a 6th option of where you want the temp directory to be was added. Note: it will run without this option being supplied.

-Ben
Attached Files
File Type: tgz zmtrainsa.tgz (2.0 KB, 252 views)
Reply With Quote
  #10 (permalink)  
Old 12-06-2005, 12:04 PM
Zimbra Consultant & Moderator
 
Posts: 11,518
Default

Yes, you're correct I was in a different directory when I ran your zmtrainsa. I wasn't bothering to change as the original zmtrainsa worked. OK, new run and another error I'm afraid:

Code:
not found using default location /tmp/sa
fetchmail: lock creation failed.

Syncing SA bayes database

Cleaning up DSpam, this may take a while
dspam_clean starting
PROCESSING USER: zimbra
Processing sigs; age: 14
Signature: 438f67a5116903652140007
    Created: Thu Dec  1 00:00:00 2005
--------------------
Processing probabilities; age: 0
Processing unused; any: 90 quota: 30 nospam: 15 onehit: 15

Cleaning up temp files
Done!
__________________
Regards


Bill
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0