From 030fa60745ec42a2709e6e8d1048104edbf86efd Mon Sep 17 00:00:00 2001 From: Dan Langille Date: Wed, 11 Nov 2015 09:21:58 -0500 Subject: [PATCH 01/12] Fix typo in host name: doc -> docs http://docs.librenms.org/Extensions/Authentication/ exists, but http://doc.librenms.org/Extensions/Authentication/) --- doc/Support/Configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 4682988d8..fbfd21fee 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -436,7 +436,7 @@ $config['auth_mechanism'] = "mysql"; ``` This is the authentication type to use for the WebUI. MySQL is the default and configured when following the installation instructions. ldap and http-auth are also valid options. For instructions on the different authentication modules please -see [Authentication](http://doc.librenms.org/Extensions/Authentication/). +see [Authentication](http://docs.librenms.org/Extensions/Authentication/). ```php $config['auth_remember'] = '30'; From f181403f9535f0b56abbf3a2474442f6ec38383d Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Wed, 11 Nov 2015 20:37:51 +0100 Subject: [PATCH 02/12] Specified which MIB should be used when polling ntpd-server information. --- includes/polling/applications/ntpd-server.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/polling/applications/ntpd-server.inc.php b/includes/polling/applications/ntpd-server.inc.php index f6267ce16..44e009e5c 100644 --- a/includes/polling/applications/ntpd-server.inc.php +++ b/includes/polling/applications/ntpd-server.inc.php @@ -4,8 +4,9 @@ $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-ntpdserver-'.$app['app_id'].'.rrd'; $options = '-O qv'; $oid = 'nsExtendOutputFull.10.110.116.112.100.115.101.114.118.101.114'; +$mib = 'NET-SNMP-EXTEND-MIB'; -$ntpdserver = snmp_get($device, $oid, $options); +$ntpdserver = snmp_get($device, $oid, $options, $mib); echo ' ntpd-server'; From eed3a899482c74b92e2e90e25278beb5582b2aa0 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Wed, 11 Nov 2015 22:54:21 +0100 Subject: [PATCH 03/12] Fix for percentage bars in billing pages. --- html/pages/bill/history.inc.php | 2 +- html/pages/bills/pmonth.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/html/pages/bill/history.inc.php b/html/pages/bill/history.inc.php index 26a4750b6..6770271c8 100644 --- a/html/pages/bill/history.inc.php +++ b/html/pages/bill/history.inc.php @@ -101,7 +101,7 @@ foreach (dbFetchRows('SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY $total_data $rate_95th $overuse - ".print_percentage_bar(250, 20, $perc, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).' + ".print_percentage_bar(250, 20, $percent, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).' Show details diff --git a/html/pages/bills/pmonth.inc.php b/html/pages/bills/pmonth.inc.php index abac72f00..39f1ff75c 100644 --- a/html/pages/bills/pmonth.inc.php +++ b/html/pages/bills/pmonth.inc.php @@ -60,7 +60,7 @@ foreach (dbFetchRows('SELECT * FROM `bills` ORDER BY `bill_name`') as $bill) { $total_data $rate_95th $overuse - ".print_percentage_bar(250, 20, $perc, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).' + ".print_percentage_bar(250, 20, $percent, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).' '; $i++; From bdc33ebf590426ded3a9d2767d3026b8e8bce0e7 Mon Sep 17 00:00:00 2001 From: Richard Kojedzinszky Date: Thu, 12 Nov 2015 14:44:12 +0100 Subject: [PATCH 04/12] Real-time graphs: fix for graph wraps FIX is by querying the HC counters first, and fall back to snmpv1 oids in case of no answer. --- html/data.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/html/data.php b/html/data.php index b55d09c32..4267ddb5d 100644 --- a/html/data.php +++ b/html/data.php @@ -31,14 +31,14 @@ if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted $auth = true; } -$in = snmp_get($device, 'ifInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); -$out = snmp_get($device, 'ifOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); +$in = snmp_get($device, 'ifHCInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); if (empty($in)) { - $in = snmp_get($device, 'ifHCInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); + $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, 'ifHCOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); + $out = snmp_get($device, 'ifOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); } $time = time(); From 01922e5c5a266518cbe5c2333f9b7500eaa0761f Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Thu, 12 Nov 2015 09:48:21 -0800 Subject: [PATCH 05/12] Added support for CPU and Memory usage of Ubiquiti UniFi --- includes/discovery/mempools/unifi.inc.php | 22 +++++++++++++++++++ includes/discovery/processors/unifi.inc.php | 24 +++++++++++++++++++++ includes/polling/mempools/unifi.inc.php | 17 +++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 includes/discovery/mempools/unifi.inc.php create mode 100644 includes/discovery/processors/unifi.inc.php create mode 100644 includes/polling/mempools/unifi.inc.php diff --git a/includes/discovery/mempools/unifi.inc.php b/includes/discovery/mempools/unifi.inc.php new file mode 100644 index 000000000..26704f422 --- /dev/null +++ b/includes/discovery/mempools/unifi.inc.php @@ -0,0 +1,22 @@ + + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if ($device['os'] == 'unifi') { + echo 'UNIFI-MEMORY-POOL: '; + + $total = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.1.0', '-OvQ'); + $free = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.2.0', '-OvQ'); + + if (is_numeric($total) && is_numeric($free)) { + discover_mempool($valid_mempool, $device, 0, 'unifi', 'Memory', '1', null, null); + } +} diff --git a/includes/discovery/processors/unifi.inc.php b/includes/discovery/processors/unifi.inc.php new file mode 100644 index 000000000..0d463d669 --- /dev/null +++ b/includes/discovery/processors/unifi.inc.php @@ -0,0 +1,24 @@ + + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if ($device['os'] == 'unifi') { + echo 'Ubiquiti UniFi: '; + + $descr = 'CPU'; + $usage = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2', '-Ovqn'); + + if (is_numeric($usage)) { + discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2', '0', 'unifi', $descr, '1', $usage, null, null); + } +} + +unset($processors_array); diff --git a/includes/polling/mempools/unifi.inc.php b/includes/polling/mempools/unifi.inc.php new file mode 100644 index 000000000..05611285d --- /dev/null +++ b/includes/polling/mempools/unifi.inc.php @@ -0,0 +1,17 @@ + + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +$total = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.1.0', '-OvQ'); +$free = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.2.0', '-OvQ'); +$mempool['total'] = $total * 1024; +$mempool['free'] = $free * 1024; +$mempool['used'] = ($mempool['total'] - $mempool['free']); From c5f6879dfb8b1fa6047f477b451f0354e4c4d2b2 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Thu, 12 Nov 2015 11:09:44 -0800 Subject: [PATCH 06/12] Add Ubiquiti UniFi memory graphs to device overlib. --- includes/definitions.inc.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 97badfa1f..16873101c 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -114,7 +114,11 @@ $config['os'][$os]['type'] = 'wireless'; $config['os'][$os]['icon'] = 'ubiquiti'; $config['os'][$os]['nobulk'] = 1; $config['os'][$os]['over'][0]['graph'] = 'device_bits'; +$config['os'][$os]['over'][0]['text'] = 'Device Traffic'; $config['os'][$os]['over'][1]['graph'] = 'device_processor'; +$config['os'][$os]['over'][1]['text'] = 'Processor Usage'; +$config['os'][$os]['over'][2]['graph'] = 'device_mempool'; +$config['os'][$os]['over'][2]['text'] = 'Memory Usage'; $os = 'airos'; $config['os'][$os]['text'] = 'Ubiquiti AirOS'; From b9e95b702d3ec0e59106c8aa66cdfa1f3519a3ed Mon Sep 17 00:00:00 2001 From: laf Date: Thu, 12 Nov 2015 19:28:19 +0000 Subject: [PATCH 07/12] Updated userlevel >= 10 checks to use functions --- html/pages/front/default.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/html/pages/front/default.php b/html/pages/front/default.php index 341f8f12e..1709f842a 100644 --- a/html/pages/front/default.php +++ b/html/pages/front/default.php @@ -33,7 +33,7 @@ echo '
'; $count_boxes = 0; // Device down boxes -if ($_SESSION['userlevel'] >= '10') { +if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0' LIMIT ".$config['front_page_down_box_limit']; } else { @@ -50,7 +50,7 @@ foreach (dbFetchRows($sql) as $device) { ++$count_boxes; } -if ($_SESSION['userlevel'] >= '10') { +if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit']; } else { @@ -79,7 +79,7 @@ if ($config['warn']['ifdown']) { /* FIXME service permissions? seem nonexisting now.. */ // Service down boxes -if ($_SESSION['userlevel'] >= '10') { +if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0' AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit']; $param[] = ''; } @@ -101,7 +101,7 @@ foreach (dbFetchRows($sql, $param) as $service) { // BGP neighbour down boxes if (isset($config['enable_bgp']) && $config['enable_bgp']) { - if ($_SESSION['userlevel'] >= '10') { + if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit']; } else { @@ -122,7 +122,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp']) { // Device rebooted boxes if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== false && $config['uptime_warning'] > 0) { - if ($_SESSION['userlevel'] >= '10') { + if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime > 0 AND D.uptime < '".$config['uptime_warning']."' AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit']; } else { @@ -204,7 +204,7 @@ if ($config['enable_syslog']) { echo '
'; } else { - if ($_SESSION['userlevel'] >= '10') { + if (is_admin() === true || is_read() === true) { $query = "SELECT *,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15"; $alertquery = 'SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id LEFT JOIN alert_rules ON alert_log.rule_id=alert_rules.id ORDER BY `time_logged` DESC LIMIT 0,15'; } From 52c4621095ec6c67b2566b035879be3a141fb3e0 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Fri, 13 Nov 2015 11:04:23 -0600 Subject: [PATCH 08/12] I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 0fc344279..4c3d6983b 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -68,4 +68,5 @@ Contributors to LibreNMS: - Robert Gornall (rgormley) - Richard Kojedzinszky (rkojedzinszky) +- Tony Murray (murrant) [1]: http://observium.org/ "Observium web site" From 02d54e9c50a85c2d453cb0a66a747c1c57daff2c Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Fri, 13 Nov 2015 11:05:05 -0600 Subject: [PATCH 09/12] Fix AD auth with untrusted certificates. LDAPTLS_REQCERT=never must be set before ldap_connect. --- .../authentication/active_directory.inc.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/html/includes/authentication/active_directory.inc.php b/html/includes/authentication/active_directory.inc.php index 03788f90d..88504a665 100644 --- a/html/includes/authentication/active_directory.inc.php +++ b/html/includes/authentication/active_directory.inc.php @@ -2,6 +2,12 @@ // easier to rewrite for Active Directory than to bash it into existing LDAP implementation +// disable certificate checking before connect if required +if (isset($config['auth_ad_dont_check_certificates']) && + $config['auth_ad_dont_check_certificates'] > 0) { + putenv('LDAPTLS_REQCERT=never'); +}; + $ds = @ldap_connect($config['auth_ad_url']); // disable referrals and force ldap version to 3 @@ -9,13 +15,6 @@ $ds = @ldap_connect($config['auth_ad_url']); ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); -// disable certificate checking if required - -if (isset($config['auth_ad_dont_check_certificates']) && - $config['auth_ad_dont_check_certificates'] > 0) { - putenv('LDAPTLS_REQCERT=never'); -}; - function authenticate($username, $password) { global $config, $ds; From 5669c1c3a5ef46509bd34ee5db4ce04c69ac9b6e Mon Sep 17 00:00:00 2001 From: Richard Kojedzinszky Date: Sat, 14 Nov 2015 18:44:58 +0100 Subject: [PATCH 10/12] Fix netcmd.php URI for installations not under root --- html/includes/print-interface.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index 223c169fc..b15c9b773 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -50,12 +50,12 @@ unset($break); if ($port_details) { foreach (dbFetchRows('SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?', array($port['port_id'])) as $ip) { - echo "$break ".$ip['ipv4_address'].'/'.$ip['ipv4_prefixlen'].''; + echo "$break ".$ip['ipv4_address'].'/'.$ip['ipv4_prefixlen'].''; $break = '
'; } foreach (dbFetchRows('SELECT * FROM `ipv6_addresses` WHERE `port_id` = ?', array($port['port_id'])) as $ip6) { - echo "$break ".Net_IPv6::compress($ip6['ipv6_address']).'/'.$ip6['ipv6_prefixlen'].''; + echo "$break ".Net_IPv6::compress($ip6['ipv6_address']).'/'.$ip6['ipv6_prefixlen'].''; $break = '
'; } } From 7c54782cc8244879d6cbc037980276fc5ca2f4da Mon Sep 17 00:00:00 2001 From: Falk Stern Date: Mon, 16 Nov 2015 10:24:16 +0100 Subject: [PATCH 11/12] Moved auth_ad_dont_check_certificates to auth_ad_check_certificates --- html/includes/authentication/active_directory.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/includes/authentication/active_directory.inc.php b/html/includes/authentication/active_directory.inc.php index 88504a665..a562ae901 100644 --- a/html/includes/authentication/active_directory.inc.php +++ b/html/includes/authentication/active_directory.inc.php @@ -3,8 +3,8 @@ // easier to rewrite for Active Directory than to bash it into existing LDAP implementation // disable certificate checking before connect if required -if (isset($config['auth_ad_dont_check_certificates']) && - $config['auth_ad_dont_check_certificates'] > 0) { +if (isset($config['auth_ad_check_certificates']) && + $config['auth_ad_check_certificates'] == 0) { putenv('LDAPTLS_REQCERT=never'); }; From dda8ffd400f2a1663830b39c238fa41831a482f9 Mon Sep 17 00:00:00 2001 From: Falk Stern Date: Mon, 16 Nov 2015 10:25:13 +0100 Subject: [PATCH 12/12] Updated Documentation for 'auth_ad_check_certificates' --- doc/Extensions/Authentication.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Extensions/Authentication.md b/doc/Extensions/Authentication.md index d7c526d36..48ad0e92f 100644 --- a/doc/Extensions/Authentication.md +++ b/doc/Extensions/Authentication.md @@ -108,7 +108,7 @@ Config option: `active_directory` This is similar to LDAP Authentication. Install __php_ldap__ for CentOS/RHEL or __php5-ldap__ for Debian/Ubuntu. -If you have issues with secure LDAP try setting `$config['auth_ad_dont_check_certificates']` to `1`. +If you have issues with secure LDAP try setting `$config['auth_ad_check_certificates']` to `0`. ##### Require actual membership of the configured groups @@ -118,7 +118,7 @@ If you set ```$config['auth_ad_require_groupmembership']``` to 1, the authentica ``` $config['auth_ad_url'] = "ldaps://your-domain.controll.er"; -$config['auth_ad_dont_check_certificates'] = 1; // or 0 +$config['auth_ad_check_certificates'] = 1; // or 0 $config['auth_ad_domain'] = "your-domain.com"; $config['auth_ad_base_dn'] = "dc=your-domain,dc=com"; $config['auth_ad_groups']['admin']['level'] = 10;