Scott Ullrich wrote:
Hey this is great, thank you!

Can you please do a diff -rub and then email the patch as an
attachment to coret...@pfsense.org and I will get it promptly
committed.

Done.

I've also attached a patch for spamd_db.php that makes the GUI more accurate and informative in the db accounting.

I'd also like to modify the package to add options for enabling spamd-setup -b and spamlogd -I options which I use and should be selectable I think. There should also be a blacklist tab for editing the blacklist.txt file, just as there is with the whitelist.txt\

~Tim

--- filter.inc_1.2.2-REL        2009-06-18 22:09:05.000000000 -0400
+++ filter.inc_1.2.2-REL-spamd-fix      2009-06-18 21:35:09.000000000 -0400
@@ -810,21 +810,26 @@
        /* is SPAMD insalled? */
        if (is_package_installed("spamd") == 1) {
                $natrules .= "\n# spam table \n";
-
+               if(file_exists("/var/db/whitelist.txt"))
+                       $natrules .= "table <whitelist> persist file 
\"/var/db/whitelist.txt\"\n";
+               else
                $natrules .= "table <whitelist> persist\n";
+               if(file_exists("/var/db/blacklist.txt"))
+                       $natrules .= "table <blacklist> persist file 
\"/var/db/blacklist.txt\"\n";
+               else
                $natrules .= "table <blacklist> persist\n";
                $natrules .= "table <spamd> persist\n";
-               if(file_exists("/var/db/whitelist.txt"))
-                       $natrules .= "table <spamd-white> persist file 
\"/var/db/whitelist.txt\"\n";
-               $natrules .= "rdr pass on {$wanif} proto tcp from <blacklist> 
to port smtp -> 127.0.0.1 port spamd\n";
-               $natrules .= "rdr pass on {$wanif} proto tcp from <spamd> to 
port smtp -> 127.0.0.1 port spamd\n";
-               $natrules .= "rdr pass on {$wanif} proto tcp from 
!<spamd-white> to port smtp -> 127.0.0.1 port spamd\n";
+               $natrules .= "table <spamd-white> persist\n";
+
                if($config['installedpackages']['spamdsettings']['config'])
                        
foreach($config['installedpackages']['spamdsettings']['config'] as $ss)
                                $nextmta = $ss['nextmta'];
-               if($nextmta <> "") {
-                       $natrules .= "rdr pass on {$wanif} proto tcp from 
<spamd-white> to port smtp -> {$nextmta} port smtp\n";
-               }
+               if($nextmta <> "")
+                        $natrules .= "rdr pass on {$wanif} proto tcp from { 
<spamd-white> <whitelist> } to port smtp -> {$nextmta} port smtp\n";
+               else
+                       $natrules .= "no rdr on {$wanif} proto tcp from 
<whitelist> to any port = smtp\n";
+               $natrules .= "rdr pass on {$wanif} proto tcp from { <blacklist> 
<spamd> } to port smtp -> 127.0.0.1 port spamd\n";
+               $natrules .= "rdr pass on {$wanif} proto tcp from { 
!<spamd-white> } to port smtp -> 127.0.0.1 port spamd\n";
        }
 
        /* load balancer anchor */
--- spamd_db.php_1.2.2-REL      2009-06-18 01:56:34.000000000 -0400
+++ spamd_db.php_1.2.2-REL-spamd-fix    2009-06-18 11:15:14.000000000 -0400
@@ -176,17 +176,18 @@
 include("head.inc");
 
 if(file_exists("/var/db/whitelist.txt"))
-       $whitelist_items = `cat /var/db/whitelist.txt | wc -l`;
+       $static_whitelist_items = `pfctl -T show -t whitelist | wc -l`;
 else 
        $whitelist_items = 0;
        
 if(file_exists("/var/db/blacklist.txt"))
-       $blacklist_items = `cat /var/db/blacklist.txt | wc -l`;
+       $static_blacklist_items = `pfctl -T show -t blacklist | wc -l`;
 else 
        $blacklist_items = 0;
 
 // Get an overall count of the database
 $spamdb_items = `/usr/local/sbin/spamdb | wc -l`;
+$accounted_items = $spamdb_items + $static_whitelist_items + 
$static_blacklist_items;
 
 // Get blacklist and whitelist count from database
 $spamdb_white = `/usr/local/sbin/spamdb | grep WHITE | wc -l`;
@@ -194,8 +195,8 @@
 $spamdb_grey = `/usr/local/sbin/spamdb | grep GREY | wc -l`;
 
 // Now count the user contributed whitelist and blacklist count
-$whitelist_items = $whitelist_items + $spamdb_white;
-$blacklist_items = $blacklist_items + $spamdb_black;
+$whitelist_items = $static_whitelist_items + $spamdb_white;
+$blacklist_items = $static_blacklist_items + $spamdb_black;
 
 ?>
 <body link="#000000" vlink="#000000" alink="#000000">
@@ -447,10 +448,11 @@
 <br>
                <p><font size="-2"><b>Database totals:</b><br><font 
size="-3"><br>
                <?php
-                       echo "{$whitelist_items} total items in the 
whitelist.<br>";
-                       echo "{$blacklist_items} total items in the 
blacklist.<br>";
+                       echo "{$whitelist_items} total items in the whitelist: 
{$spamdb_white} dynamic, {$static_whitelist_items} static 
(/var/db/whitelist.txt).<br>";
+                       echo "{$blacklist_items} total items in the blacklist: 
{$spamdb_black} dynamic, {$static_blacklist_items} static 
(/var/db/blacklist.txt).<br>";
                        echo "{$spamdb_grey} total items in the greylist.<br>"; 
                
                        echo "{$spamdb_items} total items in the SpamDB.<br>";
+                       echo "{$accounted_items} total accounted items.<br>";
                ?>
 <?php include("fend.inc"); ?>
 </body>

---------------------------------------------------------------------
To unsubscribe, e-mail: support-unsubscr...@pfsense.com
For additional commands, e-mail: support-h...@pfsense.com

Commercial support available - https://portal.pfsense.org

Reply via email to