mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add code to allow unauth graphs by IP range, useful for control panels who can use a passthrough (ie php fpassthru) of 'secret' urls, or stats pages, or...
git-svn-id: http://www.observium.org/svn/observer/trunk@1750 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
<?php
|
||||
|
||||
if(isset($_GET['debug'])) {
|
||||
include_once("Net/IPv4.php");
|
||||
|
||||
if (isset($_GET['debug']))
|
||||
{
|
||||
$debug = TRUE;
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 0);
|
||||
ini_set('log_errors', 0);
|
||||
ini_set('error_reporting', E_ALL);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$debug = FALSE;
|
||||
ini_set('display_errors', 0);
|
||||
ini_set('display_startup_errors', 0);
|
||||
@@ -46,12 +51,29 @@ if(isset($_GET['debug'])) {
|
||||
|
||||
$graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
|
||||
|
||||
if(is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) {
|
||||
if (is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php"))
|
||||
{
|
||||
if (isset($config['allow_unauth_graphs_cidr']) && count($config['allow_unauth_graphs_cidr']) > 0)
|
||||
{
|
||||
foreach ($config['allow_unauth_graphs_cidr'] as $range)
|
||||
{
|
||||
if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $range))
|
||||
{
|
||||
$auth = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$auth)
|
||||
{
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php");
|
||||
if($auth) {
|
||||
}
|
||||
if ($auth)
|
||||
{
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
graph_error("Graph Template Missing");
|
||||
}
|
||||
|
||||
@@ -98,15 +120,21 @@ if(!$auth)
|
||||
header('Content-type: image/png');
|
||||
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);
|
||||
unlink($graphfile);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($width < 200)
|
||||
{
|
||||
graph_error("Draw Error");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
graph_error("Error Drawing Graph");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($width < 200)
|
||||
{
|
||||
graph_error("Def Error");
|
||||
|
@@ -171,6 +171,7 @@ $config['device_traffic_descr'] = array('/loopback/','/vlan/','/tunnel/','/:\d
|
||||
### Authentication
|
||||
|
||||
$config['allow_unauth_graphs'] = 0; ## Allow graphs to be viewed by anyone
|
||||
$config['allow_unauth_graphs_cidr'] = array(); # Allow graphs to be viewed without authorisation from certain IP ranges
|
||||
$config['auth_mechanism'] = "mysql"; # Auth Type.
|
||||
|
||||
### Sensors
|
||||
|
Reference in New Issue
Block a user