diff options
author | Ryan Wagoner <rsw686@pfsense.org> | 2008-02-16 01:26:59 +0000 |
---|---|---|
committer | Ryan Wagoner <rsw686@pfsense.org> | 2008-02-16 01:26:59 +0000 |
commit | 84fbc1eb3b39d5f7f902a4b57caed2c9501e7baf (patch) | |
tree | 18cd4c20f16f81e220bb08232f6e1243128e5259 /packages/imspector | |
parent | ac5942c449f45d34b5a372ba232a1b682148294b (diff) | |
download | pfsense-packages-84fbc1eb3b39d5f7f902a4b57caed2c9501e7baf.tar.gz pfsense-packages-84fbc1eb3b39d5f7f902a4b57caed2c9501e7baf.tar.bz2 pfsense-packages-84fbc1eb3b39d5f7f902a4b57caed2c9501e7baf.zip |
bump imspector version
Diffstat (limited to 'packages/imspector')
-rw-r--r-- | packages/imspector/imspector.inc | 73 | ||||
-rw-r--r-- | packages/imspector/imspector.xml | 78 | ||||
-rw-r--r-- | packages/imspector/services_imspector_logs.php | 12 |
3 files changed, 123 insertions, 40 deletions
diff --git a/packages/imspector/imspector.inc b/packages/imspector/imspector.inc index 2bf61909..09974363 100644 --- a/packages/imspector/imspector.inc +++ b/packages/imspector/imspector.inc @@ -34,7 +34,8 @@ /* IMSpector */ define('IMSPECTOR_RCFILE', '/usr/local/etc/rc.d/imspector.sh'); - define('IMSPECTOR_CONFIG', '/usr/local/etc/imspector/imspector.conf'); + define('IMSPECTOR_ETC', '/usr/local/etc/imspector'); + define('IMSPECTOR_CONFIG', IMSPECTOR_ETC . '/imspector.conf'); function imspector_notice ($msg) { syslog(LOG_NOTICE, "imspector: {$msg}"); } function imspector_warn ($msg) { syslog(LOG_WARNING, "imspector: {$msg}"); } @@ -96,8 +97,11 @@ @unlink(IMSPECTOR_RCFILE); @unlink(IMSPECTOR_CONFIG); + @unlink(IMSPECTOR_ETC . '/badwords_custom.txt'); + @unlink(IMSPECTOR_ETC . '/acl_blacklist.txt'); + @unlink(IMSPECTOR_ETC . '/acl_whitelist.txt'); - exec('pkg_delete imspector-0.3'); + //exec('pkg_delete imspector-0.4'); } function sync_package_imspector() { @@ -150,31 +154,59 @@ if($pf_rules) { exec("echo \"{$pf_rules}\" | /sbin/pfctl -a imspector -f -"); - $configtext = "plugin_dir=/usr/local/lib/imspector\n"; + conf_mount_rw(); - foreach($proto_array as $proto) - $configtext .= "{$proto}_protocol=on\n"; + /* generate configuration files */ - if($imspector_config["filter_badwords"]) - $configtext .= "badwords_filename=/usr/local/etc/imspector/badwords.txt\n"; + $conf['plugin_dir'] = '/usr/local/lib/imspector'; + + foreach($proto_array as $proto) + $conf[$proto . '_protocol'] = 'on'; - if($imspector_config["log_file"]) { + if($imspector_config['log_file']) { @mkdir('/var/imspector'); - $configtext .= "file_logging_dir=/var/imspector\n"; + $conf['file_logging_dir'] = '/var/imspector'; } - if($imspector_config["log_mysql"]) { - $configtext .= "mysql_server={$imspector_config["mysql_server"]}\n"; - $configtext .= "mysql_database={$imspector_config["mysql_database"]}\n"; - $configtext .= "mysql_username={$imspector_config["mysql_username"]}\n"; - $configtext .= "mysql_password={$imspector_config["mysql_password"]}\n"; + if($imspector_config['log_mysql']) { + $conf['mysql_server'] = $imspector_config['mysql_server']; + $conf['mysql_database'] = $imspector_config['mysql_database']; + $conf['mysql_username'] = $imspector_config['mysql_username']; + $conf['mysql_password'] = $imspector_config['mysql_password']; } - if(0) { - @mkdir('/tmp/trace'); - $configtext .= "icq_trace_error=on\n"; + if($imspector_config['filter_badwords']) { + if(!empty($imspector_config["badwords_list"])) { + $conf['badwords_filename'] = IMSPECTOR_ETC . '/badwords_custom.txt'; + write_imspector_config(IMSPECTOR_ETC . '/badwords_custom.txt', + str_replace("\r", '', base64_decode($imspector_config["badwords_list"]))); + } else + $conf['badwords_filename'] = IMSPECTOR_ETC . '/badwords.txt'; } + if($imspector_config['block_files']) + $conf['block_files'] = 'on'; + + if($imspector_config['block_unlisted']) + $conf['block_unlisted'] = 'on'; + + if(!empty($imspector_config['acl_whitelist'])) { + $conf['whitelist_filename'] = IMSPECTOR_ETC . '/acl_whitelist.txt'; + write_imspector_config(IMSPECTOR_ETC . '/acl_whitelist.txt', + str_replace("\r", '', base64_decode($imspector_config["acl_whitelist"]))); + } + + if(!empty($imspector_config['acl_blacklist'])) { + $conf['blacklist_filename'] = IMSPECTOR_ETC . '/acl_blacklist.txt'; + write_imspector_config(IMSPECTOR_ETC . '/acl_blacklist.txt', + str_replace("\r", '', base64_decode($imspector_config["acl_blacklist"]))); + } + + $conftext = ''; + foreach($conf as $var => $key) + $conftext .= "{$var}={$key}\n"; + write_imspector_config(IMSPECTOR_CONFIG, $conftext); + /* generate rc file start and stop */ $stop = <<<EOD if [ `pgrep imspector | wc -l` != 0 ]; then @@ -187,15 +219,13 @@ EOD; $start = $stop."\n\tldconfig -m /usr/local/lib/mysql\n"; $start .= "\t/usr/local/sbin/imspector -c \"".IMSPECTOR_CONFIG."\""; - /* write out the configuration */ - conf_mount_rw(); - write_imspector_config(IMSPECTOR_CONFIG, $configtext); write_rcfile(array( 'file' => 'imspector.sh', 'start' => $start, 'stop' => $stop ) ); + conf_mount_ro(); /* if imspector not running start it */ @@ -226,6 +256,9 @@ EOD; conf_mount_rw(); unlink(IMSPECTOR_RCFILE); unlink(IMSPECTOR_CONFIG); + @unlink(IMSPECTOR_ETC . '/badwords_custom.txt'); + @unlink(IMSPECTOR_ETC . '/acl_blacklist.txt'); + @unlink(IMSPECTOR_ETC . '/acl_whitelist.txt'); conf_mount_ro(); } } diff --git a/packages/imspector/imspector.xml b/packages/imspector/imspector.xml index ceff0ae3..076dca13 100644 --- a/packages/imspector/imspector.xml +++ b/packages/imspector/imspector.xml @@ -46,7 +46,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>imspector</name> - <version>0.3.1</version> + <version>0.4</version> <title>Services: IMSpector</title> <savetext>Change</savetext> <aftersaveredirect>/services_imspector_logs.php</aftersaveredirect> @@ -127,43 +127,91 @@ </options> </field> <field> - <fielddescr>Enable filtering of bad words</fielddescr> - <fieldname>filter_badwords</fieldname> - <description>Replaces words specified in /usr/local/etc/imspector/badwords.txt with *</description> - <type>checkbox</type> - </field> - <field> <fielddescr>Enable file logging</fielddescr> <fieldname>log_file</fieldname> - <description>Log files stored in /var/imspector</description> + <description>Log files stored in /var/imspector.</description> <type>checkbox</type> </field> <field> - <fielddescr>Enable MySQL logging</fielddescr> + <fielddescr>Enable mySQL logging</fielddescr> <fieldname>log_mysql</fieldname> - <description>Make sure to specify your MySQL credentials below</description> + <description>Make sure to specify your MySQL credentials below.</description> <type>checkbox</type> </field> <field> - <fielddescr>MySQL Server</fielddescr> + <fielddescr>mySQL server</fielddescr> <fieldname>mysql_server</fieldname> <type>input</type> </field> <field> - <fielddescr>MySQL Database</fielddescr> + <fielddescr>mySQL database</fielddescr> <fieldname>mysql_database</fieldname> <type>input</type> </field> <field> - <fielddescr>MySQL Username</fielddescr> + <fielddescr>mySQL username</fielddescr> <fieldname>mysql_username</fieldname> <type>input</type> </field> <field> - <fielddescr>MySQL Password</fielddescr> + <fielddescr>mySQL password</fielddescr> <fieldname>mysql_password</fieldname> <type>password</type> - </field> + </field> + <field> + <fielddescr>Enable bad word filtering</fielddescr> + <fieldname>filter_badwords</fieldname> + <description>Replace characters of matched bad word with *.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Bad words list</fielddescr> + <fieldname>badwords_list</fieldname> + <description> + Place one word or phrase to match per line.<br /> + If left blank the default list in /usr/local/etc/imspector/badwords.txt will be used. + </description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>5</rows> + <cols>40</cols> + </field> + <field> + <fielddescr>Block file transfers</fielddescr> + <fieldname>block_files</fieldname> + <description>Block file transfers on supported protocols.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Block non ACL defined</fielddescr> + <fieldname>block_unlisted</fieldname> + <description>Overide the default of allowing user's not defined the whitelist or blacklist ACLs.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>ACL whitelist</fielddescr> + <fieldname>acl_whitelist</fieldname> + <description> + Example (allow specifc access): localuser: remoteuser1 remoteuser2<br /> + Example (allow full access): localuser: + </description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>5</rows> + <cols>40</cols> + </field> + <field> + <fielddescr>ACL blacklist</fielddescr> + <fieldname>acl_blacklist</fieldname> + <description> + Example (block specifc access): localuser: remoteuser1 remoteuser2<br /> + Example (block all access): localuser: + </description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>5</rows> + <cols>40</cols> + </field> </fields> <custom_php_validation_command> validate_form_imspector($_POST, &$input_errors); diff --git a/packages/imspector/services_imspector_logs.php b/packages/imspector/services_imspector_logs.php index 85df991e..616d3dfc 100644 --- a/packages/imspector/services_imspector_logs.php +++ b/packages/imspector/services_imspector_logs.php @@ -102,17 +102,19 @@ if ($_POST['mode'] == "render") { $line = fgets($fd); if(feof($fd)) continue; - preg_match('/([^,]*),([^,]*),([^,]*),(.*)/', $line, $matches); + preg_match('/([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),(.*)/', $line, $matches); $address = $matches[1]; $timestamp = $matches[2]; - $type = $matches[3]; - $data = $matches[4]; + $direction = $matches[3]; + $type = $matches[4]; + $filtered = $matches[5]; + $data = $matches[6]; - if($type == '1') { + if($direction == '0') { $bgcolor = $convo_remote_bgcolor; $user = "<<span style='color: $convo_remote_color;'>$remoteuser</span>>"; } - if($type == '2') { + if($direction == '1') { $bgcolor = $convo_local_bgcolor; $user = "<<span style='color: $convo_local_color;'>$localuser</span>>"; } |