From feace6be7c9c35a65ecaa482a430a22f7a26ed13 Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Tue, 8 May 2012 22:13:03 -0300 Subject: imspector-dev - new binaries for msn2011 support and new gui options --- config/imspector-dev/imspector.inc | 409 +++++++++++++++++++++++ config/imspector-dev/imspector.xml | 219 ++++++++++++ config/imspector-dev/imspector_acls.xml | 161 +++++++++ config/imspector-dev/imspector_replacements.xml | 194 +++++++++++ config/imspector-dev/imspector_sync.xml | 105 ++++++ config/imspector-dev/services_imspector_logs.php | 298 +++++++++++++++++ 6 files changed, 1386 insertions(+) create mode 100644 config/imspector-dev/imspector.inc create mode 100644 config/imspector-dev/imspector.xml create mode 100644 config/imspector-dev/imspector_acls.xml create mode 100644 config/imspector-dev/imspector_replacements.xml create mode 100644 config/imspector-dev/imspector_sync.xml create mode 100644 config/imspector-dev/services_imspector_logs.php (limited to 'config/imspector-dev') diff --git a/config/imspector-dev/imspector.inc b/config/imspector-dev/imspector.inc new file mode 100644 index 00000000..254d7e49 --- /dev/null +++ b/config/imspector-dev/imspector.inc @@ -0,0 +1,409 @@ +. + Copyright (C) 2011 Bill Marquette . + Copyright (C) 2007 Ryan Wagoner . + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + + require_once("config.inc"); + require_once("functions.inc"); + + /* IMSpector */ + + define('IMSPECTOR_RCFILE', '/usr/local/etc/rc.d/imspector.sh'); + 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}"); } + + function ims_text_area_decode($text){ + return preg_replace('/\r\n/', "\n",base64_decode($text)); + } + + function imspector_action ($action) { + if (file_exists(IMSPECTOR_RCFILE)) + mwexec(IMSPECTOR_RCFILE.' '.$action); + } + + function imspector_running () { + if((int)exec('pgrep imspector | wc -l') > 0) + return true; + return false; + } + + function write_imspector_config($file, $text) { + $conf = fopen($file, 'w'); + if(!$conf) { + imspector_warn("Could not open {$file} for writing."); + exit; + } + fwrite($conf, $text); + fclose($conf); + } + + function imspector_pf_rdr($iface, $port) { + return "rdr pass on {$iface} inet proto tcp from any to any port = {$port} -> 127.0.0.1 port 16667\n"; + } + + function imspector_pf_rule($iface, $port) { + return "pass in quick on {$iface} inet proto tcp from any to any port {$port} keep state\n"; + } + + function imspector_proto_to_port ($proto) + { + switch ($proto) { + case 'gadu-gadu': + return 8074; + case 'jabber': + return 5222; + case 'jabber-ssl': + return 5223; + case 'msn': + return 1863; + case 'icq': + return 5190; + case 'yahoo': + return 5050; + case 'irc': + return 6667; + default: + return null; + } + } + + function validate_form_imspector($post, $input_errors) { + if($post['iface_array']) + foreach($post['iface_array'] as $iface) + if($iface == 'wanx') + $input_errors[] = 'It is a security risk to specify WAN in the \'Interface\' field'; + } + + function deinstall_package_imspector() { + imspector_action('stop'); + + @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.4'); + } + + function imspector_generate_rules($type) { + + $rules = ""; + switch ($type) { + case 'rdr': + case 'nat': + $rules = "# IMSpector rdr anchor\n"; + $rules .= "rdr-anchor \"imspector\"\n"; + break; + case 'rule': + $rules = "# IMSpector \n"; + $rules .= "anchor \"miniupnpd\"\n"; + break; + } + + return $rules; + } + + function sync_package_imspector() { + global $config; + global $input_errors; + + /*detect boot process*/ + if (is_array($_POST)){ + if (preg_match("/\w+/",$_POST['__csrf_magic'])) + unset($boot_process); + else + $boot_process="on"; + } + + if (is_process_running('imspector') && isset($boot_process)) + return; + + /*continue sync process*/ + config_lock(); + + if (is_array($config['installedpackages']['imspector'])) + $ims_config = $config['installedpackages']['imspector']['config'][0]; + + if (is_array($config['installedpackages']['imspectorreplacements'])) + $ims_replacements = $config['installedpackages']['imspectorreplacements']['config'][0]; + + if (is_array($config['installedpackages']['imspectoracls'])) + $ims_acls = $config['installedpackages']['imspectoracls']['config']; + + /* remove existing rules */ + exec('/sbin/pfctl -a imspector -Fr'); + exec('/sbin/pfctl -a imspector -Fn'); + + $ifaces_active = ''; + + if($ims_config['enable'] && $ims_config['proto_array']) + $proto_array = explode(',', $ims_config['proto_array']); + + if($ims_config['enable'] && $ims_config['iface_array']) + $iface_array = explode(',', $ims_config['iface_array']); + + if($iface_array && $proto_array) { + foreach($iface_array as $iface) { + $if = convert_friendly_interface_to_real_interface_name($iface); + /* above function returns iface if fail */ + if($if!=$iface) { + $addr = find_interface_ip($if); + /* non enabled interfaces are displayed in list on imspector settings page */ + /* check that the interface has an ip address before adding parameters */ + if($addr) { + foreach($proto_array as $proto) { + if(imspector_proto_to_port($proto)) { + /* we can use rdr pass to auto create the filter rule */ + $pf_rules .= imspector_pf_rdr($if,imspector_proto_to_port($proto)); + } + } + if(!$ifaces_active) + $ifaces_active = "{$iface}"; + else + $ifaces_active .= ", {$iface}"; + } else { + imspector_warn("Interface {$iface} has no ip address, ignoring"); + } + } else { + imspector_warn("Could not resolve real interface for {$iface}"); + } + } + + if($pf_rules) { + exec("echo \"{$pf_rules}\" | /sbin/pfctl -a imspector -f -"); + + conf_mount_rw(); + + /* generate configuration files */ + + $conf['plugin_dir'] = '/usr/local/lib/imspector'; + + foreach($proto_array as $proto) + $conf[$proto . '_protocol'] = 'on'; + + if($ims_config['log_file']) { + @mkdir('/var/imspector'); + $conf['file_logging_dir'] = '/var/imspector'; + } + + if($ims_config['log_mysql']) { + $conf['mysql_server'] = $ims_config['mysql_server']; + $conf['mysql_database'] = $ims_config['mysql_database']; + $conf['mysql_username'] = $ims_config['mysql_username']; + $conf['mysql_password'] = $ims_config['mysql_password']; + } + + if($ims_replacements['filter_badwords']) { + if(!empty($ims_replacements["badwords_list"])) { + $conf['badwords_filename'] = IMSPECTOR_ETC . '/badwords_custom.txt'; + write_imspector_config(IMSPECTOR_ETC . '/badwords_custom.txt', ims_text_area_decode($ims_config["badwords_list"])); + } else + $conf['badwords_filename'] = IMSPECTOR_ETC . '/badwords.txt'; + } + + if($ims_replacements['block_files']) + $conf['block_files'] = 'on'; + + if($ims_replacements['block_webcams']) + $conf['block_webcams'] = 'on'; + + if($ims_replacements['block_unlisted']) + $conf['block_unlisted'] = 'on'; + + $acls=""; + $conf['acl_filename'] = IMSPECTOR_ETC . '/acls.txt'; + foreach ($ims_acls as $rule){ + if ($rule['enable']){ + $acls.= "{$rule['action']} {$rule['localid']} ".preg_replace("/\s+/"," ",base64_decode($rule['remoteid']))."\n"; + } + } + write_imspector_config(IMSPECTOR_ETC . '/acls.txt', $acls); + + // Handle Jabber SSL options + if(isset($ims_config["ssl_ca_cert"]) && $ims_config["ssl_ca_cert"] != "none" && + isset($ims_config["ssl_server_cert"]) && $ims_config["ssl_server_cert"] != "none") { + $conf['ssl'] = "on"; + if(!is_dir(IMSPECTOR_ETC . "/ssl")) + mkdir(IMSPECTOR_ETC . "/ssl"); + + $ca_cert = lookup_ca($ims_config["ssl_ca_cert"]); + if ($ca_cert != false) { + if(base64_decode($ca_cert['prv'])) { + file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_ca_key.pem", base64_decode($ca_cert['prv'])); + $conf['ssl_ca_key'] = IMSPECTOR_ETC . '/ssl/ssl_ca_key.pem'; + } + if(base64_decode($ca_cert['crt'])) { + file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_ca_cert.pem", base64_decode($ca_cert['crt'])); + $conf['ssl_ca_cert'] = IMSPECTOR_ETC . "/ssl/ssl_ca_cert.pem"; + } + $svr_cert = lookup_cert($ims_config["ssl_server_cert"]); + if ($svr_cert != false) { + if(base64_decode($svr_cert['prv'])) { + file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_server_key.pem", base64_decode($svr_cert['prv'])); + $conf['ssl_key'] = IMSPECTOR_ETC . '/ssl/ssl_server_key.pem'; + } + + } + $conf['ssl_cert_dir'] = IMSPECTOR_ETC . '/ssl'; + } + } else { + // SSL Not enabled. Make sure Jabber-SSL is not processed. + unset($conf['jabber-ssl']); + unset($conf['ssl']); + } + + if (isset($ims_replacements['responder']) && $ims_replacements['responder'] == 'on') { + $conf['responder_filename'] = IMSPECTOR_ETC . "/responder.db"; + if (isset($ims_replacements['prefix_message']) && $ims_replacements['prefix_message'] != '' ) { + $conf['response_prefix'] = "-={$ims_replacements['prefix_message']}=-"; + } + else{ + $conf['response_prefix'] = "-=Your activities are being logged=-"; + } + if (isset($ims_replacements['notice_days']) && is_numeric($ims_replacements['notice_days'])) { + if ($ims_replacements['notice_days'] != 0) { + $conf['notice_days'] = $matches[1]; + } + } else { + $conf['notice_days'] = 1; + } + + /*Custom recorded message response*/ + if(isset($ims_replacements['recorded_message']) && $ims_replacements['recorded_message'] != '' ){ + $conf['recorded_message'] = ims_text_area_decode($ims_replacements['recorded_message']); + } + else{ + $conf['notice_response'] = "Your activities are being logged"; + } + + /*Filtered Frequency*/ + if (isset($ims_replacements['filtered_minutes']) && is_numeric($ims_replacements['filtered_minutes'])) { + if ($ims_replacements['filtered_minutes'] != 0) { + $conf['filtered_mins'] = $ims_replacements['filtered_minutes']; + } + } else { + $conf['filtered_mins'] = 15; + } + + /*Custom filtered message response*/ + if(isset($ims_replacements['filtered_message']) && $ims_replacements['filtered_message'] != '' ){ + $conf['filtered_response'] = ims_text_area_decode($ims_replacements['filtered_message']); + } + else{ + $conf['filtered_response'] = "Your message has been filtered"; + } + } + + $conftext = ''; + foreach($conf as $var => $key) + $conftext .= "{$var}={$key}\n"; + write_imspector_config(IMSPECTOR_CONFIG, $conftext); + + /* generate rc file start and stop */ + $stop = << 'imspector.sh', + 'start' => $start, + 'stop' => $stop + ) + ); + + conf_mount_ro(); + + /* if imspector not running start it */ + if(!imspector_running()) { + imspector_notice("Starting service on interface: {$ifaces_active}"); + imspector_action('start'); + } + /* or restart imspector if settings were changed */ + elseif($_POST['iface_array']) { + imspector_notice("Restarting service on interface: {$ifaces_active}"); + imspector_action('restart'); + } + } + } + + if(!$iface_array || !$proto_array || !$pf_rules) { + /* no parameters user does not want imspector running */ + /* lets stop the service and remove the rc file */ + + if(file_exists(IMSPECTOR_RCFILE)) { + if(!$ims_config['enable']) + imspector_notice('Stopping service: imspector disabled'); + else + imspector_notice('Stopping service: no interfaces and/or protocols selected'); + + imspector_action('stop'); + + 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(); + } + } + + config_unlock(); + } + + function imspector_get_ca_certs() { + global $config; + + $ca_arr = array(); + $ca_arr[] = array('refid' => 'none', 'descr' => 'none'); + foreach ($config['ca'] as $ca) { + $ca_arr[] = array('refid' => $ca['refid'], 'descr' => $ca['descr']); + } + return $ca_arr; + } + + function imspector_get_server_certs() { + global $config; + $cert_arr = array(); + $cert_arr[] = array('refid' => 'none', 'descr' => 'none'); + + foreach ($config['cert'] as $cert) { + $cert_arr[] = array('refid' => $cert['refid'], 'descr' => $cert['descr']); + } + return $cert_arr; + } +?> \ No newline at end of file diff --git a/config/imspector-dev/imspector.xml b/config/imspector-dev/imspector.xml new file mode 100644 index 00000000..7e62ee8e --- /dev/null +++ b/config/imspector-dev/imspector.xml @@ -0,0 +1,219 @@ + + + + + + + Copyright (C) 2011 Bill Marquette + Copyright (C) 2007 Ryan Wagoner + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + + Describe your package here + Describe your package requirements here + Currently there are no FAQ items provided. + imspector + 20111108 + Services: IMSpector + Save + /services_imspector_logs.php + /usr/local/pkg/imspector.inc + + IMSpector + Set IMSpector settings such as protocols to listen on. +
Services
+ /services_imspector_logs.php +
+ + imspector + imspector.sh + imspector + + + + Settings + /pkg_edit.php?xml=imspector.xml&id=0 + + + + Replacements + /pkg_edit.php?xml=imspector_replacements.xml&id=0 + + + Access Lists + /pkg.php?xml=imspector_acls.xml + + + Log + /services_imspector_logs.php + + + Sync + /pkg_edit.php?xml=imspector_sync.xml + + + + /usr/local/pkg/ + 0755 + http://www.pfsense.org/packages/config/imspector-dev/imspector_sync.xml + + + /usr/local/pkg/ + 0755 + http://www.pfsense.org/packages/config/imspector-dev/imspector_replacements.xml + + + /usr/local/pkg/ + 0755 + http://www.pfsense.org/packages/config/imspector-dev/imspector_acls.xml + + + /usr/local/pkg/ + 0755 + http://www.pfsense.org/packages/config/imspector-dev/imspector.inc + + + /usr/local/www/ + 0755 + http://www.pfsense.org/packages/config/imspector-dev/services_imspector_logs.php + + + + General Settings + listtopic + + + Enable IMSpector + enable + checkbox + + + Interfaces + iface_array + Generally select internal interface(s) like LAN
+ You can use the CTRL or COMMAND key to select multiple interfaces.]]>
+ interfaces_selection + 3 + + lan + true +
+ + Listen on protocols + proto_array + NOTE: Gtalk/Jabber-SSL requires SSL certificates.
+ You can use the CTRL or COMMAND key to select multiple protocols.]]>
+ select + 7 + + true + + + + + + + + + +
+ + SSL CA Certificate + ssl_ca_cert + + Choose the SSL CA Certficate here. + + select_source + + descr + refid + + + SSL Certificate + ssl_server_cert + + Choose the SSL Server Certificate here. + + select_source + + descr + refid + + + Logging + listtopic + + + Enable file logging + log_file + Log files stored in /var/imspector. + checkbox + + + Enable mySQL logging + log_mysql + Make sure to specify your MySQL credentials below. + checkbox + + + mySQL server + mysql_server + input + + + mySQL database + mysql_database + input + + + mySQL username + mysql_username + input + + + mySQL password + mysql_password + password + +
+ + validate_form_imspector($_POST, &$input_errors); + + + sync_package_imspector(); + + + deinstall_package_imspector(); + + imspector_generate_rules +
\ No newline at end of file diff --git a/config/imspector-dev/imspector_acls.xml b/config/imspector-dev/imspector_acls.xml new file mode 100644 index 00000000..02d57052 --- /dev/null +++ b/config/imspector-dev/imspector_acls.xml @@ -0,0 +1,161 @@ + + + + . + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + + + imspectoracls + 20111108 + Imspector acls + Imspectors Access Lists + Save + /usr/local/pkg/imspector.inc + + + SSH Conditions + Configure SSH conditional exceptions +
Services
+ /pkg.php?xml=sshdcond.xml +
+ installedpackages->package->sshdcond + + + /usr/local/pkg/ + 755 + http://www.pfsense.com/packages/config/sshdcond/sshdcond.inc + + + /usr/local/pkg/ + 755 + http://www.pfsense.com/packages/config/sshdcond/sshdcond_sync.xml + + + + Settings + /pkg_edit.php?xml=imspector.xml&id=0 + + + Replacements + /pkg_edit.php?xml=imspector_replacements.xml&id=0 + + + Access Lists + /pkg.php?xml=imspector_acls.xml + + + + Log + /services_imspector_logs.php + + + Sync + /pkg_edit.php?xml=imspector_sync.xml&id=0 + + + + + Status + enable + + + action + action + + + local ID + localid + + + + + listtopic + Imspector Access Lists + temp + + + Enable + enable + checkbox + + Rules are processed in order, from top to bottom.]]> + + + Action + action + Select action to take on this rule + select + + + + + + + + Local ID + localid + + Local IDs can either be complete, such as user@company.com, partial like company.com or all to match any id.]]> + input + 50 + + + + Remote ID + remoteid + + Remote IDs can be complete ids like user@company.com, partial company.com, all to match any id or groupchat.]]> + textarea + 10 + 60 + base64 + + + + + validate_form_imspector($_POST, &$input_errors); + + + sync_package_imspector(); + + + deinstall_package_imspector(); + + imspector_generate_rules +
\ No newline at end of file diff --git a/config/imspector-dev/imspector_replacements.xml b/config/imspector-dev/imspector_replacements.xml new file mode 100644 index 00000000..6e9cf8c7 --- /dev/null +++ b/config/imspector-dev/imspector_replacements.xml @@ -0,0 +1,194 @@ + + + + + + + Copyright (C) 2011 Bill Marquette + Copyright (C) 2007 Ryan Wagoner + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + + Describe your package here + Describe your package requirements here + Currently there are no FAQ items provided. + imspectorreplacements + 20111108 + Services: IMSpector + Save + /services_imspector_logs.php + /usr/local/pkg/imspector.inc + + IMSpector + Set IMSpector settings such as protocols to listen on. +
Services
+ /services_imspector_logs.php +
+ + imspector + imspector.sh + imspector + + + + Settings + /pkg_edit.php?xml=imspector.xml&id=0 + + + Replacements + /pkg_edit.php?xml=imspector_replacements.xml&id=0 + + + + Access Lists + /pkg.php?xml=imspector_acls.xml + + + Log + /services_imspector_logs.php + + + Sync + /pkg_edit.php?xml=imspector_sync.xml&id=0 + + + + + Response messages + listtopic + + + Enable response messages + responder + + Inform the users (both local and remote) that the conversation they are having is being recorded. This might be needed for legal reasons. + Inform the sender that a file (or message) was blocked. This is useful because the sender will know a block occured, instead of the transfer simply failing. + checkbox + + + Notification frequency + notice_days + input + 10 + Frequency in number of days for notifying users they are being logged. Default 1 day if responses are enabled, set to 0 to disable + + + Filtered frequency + filtered_minutes + input + 10 + The time between sending "filtered" in minutes. Default 15 minutes if responses are enabled, set to 0 to disable + + + Custom message prefix + prefix_message + + Message to prepend to all IMSpector generated messages. The default is "Message from IMSpector" + + input + 60 + + + Custom recorded message response + recorded_message + + Message to send to users to let them know they are being recorded. The default is "Your activities are being logged" + + textarea + base64 + 5 + 60 + + + Custom filtered message response + filtered_message + + Message to send to users to let them know about filtered messages. + + textarea + base64 + 5 + 60 + + + Restrictions + listtopic + + + Block file transfers + block_files + Block file transfers on supported protocols. + checkbox + + + Block web cameras + block_webcams + This option will block all webcam sessions. Currently IMSpector can only spot webcam sessions on Yahoo. + checkbox + + + Block non ACL defined + block_unlisted + Overide the default of allowing user's not defined the whitelist or blacklist ACLs. + checkbox + + + Enable bad word filtering + filter_badwords + Replace characters of matched bad word with *. + checkbox + + + Bad words list + badwords_list + + 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. + + textarea + base64 + 10 + 60 + + + + validate_form_imspector($_POST, &$input_errors); + + + sync_package_imspector(); + + + deinstall_package_imspector(); + + imspector_generate_rules +
\ No newline at end of file diff --git a/config/imspector-dev/imspector_sync.xml b/config/imspector-dev/imspector_sync.xml new file mode 100644 index 00000000..5a939af7 --- /dev/null +++ b/config/imspector-dev/imspector_sync.xml @@ -0,0 +1,105 @@ + + + + + + + + Describe your package here + Describe your package requirements here + Currently there are no FAQ items provided. + imspectorsync + 1.0 + Services: IMSpector + /usr/local/pkg/imspector.inc + + + Settings + /pkg_edit.php?xml=imspector.xml&id=0 + + + Replacements + /pkg_edit.php?xml=imspector_replacements.xml&id=0 + + + Log + /services_imspector_logs.php + + + Sync + /pkg_edit.php?xml=imspector_sync.xml&id=0 + + + + + + XMLRPC Sync + listtopic + + + Automatically sync imspector configuration changes + synconchanges + Automatically sync imspector(normal and reverse) changes to the hosts defined below. + checkbox + + + Remote Server + none + rowhelper + + + IP Address + ipaddress + IP Address of remote server + input + 20 + + + Password + password + Password for remote server. + password + 20 + + + + + + + + sync_package_imspector(); + + diff --git a/config/imspector-dev/services_imspector_logs.php b/config/imspector-dev/services_imspector_logs.php new file mode 100644 index 00000000..b9b6cf5f --- /dev/null +++ b/config/imspector-dev/services_imspector_logs.php @@ -0,0 +1,298 @@ +. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); + +/* variables */ +$log_dir = '/var/imspector'; +$imspector_config = $config['installedpackages']['imspector']['config'][0]; + +$border_color = '#c0c0c0'; +$default_bgcolor = '#eeeeee'; + +$list_protocol_color = '#000000'; +$list_local_color = '#000000'; +$list_remote_color = '#000000'; +$list_convo_color = '#000000'; + +$list_protocol_bgcolor = '#cccccc'; +$list_local_bgcolor = '#dddddd'; +$list_remote_bgcolor = '#eeeeee'; +$list_end_bgcolor = '#bbbbbb'; + +$convo_title_color = 'black'; +$convo_local_color = 'blue'; +$convo_remote_color = 'red'; + +$convo_title_bgcolor = '#cccccc'; +$convo_local_bgcolor = '#dddddd'; +$convo_remote_bgcolor = '#eeeeee'; + +/* functions */ + +function convert_dir_list ($topdir) { + if (!is_dir($topdir)) return; + if ($dh = opendir($topdir)) { + while (($file = readdir($dh)) !== false) { + if(!preg_match('/^\./', $file) == 0) continue; + if (is_dir("$topdir/$file")) { + $list .= convert_dir_list("$topdir/$file"); + } else { + $list .= "$topdir/$file\n"; + } + } + closedir($dh); + } + return $list; +} + +/* ajax response */ +if ($_POST['mode'] == "render") { + + /* user list */ + print(str_replace(array($log_dir,'/'),array('','|'),convert_dir_list($log_dir))); + print("--END--\n"); + + /* log files */ + if ($_POST['section'] != "none") { + $section = explode('|',$_POST['section']); + $protocol = $section[0]; + $localuser = $section[1]; + $remoteuser = $section[2]; + $conversation = $section[3]; + + /* conversation title */ + print(implode(', ', $section)."\n"); + print("--END--\n"); + + /* conversation content */ + $filename = $log_dir.'/'.implode('/', $section); + if($fd = fopen($filename, 'r')) { + print("\n"); + while (!feof($fd)) { + $line = fgets($fd); + if(feof($fd)) continue; + $new_format = '([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),(.*)'; + $old_format = '([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),(.*)'; + preg_match("/${new_format}|${old_format}/", $line, $matches); + $address = $matches[1]; + $timestamp = $matches[2]; + $direction = $matches[3]; + $type = $matches[4]; + $filtered = $matches[5]; + if(count($matches) == 8) { + $category = $matches[6]; + $data = $matches[7]; + } else { + $category = ""; + $data = $matches[6]; + } + + if($direction == '0') { + $bgcolor = $convo_remote_bgcolor; + $user = "<$remoteuser>"; + } + if($direction == '1') { + $bgcolor = $convo_local_bgcolor; + $user = "<$localuser>"; + } + + $time = strftime("%H:%M:%S", $timestamp); + + print("\n + \n + \n + \n"); + } + print("
[$time]$user$category$data
\n"); + fclose($fd); + } + } + exit; +} +/* defaults to this page but if no settings are present, redirect to setup page */ +if(!$imspector_config["enable"] || !$imspector_config["iface_array"] || !$imspector_config["proto_array"]) + Header("Location: /pkg_edit.php?xml=imspector.xml&id=0"); + +$pgtitle = "Services: IMSpector Log Viewer"; +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +//$pfSenseHead->addMeta(""); +//echo $pfSenseHead->getHTML(); +?> + + + +
+ + +
+ + +var section = 'none'; +var moveit = 1; +var the_timeout; + +function xmlhttpPost() +{ + var xmlHttpReq = false; + var self = this; + + if (window.XMLHttpRequest) + self.xmlHttpReq = new XMLHttpRequest(); + else if (window.ActiveXObject) + self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); + + self.xmlHttpReq.open('POST', 'services_imspector_logs.php', true); + self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + + self.xmlHttpReq.onreadystatechange = function() { + if (self.xmlHttpReq && self.xmlHttpReq.readyState == 4) + updatepage(self.xmlHttpReq.responseText); + } + + document.getElementById('im_status').style.display = "inline"; + self.xmlHttpReq.send("mode=render§ion=" + section); +} + +function updatepage(str) +{ + /* update the list of conversations ( if we need to ) */ + var parts = str.split("--END--\\n"); + var lines = parts[0].split("\\n"); + + for (var line = 0 ; line < lines.length ; line ++) { + var a = lines[line].split("|"); + + if (!a[1] || !a[2] || !a[3]) continue; + + /* create titling information if needed */ + if (!document.getElementById(a[1])) { + document.getElementById('im_convos').innerHTML += + "
" + a[1] + "
" + + "
"; + } + if (!document.getElementById(a[1] + "_" + a[2])) { + var imageref = ""; + if (a[0]) imageref = "" + a[1] + ""; + document.getElementById(a[1]).innerHTML += + "
" + imageref + a[2] + "
" + + "
"; + } + if (!document.getElementById(a[1] + "_" + a[2] + "_" + a[3])) { + document.getElementById(a[1] + "_" + a[2]).innerHTML += + "
" + a[3] + "
" + + "
"; + } + if (!document.getElementById(a[1] + "_" + a[2] + "_" + a[3] + "_" + a[4])) { + document.getElementById(a[1] + "_" + a[2] + "_" + a[3]).innerHTML += + "
»" + a[4] + "
"; + } + } + + /* determine the title of this conversation */ + var details = parts[1].split(","); + var title = details[0] + " conversation between " + details[ 1 ] + + " and " + details[2] + ""; + if (!details[1]) title = " "; + if (!parts[2]) parts[2] = " "; + + document.getElementById('im_status').style.display = "none"; + var bottom = parseInt(document.getElementById('im_content').scrollTop); + var bottom2 = parseInt(document.getElementById('im_content').style.height); + var absheight = parseInt( bottom + bottom2 ); + if (absheight == document.getElementById('im_content').scrollHeight) { + moveit = 1; + } else { + moveit = 0; + } + document.getElementById('im_content').innerHTML = parts[2]; + if (moveit == 1) { + document.getElementById('im_content').scrollTop = 0; + document.getElementById('im_content').scrollTop = document.getElementById('im_content').scrollHeight; + } + document.getElementById('im_content_title').innerHTML = title; + the_timeout = setTimeout( "xmlhttpPost();", 5000 ); +} + +function setsection(value) +{ + section = value; + clearTimeout(the_timeout); + xmlhttpPost(); + document.getElementById('im_content').scrollTop = 0; + document.getElementById('im_content').scrollTop = document.getElementById('im_content').scrollHeight; +} + +EOD; +print($zz); +?> + + + + + +
+
 
+ + + + + +
+
+
+
+
+
+
+ + + +
+ + + -- cgit v1.2.3