aboutsummaryrefslogtreecommitdiffstats
path: root/packages/spamd_db_ext.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-03-07 01:59:18 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-03-07 01:59:18 +0000
commit9f64b0d09640533d9d5c881170fd2e94e69af426 (patch)
tree334f68de054bd5cc1de7e6b5833e2d7f851b7dae /packages/spamd_db_ext.php
parent7c168b308a5fe31ee9cb6cad6d4061ce5649609a (diff)
downloadpfsense-packages-9f64b0d09640533d9d5c881170fd2e94e69af426.tar.gz
pfsense-packages-9f64b0d09640533d9d5c881170fd2e94e69af426.tar.bz2
pfsense-packages-9f64b0d09640533d9d5c881170fd2e94e69af426.zip
* Do not add ips to spamtrap, it really wants an email address
* Add blacklist.txt and set it up as a blacklist in SpamD * Use new blacklist.txt when trapping $srcip
Diffstat (limited to 'packages/spamd_db_ext.php')
-rw-r--r--packages/spamd_db_ext.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/spamd_db_ext.php b/packages/spamd_db_ext.php
index 72bbbe9e..a4da79ab 100644
--- a/packages/spamd_db_ext.php
+++ b/packages/spamd_db_ext.php
@@ -79,6 +79,7 @@ if($_GET['action'] or $_POST['action']) {
fclose($fd);
exec("chmod a+rx /tmp/execcmds");
system("/bin/sh /tmp/execcmds");
+ remove_from_blacklist($srcip);
config_unlock();
exit;
} else if($action == "spamtrap") {
@@ -92,6 +93,9 @@ if($_GET['action'] or $_POST['action']) {
exec("/usr/local/sbin/spamdb -d -T \"<{$srcip}>\"");
exec("/usr/local/sbin/spamdb -d -t \"<{$srcip}>\"");
exec("/usr/local/sbin/spamdb -a {$srcip} -t");
+ config_lock();
+ add_to_blacklist($srcip);
+ config_unlock();
exit;
}
/* signal a reload for real time effect. */
@@ -154,6 +158,22 @@ function basic_auth_prompt(){
exit;
}
+function add_to_blacklist($srcip) {
+ $fd = fopen("/var/db/blacklist.txt", "a");
+ fwrite($fd, $srcip);
+ fclose($fd);
+}
+
+function delete_from_blacklist($srcip) {
+ $blacklist = split("\n", file_get_contents("/var/db/blacklist.txt"));
+ $fd = fopen("/var/db/blacklist.txt", "w");
+ foreach($blacklist as $bl) {
+ if($blacklist <> $srcip)
+ fwrite($fd, "{$srcip}\n";
+ }
+ fclose($fd);
+}
+
exit;
?> \ No newline at end of file