View Single Post
  #7  
Old 28th May 2010, 18:50
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

This is the script I came up with. There are no errors in any logs but it doesn't appear to work as the mail_content_filter table stays empty. Putting it here to see if someone can see what's not working...

mail_content_filters.php
Code:
<?php
// Note:  These includes and their ancestor directories needed 755 permissions 
include('/usr/local/ispconfig/interface/lib/config.inc.php');
include('/usr/local/ispconfig/interface/lib/classes/db_mysql.inc.php');

$tablename = "mail_content_filter";  // I emptied this table first using phpMyAdmin
$index_field = "content_filter_id";
$db = new db;

print "Running... ";
$dataFile = fopen("./mail_content_filters.csv", "rb");
while (!feof($dataFile) ) {
	$mailFilters = fgets($dataFile);
	$dVal = explode(',', $mailFilters);
	$insert_data = "content_filter_id,sys_userid,sys_groupid,sys_perm_user,sys_perm_group,sys_perm_other,server_id,type,pattern,data,action,active";
	$insert_data .= " values ";
	$insert_data .= "$dVal[0],$dVal[1],$dVal[2],$dVal[3],$dVal[4],$dVal[5],$dVal[6],$dVal[7],$dVal[8],$dVal[9],$dVal[10],$dVal[11]";
	$db->datalogInsert($tablename, $insert_data, $index_field);
}
fclose($dataFile);
print " Finished!<br>";
?>
mail_content_filters.csv (partial)
Code:
1,1,1,riud,riud,,1,body,"/^(Content-Type:.*|\s+)charset\s*=\s*""?(big5|euc-kr|gb2312|koi8|ks_c_5601-1987|Windows-1251)""?/",No foreign character sets please.,REJECT,y
2,1,1,riud,riud,,1,body,"/(filename|name)="".*\..*""$/",No files of type $1 allowed here.,REJECT,y
3,1,1,riud,riud,,1,body,"/(filename|name)=""(music*|dhcp*|Emanuel|kmbfejkm|Na kedWife|Seicho_no_ie|JAMGCJJA|Happy99|Navidad|pret typark|pretty|data|WTC|wtc|README)\.EXE""/",Known virus names,REJECT,y
4,1,1,riud,riud,,1,body,"/(filename|name)=""(doc|body|file)\.scr""/",Known for MyDoom virus names 1,REJECT,y
5,1,1,riud,riud,,1,body,"/(filename|name)=""(document|message|body|text|test) \.pif""/",Known for MyDoom virus names 2,REJECT,y
6,1,1,riud,riud,,1,body,"/(filename|name)=""(document|message|body|text|test) \.zip""/",Known for MyDoom virus names 3,REJECT,y
7,1,1,riud,riud,,1,body,/important information regarding your email address/,Possible W32_Mlmaill@MM,REJECT,y
8,1,1,riud,riud,,1,body,/mailto:.*\@.*\?subject\=(3D)*(remove|removeme|plea sedelete|pleaseremove|deleteme)+/,Lets just say we are removing now.,REJECT,y
9,1,1,riud,riud,,1,body,/.*\@.*\.ru/,No foreign character sets from ru please.,REJECT,y
10,1,1,riud,riud,,1,body,/.*\@.*\.bg/,No foreign character sets from bg please.,REJECT,y
11,1,1,riud,riud,,1,body,/.*\@.*\.it/,No foreign character sets from it please.,REJECT,y
12,1,1,riud,riud,,1,body,/.*\@.*\.au/,No foreign character sets from au please.,REJECT,y
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote