summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-12-27 19:44:25 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-12-27 19:44:25 +0000
commit7cbad42249b75f023b7bd68d7523d5cb51d31a0d (patch)
treeb402d1d7ae3d9eeffcf0bde1c56ebf92c6bbabf6
parentb8dcbf4542108642072fdabec6e474b87588bebc (diff)
downloadpfsense-7cbad42249b75f023b7bd68d7523d5cb51d31a0d.zip
pfsense-7cbad42249b75f023b7bd68d7523d5cb51d31a0d.tar.gz
Query SNMP over VPN fix
Ticket #743
-rw-r--r--etc/inc/services.inc14
-rwxr-xr-xusr/local/www/services_snmp.php14
2 files changed, 25 insertions, 3 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index a2fa3e3..6ac21b7 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -651,9 +651,15 @@ begemotSnmpdCommunityDisable = 1
EOD;
+ if(isset($config['snmpd']['bindlan'])) {
+ $bind_to_ip = $config['interfaces']['lan']['ipaddr'];
+ } else {
+ $bind_to_ip = "0.0.0.0";
+ }
+
if(is_port( $config['snmpd']['pollport'] )) {
$snmpdconf .= <<<EOD
-begemotSnmpdPortStatus.0.0.0.0.{$config['snmpd']['pollport']} = 1
+begemotSnmpdPortStatus.{$bind_to_ip}.{$config['snmpd']['pollport']} = 1
EOD;
@@ -702,9 +708,13 @@ EOD;
fwrite($fd, $snmpdconf);
fclose($fd);
+ if (isset($config['snmpd']['bindlan'])) {
+ $bindlan = "";
+ }
+
/* run bsnmpd */
mwexec("/usr/sbin/bsnmpd -c {$g['varetc_path']}/snmpd.conf" .
- " -p {$g['varrun_path']}/snmpd.pid");
+ "{$bindlan} -p {$g['varrun_path']}/snmpd.pid");
if ($g['booting'])
echo "done.\n";
diff --git a/usr/local/www/services_snmp.php b/usr/local/www/services_snmp.php
index 458ad20..9f565d9 100755
--- a/usr/local/www/services_snmp.php
+++ b/usr/local/www/services_snmp.php
@@ -61,6 +61,7 @@ $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['bindlan'] = isset($config['snmpd']['bindlan']);
if ($_POST) {
@@ -129,6 +130,7 @@ if ($_POST) {
$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']['bindlan'] = $_POST['bindlan'] ? true : false;
write_config();
@@ -187,6 +189,7 @@ function enable_change(whichone) {
document.iform.syscontact.disabled = false;
document.iform.rocommunity.disabled = false;
document.iform.trapenable.disabled = false;
+ document.iform.bindlan.disabled = false;
/* disabled until some docs show up on what this does.
document.iform.rwenable.disabled = false;
if( document.iform.rwenable.checked == true )
@@ -232,6 +235,8 @@ function enable_change(whichone) {
document.iform.mibii.disabled = true;
document.iform.netgraph.disabled = true;
document.iform.pf.disabled = true;
+
+ document.iform.bindlan.disabled = true;
}
}
//-->
@@ -371,7 +376,14 @@ function enable_change(whichone) {
<input name="pf" type="checkbox" id="pf" value="yes" <?php if ($pconfig['pf']) echo "checked"; ?> >PF
</td>
</tr>
-
+ <tr>
+ <td width="22%" valign="top" class="vtable"></td>
+ <td width="78%" class="vtable">
+ <input name="bindlan" type="checkbox" value="yes" <?php if ($pconfig['bindlan']) echo "checked"; ?>> <strong>Bind to LAN interface only</strong>
+ <br>
+ This option can be useful when trying to access the SNMP agent
+ by the LAN interface's IP address through a VPN tunnel terminated on the WAN interface.</td>
+ </tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
OpenPOWER on IntegriCloud