Adding RAZOR reporting functionality to GUI quarantine area

I made the following changes, so that when I do a 'delete all' in my quarantine area, all of the emails are reported to RAZOR as spam just before they are deleted. This could be expanded with seperate buttons for razor reporting along the same lines as the 'delete all', 'delete checked' etc

Code Changes

dspam.cgi in the Quarantine_DeleteSpam() function just before:

open(FILE, "<$USER.mbox.size");

add the following:

#
# Report the contents of the quarantine mailbox to RAZOR
#

#optionally remove any subject text by spamassassin before reporting
#system("sed -i 's/\*\*\*\*SPAM\*\*\*\*//g' $MAILBOX");

#send the mailbox (change razor home to suit)
system("/usr/bin/razor-report -d -home=/etc/mail/razor -M $MAILBOX > $USER.razorlog");

This also creates a seperate log file of the report actions in the user's dspam directory called username.razorlog

I have also written a new template which can be added to the top menu to display the last submission log and called it nav_razor.html

<HTML>
<HEAD><TITLE>DSPAM v3 Control Center</TITLE>
<LINK REL="STYLESHEET" HREF="$WEB_ROOT$/base.css">
</HEAD>
<BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#000000 VLINK=#000000 ALINK=#000000>
<div id="header">
        <div id="logo">
                <a href="$CGI$" title="Home"><img src="$WEB_ROOT$/dspam-logo-small.gif" alt="DSPAM Logo" /></a>
        </div>
        <div id="userinfo">
                $FORM_USER$
        </div>
</div>

<br clear="left" />

<div id="navcontainer">
        <ul id="navlist">
                <li><a href="$CGI$?$USER$template=performance">Performance</a></li>
                <li><a href="$CGI$?$USER$template=preferences">Preferences</a></li>
                <li><a href="$CGI$?$USER$template=alerts">Alerts</a></li>
                <li><a href="$CGI$?$USER$template=quarantine">Quarantine ($TOTAL_QUARANTINED_MESSAGES$)</a></li>
                <li><a href="$CGI$?$USER$template=analysis">Analysis</a></li>
                <li><a href="$CGI$?$USER$template=history&history_page=1">History</a></li>
                <li id="active"><a id="current" href="$CGI$?$USER$template=razor">RAZOR Report Log</a></li>

                $NAV_ADMIN$
        </ul>
</div>

<div id="panel">

<p>
This is the log of the last RAZOR report submission
</p>

$RAZOR$
<p>
<FORM ACTION="$CGI$">
<INPUT TYPE=HIDDEN NAME=command VALUE=addAlert>
<INPUT TYPE=HIDDEN NAME=template VALUE=alerts>
<INPUT TYPE=HIDDEN NAME=user VALUE="$REMOTE_USER$">
<INPUT NAME=ALERT> &nbsp;<INPUT TYPE=SUBMIT VALUE="Add Alert">
</FORM>
</p>


</div>

<div id="footer">
<p>
<a href="http://dspam.nuclearelephant.com">DSPAM</a> is a registered trademark of <a href="http://www.nuclearelephant.com">Jonathan A. Zdziarski</a> Copyright &copy; 2005, Jonathan A. Zdziarski
</p>
</div>

</BODY>
</HTML>

screenshot

razor

last edited 2007-07-24 23:24:27 by timjmccann