Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2003-2004 Manuel Kasper 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("guiconfig.inc"); require_once("interfaces.inc"); require_once("rrd.inc"); require_once("filter.inc"); require_once("system.inc"); require_once("pfsense-utils.inc"); require_once("services.inc"); function clear_all_log_files() { killbyname('syslogd'); $clog_files = array('dhcpd', 'filter', 'gateways', 'ipsec', 'l2tps', 'lighttpd', 'ntpd', 'openvpn', 'poes', 'portalauth', 'ppps', 'pptps', 'relayd', 'resolver', 'routing', 'system','vpn','wireless'); $log_files = array('squid/access', 'squid/cache', 'squid/store'); foreach ($clog_files as $lfile) { clear_clog("/var/log/{$lfile}.log", false); } foreach ($log_files as $lfile) { clear_log("/var/log/{$lfile}.log", false); } system_syslogd_start(); killbyname('dhcpd'); services_dhcpd_configure(); } function is_valid_syslog_server($target) { return (is_ipaddr($target) || is_ipaddrwithport($target) || is_hostname($target) || is_hostnamewithport($target)); } if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pconfig = array(); $pconfig['rrdenable'] = isset($config['rrd']['enable']); $pconfig['reverse'] = isset($config['syslog']['reverse']); $pconfig['nentries'] = !empty($config['syslog']['nentries']) ? $config['syslog']['nentries'] : 50; $pconfig['remoteserver'] = !empty($config['syslog']['remoteserver']) ? $config['syslog']['remoteserver'] : null; $pconfig['remoteserver2'] = !empty($config['syslog']['remoteserver2']) ? $config['syslog']['remoteserver2'] : null; $pconfig['remoteserver3'] = !empty($config['syslog']['remoteserver3']) ? $config['syslog']['remoteserver3'] : null; $pconfig['sourceip'] = !empty($config['syslog']['sourceip']) ? $config['syslog']['sourceip'] : null; $pconfig['ipproto'] = !empty($config['syslog']['ipproto']) ? $config['syslog']['ipproto'] : null; $pconfig['filter'] = isset($config['syslog']['filter']); $pconfig['dhcp'] = isset($config['syslog']['dhcp']); $pconfig['portalauth'] = isset($config['syslog']['portalauth']); $pconfig['vpn'] = isset($config['syslog']['vpn']); $pconfig['apinger'] = isset($config['syslog']['apinger']); $pconfig['relayd'] = isset($config['syslog']['relayd']); $pconfig['hostapd'] = isset($config['syslog']['hostapd']); $pconfig['logall'] = isset($config['syslog']['logall']); $pconfig['system'] = isset($config['syslog']['system']); $pconfig['enable'] = isset($config['syslog']['enable']); $pconfig['logdefaultblock'] = empty($config['syslog']['nologdefaultblock']); $pconfig['logdefaultpass'] = empty($config['syslog']['nologdefaultpass']); $pconfig['logbogons'] = empty($config['syslog']['nologbogons']); $pconfig['logprivatenets'] = empty($config['syslog']['nologprivatenets']); $pconfig['loglighttpd'] = empty($config['syslog']['nologlighttpd']); $pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions']; $pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']); $pconfig['logfilesize'] = !empty($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : null; } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($_POST['action']) && $_POST['action'] == "resetlogs") { clear_all_log_files(); $savemsg = gettext("The log files have been reset."); } elseif (!empty($_POST['action']) && $_POST['action'] == "ResetRRD") { $savemsg = gettext('RRD data has been cleared.'); mwexec('/bin/rm /var/db/rrd/*'); enable_rrd_graphing(); setup_gateways_monitor(); } else { $input_errors = array(); $pconfig = $_POST; /* input validation */ if (!empty($pconfig['enable']) && !is_valid_syslog_server($pconfig['remoteserver'])) { $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1."); } if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver2']) && !is_valid_syslog_server($pconfig['remoteserver2'])) { $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2."); } if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver3']) && !is_valid_syslog_server($_POST['remoteserver3'])) { $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3."); } if (($pconfig['nentries'] < 5) || ($pconfig['nentries'] > 2000)) { $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000."); } if (!empty($pconfig['logfilesize']) && (strlen($pconfig['logfilesize']) > 0)) { if (!is_numeric($pconfig['logfilesize']) || ($pconfig['logfilesize'] < 5120)) { $input_errors[] = gettext("Log file size must be a positive integer greater than 5120."); } } if (count($input_errors) == 0) { $config['syslog']['reverse'] = !empty($pconfig['reverse']) ? true : false; $config['syslog']['nentries'] = (int)$pconfig['nentries']; if (isset($_POST['logfilesize']) && (strlen($pconfig['logfilesize']) > 0)) { $config['syslog']['logfilesize'] = (int)$pconfig['logfilesize']; } elseif (isset($config['syslog']['logfilesize'])) { unset($config['syslog']['logfilesize']); } $config['syslog']['remoteserver'] = $pconfig['remoteserver']; $config['syslog']['remoteserver2'] = $pconfig['remoteserver2']; $config['syslog']['remoteserver3'] = $pconfig['remoteserver3']; $config['syslog']['sourceip'] = $pconfig['sourceip']; $config['syslog']['ipproto'] = $pconfig['ipproto']; $config['syslog']['filter'] = !empty($pconfig['filter']); $config['syslog']['dhcp'] = !empty($pconfig['dhcp']); $config['syslog']['portalauth'] = !empty($pconfig['portalauth']); $config['syslog']['vpn'] = !empty($pconfig['vpn']); $config['syslog']['apinger'] = !empty($pconfig['apinger']); $config['syslog']['relayd'] = !empty($pconfig['relayd']); $config['syslog']['hostapd'] = !empty($pconfig['hostapd']); $config['syslog']['logall'] = !empty($pconfig['logall']); $config['syslog']['system'] = !empty($pconfig['system']); $config['syslog']['disablelocallogging'] = !empty($pconfig['disablelocallogging']); $config['syslog']['enable'] = !empty($pconfig['enable']); $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']); $oldnologdefaultpass = isset($config['syslog']['nologdefaultpass']); $oldnologbogons = isset($config['syslog']['nologbogons']); $oldnologprivatenets = isset($config['syslog']['nologprivatenets']); $oldnologlighttpd = isset($config['syslog']['nologlighttpd']); $config['syslog']['nologdefaultblock'] = empty($pconfig['logdefaultblock']); $config['syslog']['nologdefaultpass'] = empty($pconfig['logdefaultpass']); $config['syslog']['nologbogons'] = empty($pconfig['logbogons']); $config['syslog']['nologprivatenets'] = empty($pconfig['logprivatenets']); $config['syslog']['nologlighttpd'] = empty($pconfig['loglighttpd']); if (is_numeric($pconfig['filterdescriptions']) && $pconfig['filterdescriptions'] > 0) $config['syslog']['filterdescriptions'] = $pconfig['filterdescriptions']; elseif (isset($config['syslog']['filterdescriptions'])) { unset($config['syslog']['filterdescriptions']); } $config['rrd']['enable'] = !empty($pconfig['rrdenable']); write_config(); $retval = 0; $retval = system_syslogd_start(); if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock'])) || ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) || ($oldnologbogons !== isset($config['syslog']['nologbogons'])) || ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) $retval |= filter_configure(); $savemsg = get_std_save_message(); if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) { log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator.")); mwexec_bg('/usr/local/etc/rc.restart_webgui 2'); $savemsg .= "
" . gettext("WebGUI process is restarting."); } filter_pflog_start(); enable_rrd_graphing(); setup_gateways_monitor(); } } } legacy_html_escape_form_data($pconfig); include("head.inc"); ?>
0) { print_input_errors($input_errors); } if (isset($savemsg)) { print_info_box($savemsg); } ?>
onclick="enable_change(false)" />  
  " onclick="enable_change(true)" /> " />


/>

/>
/>
/>
/>
/>
onclick="enable_change(false)" />
"/>
onclick="enable_change(false)" />
onclick="check_everything();" />

/>
/>
/>
/>
/>
/>
/>
/>
" onclick="enable_change(true)" />

.