mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Security fix: unauthorized access (#10091)
* Security fix: unauthorized access Affects nginx users: Moved php files outside of public html directory (Apache was protected by .htaccess) Affects all users: Some files did not check for authentication and could disclose some info. Better checks before including files from user input * git mv html/includes/ includes/html git mv html/pages/ includes/html/
This commit is contained in:
@@ -101,6 +101,7 @@ class Plugins
|
|||||||
*/
|
*/
|
||||||
public static function load($file, $pluginName)
|
public static function load($file, $pluginName)
|
||||||
{
|
{
|
||||||
|
chdir(Config::get('install_dir') . '/html');
|
||||||
$plugin = self::getInstance($file, $pluginName);
|
$plugin = self::getInstance($file, $pluginName);
|
||||||
|
|
||||||
$class = get_class($plugin);
|
$class = get_class($plugin);
|
||||||
@@ -112,6 +113,8 @@ class Plugins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chdir(Config::get('install_dir'));
|
||||||
|
|
||||||
return $plugin;
|
return $plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,23 +176,23 @@ class Plugins
|
|||||||
*/
|
*/
|
||||||
public static function call($hook, $params = false)
|
public static function call($hook, $params = false)
|
||||||
{
|
{
|
||||||
|
chdir(Config::get('install_dir') . '/html');
|
||||||
self::start();
|
self::start();
|
||||||
|
|
||||||
if (empty(self::$plugins[$hook])) {
|
if (!empty(self::$plugins[$hook])) {
|
||||||
return;
|
foreach (self::$plugins[$hook] as $name) {
|
||||||
}
|
try {
|
||||||
|
if (!is_array($params)) {
|
||||||
foreach (self::$plugins[$hook] as $name) {
|
@call_user_func([$name, $hook]);
|
||||||
try {
|
} else {
|
||||||
if (!is_array($params)) {
|
@call_user_func_array([$name, $hook], $params);
|
||||||
@call_user_func([$name, $hook]);
|
}
|
||||||
} else {
|
} catch (\Exception $e) {
|
||||||
@call_user_func_array([$name, $hook], $params);
|
Log::error($e);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error($e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
chdir(Config::get('install_dir'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -46,7 +46,7 @@ class Graph
|
|||||||
$types = [];
|
$types = [];
|
||||||
|
|
||||||
// find the subtypes defined in files
|
// find the subtypes defined in files
|
||||||
foreach (glob(base_path("/html/includes/graphs/$type/*.inc.php")) as $file) {
|
foreach (glob(base_path("/includes/html/graphs/$type/*.inc.php")) as $file) {
|
||||||
$type = basename($file, '.inc.php');
|
$type = basename($file, '.inc.php');
|
||||||
if ($type != 'auth') {
|
if ($type != 'auth') {
|
||||||
$types[] = $type;
|
$types[] = $type;
|
||||||
|
@@ -12,22 +12,19 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// FUA
|
|
||||||
|
|
||||||
use LibreNMS\Authentication\LegacyAuth;
|
use LibreNMS\Authentication\LegacyAuth;
|
||||||
|
|
||||||
$init_modules = array('web', 'auth', 'alerts', 'laravel');
|
$init_modules = array('web', 'auth', 'alerts');
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
|
if (!LegacyAuth::check()) {
|
||||||
|
die('Unauthorized');
|
||||||
|
}
|
||||||
|
|
||||||
set_debug(isset($_REQUEST['debug']) ? $_REQUEST['debug'] : false);
|
set_debug(isset($_REQUEST['debug']) ? $_REQUEST['debug'] : false);
|
||||||
|
|
||||||
if (!LegacyAuth::check()) {
|
|
||||||
echo 'unauthenticated';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['type']) == 1) {
|
if (preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['type']) == 1) {
|
||||||
if (file_exists('includes/forms/'.$_POST['type'].'.inc.php')) {
|
if (file_exists('includes/html/forms/'.$_POST['type'].'.inc.php')) {
|
||||||
include_once 'includes/forms/'.$_POST['type'].'.inc.php';
|
include_once 'includes/html/forms/'.$_POST['type'].'.inc.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,18 +19,17 @@ $init_modules = array('web', 'auth');
|
|||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
if (!LegacyAuth::check()) {
|
if (!LegacyAuth::check()) {
|
||||||
echo "Unauthenticated\n";
|
die('Unauthorized');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_debug($_REQUEST['debug']);
|
set_debug($_REQUEST['debug']);
|
||||||
|
|
||||||
$type = mres($_REQUEST['type']);
|
$type = basename($_REQUEST['type']);
|
||||||
|
|
||||||
if (isset($type) && file_exists("includes/list/$type.inc.php")) {
|
if ($type && file_exists("includes/html/list/$type.inc.php")) {
|
||||||
header('Content-type: application/json');
|
header('Content-type: application/json');
|
||||||
|
|
||||||
list($results, $more) = include "includes/list/$type.inc.php";
|
list($results, $more) = include "includes/html/list/$type.inc.php";
|
||||||
|
|
||||||
die(json_encode([
|
die(json_encode([
|
||||||
'results' => $results,
|
'results' => $results,
|
||||||
|
@@ -15,13 +15,12 @@ use LibreNMS\Authentication\LegacyAuth;
|
|||||||
$init_modules = array('web', 'auth');
|
$init_modules = array('web', 'auth');
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
set_debug($_REQUEST['debug']);
|
|
||||||
|
|
||||||
if (!LegacyAuth::check()) {
|
if (!LegacyAuth::check()) {
|
||||||
echo 'unauthenticated';
|
die('Unauthorized');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_debug($_REQUEST['debug']);
|
||||||
|
|
||||||
if (is_numeric($_GET['device_id'])) {
|
if (is_numeric($_GET['device_id'])) {
|
||||||
foreach (dbFetch('SELECT * FROM ports WHERE device_id = ?', array($_GET['device_id'])) as $interface) {
|
foreach (dbFetch('SELECT * FROM ports WHERE device_id = ?', array($_GET['device_id'])) as $interface) {
|
||||||
$interface = cleanPort($interface);
|
$interface = cleanPort($interface);
|
||||||
|
@@ -21,7 +21,7 @@ $init_modules = array('web', 'auth');
|
|||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
if (!LegacyAuth::check()) {
|
if (!LegacyAuth::check()) {
|
||||||
die('Unauthorized.');
|
die('Unauthorized');
|
||||||
}
|
}
|
||||||
|
|
||||||
set_debug($_REQUEST['debug']);
|
set_debug($_REQUEST['debug']);
|
||||||
|
@@ -23,14 +23,13 @@ if (isset($_SESSION['stage']) && $_SESSION['stage'] == 2) {
|
|||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
if (!LegacyAuth::check()) {
|
if (!LegacyAuth::check()) {
|
||||||
echo "Unauthenticated\n";
|
die('Unauthorized');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_debug($_REQUEST['debug']);
|
set_debug($_REQUEST['debug']);
|
||||||
$id = str_replace('/', '', $_REQUEST['id']);
|
$id = basename($_REQUEST['id']);
|
||||||
|
|
||||||
if (isset($id)) {
|
if ($id && is_file($config['install_dir'] . "/includes/html/output/$id.inc.php")) {
|
||||||
require $config['install_dir'] . "/html/includes/output/$id.inc.php";
|
require $config['install_dir'] . "/includes/html/output/$id.inc.php";
|
||||||
}
|
}
|
||||||
|
@@ -29,14 +29,14 @@ $init_modules = array('web', 'auth');
|
|||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
if (!LegacyAuth::check()) {
|
if (!LegacyAuth::check()) {
|
||||||
die('Unauthorized.');
|
die('Unauthorized');
|
||||||
}
|
}
|
||||||
|
|
||||||
set_debug($_REQUEST['debug']);
|
set_debug($_REQUEST['debug']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Levenshtein Sort
|
* Levenshtein Sort
|
||||||
* @param string $base Comparisson basis
|
* @param string $base Comparison basis
|
||||||
* @param array $obj Object to sort
|
* @param array $obj Object to sort
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@@ -5,13 +5,12 @@ use LibreNMS\Authentication\LegacyAuth;
|
|||||||
$init_modules = array('web', 'auth');
|
$init_modules = array('web', 'auth');
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
set_debug($_REQUEST['debug']);
|
|
||||||
|
|
||||||
if (!LegacyAuth::check()) {
|
if (!LegacyAuth::check()) {
|
||||||
echo "Unauthenticated\n";
|
die('Unauthorized');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_debug($_REQUEST['debug']);
|
||||||
|
|
||||||
$device = array();
|
$device = array();
|
||||||
$ports = array();
|
$ports = array();
|
||||||
$bgp = array();
|
$bgp = array();
|
||||||
@@ -24,7 +23,6 @@ if (isset($_REQUEST['search'])) {
|
|||||||
$found = 0;
|
$found = 0;
|
||||||
|
|
||||||
if ($_REQUEST['type'] == 'group') {
|
if ($_REQUEST['type'] == 'group') {
|
||||||
include_once '../includes/device-groups.inc.php';
|
|
||||||
foreach (dbFetchRows("SELECT id,name FROM device_groups WHERE name LIKE ?", ["%$search%"]) as $group) {
|
foreach (dbFetchRows("SELECT id,name FROM device_groups WHERE name LIKE ?", ["%$search%"]) as $group) {
|
||||||
if ($_REQUEST['map']) {
|
if ($_REQUEST['map']) {
|
||||||
$results[] = array(
|
$results[] = array(
|
||||||
|
@@ -18,8 +18,7 @@ $init_modules = array('web', 'auth');
|
|||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
if (!LegacyAuth::check()) {
|
if (!LegacyAuth::check()) {
|
||||||
echo "Unauthenticated\n";
|
die('Unauthorized');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_debug($_REQUEST['debug']);
|
set_debug($_REQUEST['debug']);
|
||||||
@@ -34,13 +33,11 @@ if (isset($_REQUEST['sort']) && is_array($_POST['sort'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$searchPhrase = mres($_REQUEST['searchPhrase']);
|
$searchPhrase = $_REQUEST['searchPhrase'];
|
||||||
$id = mres($_REQUEST['id']);
|
$id = basename($_REQUEST['id']);
|
||||||
$response = array();
|
$response = array();
|
||||||
|
|
||||||
if (isset($id)) {
|
if ($id && file_exists("includes/html/table/$id.inc.php")) {
|
||||||
if (file_exists("includes/table/$id.inc.php")) {
|
header('Content-type: application/json');
|
||||||
header('Content-type: application/json');
|
include_once "includes/html/table/$id.inc.php";
|
||||||
include_once "includes/table/$id.inc.php";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
17
html/csv.php
17
html/csv.php
@@ -12,20 +12,27 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$init_modules = array('web', 'auth');
|
use LibreNMS\Authentication\LegacyAuth;
|
||||||
|
use LibreNMS\Config;
|
||||||
|
|
||||||
|
$init_modules = ['web', 'auth'];
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
|
if (!LegacyAuth::check()) {
|
||||||
|
die('Unauthorized');
|
||||||
|
}
|
||||||
|
|
||||||
set_debug(strpos($_SERVER['PATH_INFO'], 'debug'));
|
set_debug(strpos($_SERVER['PATH_INFO'], 'debug'));
|
||||||
|
|
||||||
$report = mres($vars['report']);
|
$report = basename($vars['report']);
|
||||||
if (!empty($report) && file_exists("includes/reports/$report.csv.inc.php")) {
|
if ($report && file_exists(Config::get('install_dir') . "/includes/html/reports/$report.csv.inc.php")) {
|
||||||
if ($debug === false) {
|
if ($debug === false) {
|
||||||
header('Content-Type: text/csv');
|
header('Content-Type: text/csv');
|
||||||
header('Content-Disposition: attachment; filename="'.$report.'-'.date('Ymd').'.csv"');
|
header('Content-Disposition: attachment; filename="'.$report.'-'.date('Ymd').'.csv"');
|
||||||
}
|
}
|
||||||
|
|
||||||
$csv = array();
|
$csv = [];
|
||||||
require $config['install_dir'] . "/html/includes/reports/$report.csv.inc.php";
|
require Config::get('install_dir') . "/includes/html/reports/$report.csv.inc.php";
|
||||||
foreach ($csv as $line) {
|
foreach ($csv as $line) {
|
||||||
echo implode(',', $line)."\n";
|
echo implode(',', $line)."\n";
|
||||||
}
|
}
|
||||||
|
@@ -19,18 +19,18 @@ if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted
|
|||||||
$title = generate_device_link($device);
|
$title = generate_device_link($device);
|
||||||
$title .= ' :: Port '.generate_port_link($port);
|
$title .= ' :: Port '.generate_port_link($port);
|
||||||
$auth = true;
|
$auth = true;
|
||||||
|
|
||||||
|
$in = snmp_get($device, 'ifHCInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB');
|
||||||
|
if (empty($in)) {
|
||||||
|
$in = snmp_get($device, 'ifInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB');
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = snmp_get($device, 'ifHCOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB');
|
||||||
|
if (empty($out)) {
|
||||||
|
$out = snmp_get($device, 'ifOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB');
|
||||||
|
}
|
||||||
|
|
||||||
|
$time = time();
|
||||||
|
|
||||||
|
printf("%lf|%s|%s\n", time(), $in, $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
$in = snmp_get($device, 'ifHCInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB');
|
|
||||||
if (empty($in)) {
|
|
||||||
$in = snmp_get($device, 'ifInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB');
|
|
||||||
}
|
|
||||||
|
|
||||||
$out = snmp_get($device, 'ifHCOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB');
|
|
||||||
if (empty($out)) {
|
|
||||||
$out = snmp_get($device, 'ifOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB');
|
|
||||||
}
|
|
||||||
|
|
||||||
$time = time();
|
|
||||||
|
|
||||||
printf("%lf|%s|%s\n", time(), $in, $out);
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LibreNMS
|
* LibreNMS
|
||||||
*
|
*
|
||||||
@@ -10,17 +9,24 @@
|
|||||||
* @copyright (C) 2006 - 2012 Adam Armstrong
|
* @copyright (C) 2006 - 2012 Adam Armstrong
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use LibreNMS\Authentication\LegacyAuth;
|
||||||
|
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
|
|
||||||
$init_modules = array('web', 'graphs');
|
$init_modules = array('web', 'graphs', 'auth');
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
|
$auth = LegacyAuth::check() || is_client_authorized($_SERVER['REMOTE_ADDR']);
|
||||||
|
|
||||||
|
if (!$auth) {
|
||||||
|
die('Unauthorized');
|
||||||
|
}
|
||||||
|
|
||||||
set_debug(isset($_GET['debug']));
|
set_debug(isset($_GET['debug']));
|
||||||
|
|
||||||
rrdtool_initialize(false);
|
rrdtool_initialize(false);
|
||||||
|
|
||||||
require $config['install_dir'] . '/html/includes/graphs/graph.inc.php';
|
require $config['install_dir'] . '/includes/html/graphs/graph.inc.php';
|
||||||
|
|
||||||
rrdtool_close();
|
rrdtool_close();
|
||||||
|
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
deny from all
|
|
@@ -1,6 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$ds_in = 'IN';
|
|
||||||
$ds_out = 'OUT';
|
|
||||||
|
|
||||||
require 'includes/graphs/generic_data.inc.php';
|
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LibreNMS
|
* LibreNMS
|
||||||
*
|
*
|
||||||
@@ -12,10 +11,14 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use LibreNMS\Config;
|
||||||
|
|
||||||
$init_modules = array('web', 'alerts');
|
$init_modules = array('web', 'alerts');
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
use LibreNMS\Config;
|
if (!Auth::check()) {
|
||||||
|
die('Unauthorized');
|
||||||
|
}
|
||||||
|
|
||||||
$app = new \Slim\Slim();
|
$app = new \Slim\Slim();
|
||||||
|
|
||||||
@@ -30,7 +33,7 @@ if (Config::get('api.cors.enabled') === true) {
|
|||||||
$app->add($cors);
|
$app->add($cors);
|
||||||
}
|
}
|
||||||
|
|
||||||
require $config['install_dir'] . '/html/includes/api_functions.inc.php';
|
require $config['install_dir'] . '/includes/html/api_functions.inc.php';
|
||||||
$app->setName('api');
|
$app->setName('api');
|
||||||
|
|
||||||
$app->notFound(function () use ($app) {
|
$app->notFound(function () use ($app) {
|
||||||
|
@@ -28,6 +28,10 @@ $msg_box = array();
|
|||||||
$init_modules = array('web', 'auth');
|
$init_modules = array('web', 'auth');
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
|
if (!Auth::check()) {
|
||||||
|
die('Unauthorized');
|
||||||
|
}
|
||||||
|
|
||||||
set_debug(str_contains($_SERVER['REQUEST_URI'], 'debug'));
|
set_debug(str_contains($_SERVER['REQUEST_URI'], 'debug'));
|
||||||
|
|
||||||
LibreNMS\Plugins::start();
|
LibreNMS\Plugins::start();
|
||||||
@@ -169,7 +173,7 @@ if (empty($_SESSION['screen_width']) && empty($_SESSION['screen_height'])) {
|
|||||||
|
|
||||||
if ((isset($vars['bare']) && $vars['bare'] != "yes") || !isset($vars['bare'])) {
|
if ((isset($vars['bare']) && $vars['bare'] != "yes") || !isset($vars['bare'])) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
require 'includes/print-menubar.php';
|
require 'includes/html/print-menubar.php';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "<style>body { padding-top: 0px !important;
|
echo "<style>body { padding-top: 0px !important;
|
||||||
@@ -191,15 +195,15 @@ if (isset($devel) || isset($vars['devel'])) {
|
|||||||
echo("</pre>");
|
echo("</pre>");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($vars['page']) && !strstr("..", $vars['page']) && is_file("pages/" . $vars['page'] . ".inc.php")) {
|
$vars['page'] = basename($vars['page'] ?? '');
|
||||||
require "pages/" . $vars['page'] . ".inc.php";
|
if ($vars['page'] && is_file("includes/html/pages/" . $vars['page'] . ".inc.php")) {
|
||||||
|
require "includes/html/pages/" . $vars['page'] . ".inc.php";
|
||||||
|
} elseif (Config::has('front_page') && is_file('includes/html/' . Config::get('front_page'))) {
|
||||||
|
require 'includes/html/' . Config::get('front_page');
|
||||||
} else {
|
} else {
|
||||||
if (isset($config['front_page']) && is_file($config['front_page'])) {
|
require 'includes/html/pages/front/default.php';
|
||||||
require $config['front_page'];
|
|
||||||
} else {
|
|
||||||
require 'pages/front/default.php';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -18,6 +18,10 @@ $links = 1;
|
|||||||
$init_modules = array('web', 'auth');
|
$init_modules = array('web', 'auth');
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
|
if (!LegacyAuth::check()) {
|
||||||
|
die('Unauthorized');
|
||||||
|
}
|
||||||
|
|
||||||
$options = getopt('d::');
|
$options = getopt('d::');
|
||||||
|
|
||||||
if (set_debug(isset($options['d']))) {
|
if (set_debug(isset($options['d']))) {
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
deny from all
|
|
@@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$link_array = array('page' => 'plugin');
|
|
||||||
|
|
||||||
$pagetitle[] = 'Plugin';
|
|
||||||
|
|
||||||
if ($vars['view'] == 'admin') {
|
|
||||||
include_once 'pages/plugin/admin.inc.php';
|
|
||||||
} else {
|
|
||||||
$plugin = dbFetchRow("SELECT `plugin_name` FROM `plugins` WHERE `plugin_name` = '".$vars['p']."' AND `plugin_active`='1'");
|
|
||||||
if (!empty($plugin)) {
|
|
||||||
include 'plugins/'.$plugin['plugin_name'].'/'.$plugin['plugin_name'].'.inc.php';
|
|
||||||
} else {
|
|
||||||
print_error('This plugin is either disabled or not available.');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -12,9 +12,15 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use LibreNMS\Authentication\LegacyAuth;
|
||||||
|
|
||||||
$init_modules = array('web', 'auth');
|
$init_modules = array('web', 'auth');
|
||||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||||
|
|
||||||
|
if (!LegacyAuth::check()) {
|
||||||
|
die('Unauthorized');
|
||||||
|
}
|
||||||
|
|
||||||
set_debug(strpos($_SERVER['PATH_INFO'], 'debug'));
|
set_debug(strpos($_SERVER['PATH_INFO'], 'debug'));
|
||||||
|
|
||||||
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||||
@@ -37,7 +43,7 @@ $pdf->setTextShadow(array('enabled' => false, 'depth_w' => 0.2, 'depth_h' => 0.2
|
|||||||
if (isset($_GET['report']) && !empty($_GET['report'])) {
|
if (isset($_GET['report']) && !empty($_GET['report'])) {
|
||||||
$report = mres($_GET['report']);
|
$report = mres($_GET['report']);
|
||||||
$pdf->SetHeaderData('../../../../../html/'.$config['title_image'], 40, ucfirst($report), $config['project_name'], array(0, 0, 0), array(0, 64, 128));
|
$pdf->SetHeaderData('../../../../../html/'.$config['title_image'], 40, ucfirst($report), $config['project_name'], array(0, 0, 0), array(0, 64, 128));
|
||||||
include_once "includes/reports/$report.pdf.inc.php";
|
include_once "includes/html/reports/$report.pdf.inc.php";
|
||||||
} else {
|
} else {
|
||||||
$report = 'report';
|
$report = 'report';
|
||||||
}
|
}
|
||||||
|
@@ -760,10 +760,11 @@ function get_graph_subtypes($type, $device = null)
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
$type = basename($type);
|
||||||
$types = array();
|
$types = array();
|
||||||
|
|
||||||
// find the subtypes defined in files
|
// find the subtypes defined in files
|
||||||
if ($handle = opendir($config['install_dir'] . "/html/includes/graphs/$type/")) {
|
if ($handle = opendir($config['install_dir'] . "/includes/html/graphs/$type/")) {
|
||||||
while (false !== ($file = readdir($handle))) {
|
while (false !== ($file = readdir($handle))) {
|
||||||
if ($file != "." && $file != ".." && $file != "auth.inc.php" && strstr($file, ".inc.php")) {
|
if ($file != "." && $file != ".." && $file != "auth.inc.php" && strstr($file, ".inc.php")) {
|
||||||
$types[] = str_replace(".inc.php", "", $file);
|
$types[] = str_replace(".inc.php", "", $file);
|
||||||
|
@@ -161,7 +161,7 @@ function get_graph_by_port_hostname()
|
|||||||
check_port_permission($vars['id'], $device_id);
|
check_port_permission($vars['id'], $device_id);
|
||||||
$app->response->headers->set('Content-Type', get_image_type());
|
$app->response->headers->set('Content-Type', get_image_type());
|
||||||
rrdtool_initialize(false);
|
rrdtool_initialize(false);
|
||||||
include 'includes/graphs/graph.inc.php';
|
include 'includes/html/graphs/graph.inc.php';
|
||||||
rrdtool_close();
|
rrdtool_close();
|
||||||
if ($vars['output'] === 'base64') {
|
if ($vars['output'] === 'base64') {
|
||||||
api_success(['image' => $base64_output, 'content-type' => get_image_type()], 'image');
|
api_success(['image' => $base64_output, 'content-type' => get_image_type()], 'image');
|
||||||
@@ -245,7 +245,7 @@ function get_graph_generic_by_hostname()
|
|||||||
$vars['device'] = dbFetchCell('SELECT `D`.`device_id` FROM `devices` AS `D` WHERE `D`.`hostname`=?', array($hostname));
|
$vars['device'] = dbFetchCell('SELECT `D`.`device_id` FROM `devices` AS `D` WHERE `D`.`hostname`=?', array($hostname));
|
||||||
$app->response->headers->set('Content-Type', get_image_type());
|
$app->response->headers->set('Content-Type', get_image_type());
|
||||||
rrdtool_initialize(false);
|
rrdtool_initialize(false);
|
||||||
include 'includes/graphs/graph.inc.php';
|
include 'includes/html/graphs/graph.inc.php';
|
||||||
rrdtool_close();
|
rrdtool_close();
|
||||||
|
|
||||||
if ($vars['output'] === 'base64') {
|
if ($vars['output'] === 'base64') {
|
||||||
@@ -670,7 +670,7 @@ function get_graph_by_portgroup()
|
|||||||
$vars['id'] = $if_list;
|
$vars['id'] = $if_list;
|
||||||
$app->response->headers->set('Content-Type', get_image_type());
|
$app->response->headers->set('Content-Type', get_image_type());
|
||||||
rrdtool_initialize(false);
|
rrdtool_initialize(false);
|
||||||
include 'includes/graphs/graph.inc.php';
|
include 'includes/html/graphs/graph.inc.php';
|
||||||
rrdtool_close();
|
rrdtool_close();
|
||||||
if ($vars['output'] === 'base64') {
|
if ($vars['output'] === 'base64') {
|
||||||
api_success(['image' => $base64_output, 'content-type' => get_image_type()], 'image');
|
api_success(['image' => $base64_output, 'content-type' => get_image_type()], 'image');
|
||||||
@@ -1440,7 +1440,7 @@ function get_bill_graph()
|
|||||||
$vars['height'] = $_GET['height'] ?: 300;
|
$vars['height'] = $_GET['height'] ?: 300;
|
||||||
|
|
||||||
$app->response->headers->set('Content-Type', 'image/png');
|
$app->response->headers->set('Content-Type', 'image/png');
|
||||||
include 'includes/graphs/graph.inc.php';
|
include 'includes/html/graphs/graph.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_bill_graphdata()
|
function get_bill_graphdata()
|
||||||
@@ -1532,7 +1532,7 @@ function get_bill_history_graph()
|
|||||||
$vars['height'] = $_GET['height'] ?: 300;
|
$vars['height'] = $_GET['height'] ?: 300;
|
||||||
|
|
||||||
$app->response->headers->set('Content-Type', 'image/png');
|
$app->response->headers->set('Content-Type', 'image/png');
|
||||||
include 'includes/graphs/graph.inc.php';
|
include 'includes/html/graphs/graph.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_bill_history_graphdata()
|
function get_bill_history_graphdata()
|
@@ -16,7 +16,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require 'includes/collectd/CollectdColor.php';
|
require 'includes/html/collectd/CollectdColor.php';
|
||||||
|
|
||||||
use LibreNMS\CollectdColor;
|
use LibreNMS\CollectdColor;
|
||||||
|
|
@@ -13,8 +13,6 @@
|
|||||||
* @author LibreNMS Contributors
|
* @author LibreNMS Contributors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once $config['install_dir'] . '/includes/device-groups.inc.php';
|
|
||||||
|
|
||||||
/* FIXME: is there a central place we can put this? */
|
/* FIXME: is there a central place we can put this? */
|
||||||
|
|
||||||
$alert_states = array(
|
$alert_states = array(
|
@@ -143,7 +143,7 @@ if (defined('SHOW_SETTINGS')) {
|
|||||||
</div>
|
</div>
|
||||||
</form>';
|
</form>';
|
||||||
} else {
|
} else {
|
||||||
require_once 'includes/object-cache.inc.php';
|
require_once 'includes/html/object-cache.inc.php';
|
||||||
|
|
||||||
$host_up_count = 0;
|
$host_up_count = 0;
|
||||||
$host_warn_count = 0;
|
$host_warn_count = 0;
|
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once 'includes/object-cache.inc.php';
|
require_once 'includes/html/object-cache.inc.php';
|
||||||
|
|
||||||
$temp_output = '
|
$temp_output = '
|
||||||
<div class="panel panel-default panel-condensed table-responsive">
|
<div class="panel panel-default panel-condensed table-responsive">
|
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once 'includes/object-cache.inc.php';
|
require_once 'includes/html/object-cache.inc.php';
|
||||||
|
|
||||||
$temp_output = '
|
$temp_output = '
|
||||||
<div class="panel panel-default panel-condensed table-responsive">
|
<div class="panel panel-default panel-condensed table-responsive">
|
@@ -27,7 +27,6 @@ use LibreNMS\Config;
|
|||||||
|
|
||||||
$install_dir = Config::get('install_dir');
|
$install_dir = Config::get('install_dir');
|
||||||
require_once $install_dir . '/includes/alerts.inc.php';
|
require_once $install_dir . '/includes/alerts.inc.php';
|
||||||
require_once $install_dir . '/includes/device-groups.inc.php';
|
|
||||||
|
|
||||||
if (Config::get('map.engine', 'leaflet') == 'leaflet') {
|
if (Config::get('map.engine', 'leaflet') == 'leaflet') {
|
||||||
$temp_output = '
|
$temp_output = '
|
@@ -18,8 +18,6 @@ if (!LegacyAuth::user()->hasGlobalAdmin()) {
|
|||||||
die('ERROR: You need to be admin');
|
die('ERROR: You need to be admin');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '../includes/device-groups.inc.php';
|
|
||||||
|
|
||||||
$pattern = $_POST['patterns'];
|
$pattern = $_POST['patterns'];
|
||||||
$group_id = $_POST['group_id'];
|
$group_id = $_POST['group_id'];
|
||||||
$name = mres($_POST['name']);
|
$name = mres($_POST['name']);
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user