. 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. */ /* pfSense_MODULE: snmp */ ##|+PRIV ##|*IDENT=page-services-snmp ##|*NAME=Services: SNMP page ##|*DESCR=Allow access to the 'Services: SNMP' page. ##|*MATCH=services_snmp.php* ##|-PRIV require("guiconfig.inc"); require_once("functions.inc"); if (!is_array($config['snmpd'])) { $config['snmpd'] = array(); $config['snmpd']['rocommunity'] = "public"; $config['snmpd']['pollport'] = "161"; } if (!is_array($config['snmpd']['modules'])) { $config['snmpd']['modules'] = array(); $config['snmpd']['modules']['mibii'] = true; $config['snmpd']['modules']['netgraph'] = true; $config['snmpd']['modules']['pf'] = true; $config['snmpd']['modules']['hostres'] = true; $config['snmpd']['modules']['bridge'] = true; } $pconfig['enable'] = isset($config['snmpd']['enable']); $pconfig['pollport'] = $config['snmpd']['pollport']; $pconfig['syslocation'] = $config['snmpd']['syslocation']; $pconfig['syscontact'] = $config['snmpd']['syscontact']; $pconfig['rocommunity'] = $config['snmpd']['rocommunity']; /* disabled until some docs show up on what this does. $pconfig['rwenable'] = isset($config['snmpd']['rwenable']); $pconfig['rwcommunity'] = $config['snmpd']['rwcommunity']; */ $pconfig['trapenable'] = isset($config['snmpd']['trapenable']); $pconfig['trapserver'] = $config['snmpd']['trapserver']; $pconfig['trapserverport'] = $config['snmpd']['trapserverport']; $pconfig['trapstring'] = $config['snmpd']['trapstring']; $pconfig['mibii'] = isset($config['snmpd']['modules']['mibii']); $pconfig['netgraph'] = isset($config['snmpd']['modules']['netgraph']); $pconfig['pf'] = isset($config['snmpd']['modules']['pf']); $pconfig['hostres'] = isset($config['snmpd']['modules']['hostres']); $pconfig['bridge'] = isset($config['snmpd']['modules']['bridge']); $pconfig['bindlan'] = isset($config['snmpd']['bindlan']); if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['enable']) { if (strstr($_POST['syslocation'],"#")) $input_errors[] = gettext("Invalid character '#' in system location"); if (strstr($_POST['syscontact'],"#")) $input_errors[] = gettext("Invalid character '#' in system contact"); if (strstr($_POST['rocommunity'],"#")) $input_errors[] = gettext("Invalid character '#' in read community string"); $reqdfields = explode(" ", "rocommunity"); $reqdfieldsn = array(gettext("Community")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); $reqdfields = explode(" ", "pollport"); $reqdfieldsn = array(gettext("Polling Port")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } if ($_POST['trapenable']) { if (strstr($_POST['trapstring'],"#")) $input_errors[] = gettext("Invalid character '#' in SNMP trap string"); $reqdfields = explode(" ", "trapserver"); $reqdfieldsn = array(gettext("Trap server")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); $reqdfields = explode(" ", "trapserverport"); $reqdfieldsn = array(gettext("Trap server port")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); $reqdfields = explode(" ", "trapstring"); $reqdfieldsn = array(gettext("Trap string")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } /* disabled until some docs show up on what this does. if ($_POST['rwenable']) { $reqdfields = explode(" ", "rwcommunity"); $reqdfieldsn = explode(",", "Write community string"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } */ if (!$input_errors) { $config['snmpd']['enable'] = $_POST['enable'] ? true : false; $config['snmpd']['pollport'] = $_POST['pollport']; $config['snmpd']['syslocation'] = $_POST['syslocation']; $config['snmpd']['syscontact'] = $_POST['syscontact']; $config['snmpd']['rocommunity'] = $_POST['rocommunity']; /* disabled until some docs show up on what this does. $config['snmpd']['rwenable'] = $_POST['rwenable'] ? true : false; $config['snmpd']['rwcommunity'] = $_POST['rwcommunity']; */ $config['snmpd']['trapenable'] = $_POST['trapenable'] ? true : false; $config['snmpd']['trapserver'] = $_POST['trapserver']; $config['snmpd']['trapserverport'] = $_POST['trapserverport']; $config['snmpd']['trapstring'] = $_POST['trapstring']; $config['snmpd']['modules']['mibii'] = $_POST['mibii'] ? true : false; $config['snmpd']['modules']['netgraph'] = $_POST['netgraph'] ? true : false; $config['snmpd']['modules']['pf'] = $_POST['pf'] ? true : false; $config['snmpd']['modules']['hostres'] = $_POST['hostres'] ? true : false; $config['snmpd']['modules']['bridge'] = $_POST['bridge'] ? true : false; $config['snmpd']['bindlan'] = $_POST['bindlan'] ? true : false; write_config(); $retval = 0; $retval = services_snmpd_configure(); $savemsg = get_std_save_message($retval); } } $pgtitle = array(gettext("Services"),gettext("SNMP")); include("head.inc"); ?>
*/ ?>
onClick="enable_change(this)">




  onClick="enable_change(this)"> Enable Write Community String
Write community string
Please use something other then "private" here
 
onClick="enable_change(this)">






 
 
>
>
>
>
>
  " onClick="enable_change(true)">