mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge branch 'master' of https://github.com/adaniels21487/librenms into issue-1650
Conflicts: html/api_v0.php html/includes/api_functions.inc.php
This commit is contained in:
@@ -75,4 +75,5 @@ Contributors to LibreNMS:
|
||||
- Eldon Koyle <ekoyle@gmail.com> (ekoyle)
|
||||
- Jonathan Bailey <jcbailey@code0.net> (jcbailey2)
|
||||
- Ruairi Carroll <ruairi.carroll@gmail.com> (rucarrol)
|
||||
- Maxim Tsyplakov <maxim.tsyplakov@gmail.com> (tsypa)
|
||||
[1]: http://observium.org/ "Observium web site"
|
||||
|
||||
@@ -30,7 +30,7 @@ Take a look at https://dev.mysql.com/doc/refman/5.6/en/innodb-buffer-pool.html f
|
||||
|
||||
The ' . $config['project_name'] . ' team.';
|
||||
send_mail($config['alert']['default_mail'],$subject,$message,$html=false);
|
||||
}
|
||||
}
|
||||
echo warn_innodb_buffer($innodb_buffer);
|
||||
exit(2);
|
||||
}
|
||||
@@ -110,3 +110,19 @@ if ($options['f'] === 'device_perf') {
|
||||
if ($options['f'] === 'notifications') {
|
||||
include_once 'notifications.php';
|
||||
}
|
||||
|
||||
if ($options['f'] === 'purgeusers') {
|
||||
$purge = 0;
|
||||
if (is_numeric($config['radius']['users_purge']) && $config['auth_mechanism'] === 'radius') {
|
||||
$purge = $config['radius']['users_purge'];
|
||||
}
|
||||
if ($purge > 0) {
|
||||
foreach (dbFetchRows("SELECT DISTINCT(`user`) FROM `authlog` WHERE `datetime` >= DATE_SUB(NOW(), INTERVAL ? DAY)", array($purge)) as $user) {
|
||||
$users[] = $user['user'];
|
||||
}
|
||||
$del_users = '"'.implode('","',$users).'"';
|
||||
if (dbDelete('users', "username NOT IN ($del_users)",array($del_users))) {
|
||||
echo "Removed users that haven't logged in for $purge days";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@@ -64,6 +64,7 @@ else
|
||||
php daily.php -f perf_times
|
||||
php daily.php -f callback
|
||||
php daily.php -f device_perf
|
||||
php daily.php -f purgeusers
|
||||
;;
|
||||
submodules)
|
||||
# Init+Update our submodules
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
- [`add_device`](#api-route-11)
|
||||
- [`list_oxidized`](#api-route-21)
|
||||
- [`update_device_field`](#api-route-update_device_field)
|
||||
- [`get_device_groups`](#api-route-get_device_groups)
|
||||
- [`devicegroups`](#api-devicegroups)
|
||||
- [`get_devicegroups`](#api-route-get_devicegroups)
|
||||
- [`get_devices_by_group`](#api-route-get_devices_by_group)
|
||||
- [`routing`](#api-routing)
|
||||
- [`list_bgp`](#api-route-1)
|
||||
- [`switching`](#api-switching)
|
||||
@@ -381,6 +385,7 @@ Input:
|
||||
- to: This is the date you would like the graph to end - See http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more information.
|
||||
- width: The graph width, defaults to 1075.
|
||||
- height: The graph height, defaults to 300.
|
||||
- ifDescr: If this is set to true then we will use ifDescr to lookup the port instead of ifName. Pass the ifDescr value you want to search as you would ifName.
|
||||
|
||||
Example:
|
||||
```curl
|
||||
@@ -534,6 +539,8 @@ Update devices field in the database.
|
||||
|
||||
Route: /api/v0/devices/:hostname
|
||||
|
||||
- hostname can be either the device hostname or id
|
||||
|
||||
Input (JSON):
|
||||
|
||||
- field: The column name within the database
|
||||
@@ -555,6 +562,154 @@ Output:
|
||||
]
|
||||
```
|
||||
|
||||
### <a name="api-route-get_device_groups">Function `get_device_groups`</a> [`top`](#top)
|
||||
|
||||
List the device groups that a device is matched on.
|
||||
|
||||
Route: /api/v0/devices/:hostname/groups
|
||||
|
||||
- hostname can be either the device hostname or id
|
||||
|
||||
Input (JSON):
|
||||
|
||||
-
|
||||
|
||||
Examples:
|
||||
```curl
|
||||
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devices/localhost/groups
|
||||
```
|
||||
|
||||
Output:
|
||||
```text
|
||||
[
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "Found 1 device groups",
|
||||
"count": 1,
|
||||
"groups": [
|
||||
{
|
||||
"id": "1",
|
||||
"name": "Testing",
|
||||
"desc": "Testing",
|
||||
"pattern": "%devices.status = \"1\" &&"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## <a name="api-devicegroups">`Device Groups`</a> [`top`](#top)
|
||||
|
||||
### <a name="api-route-get_devicegroups">Function `get_devicegroups`</a> [`top`](#top)
|
||||
|
||||
List all device groups.
|
||||
|
||||
Route: /api/v0/devicegroups
|
||||
|
||||
Input (JSON):
|
||||
|
||||
-
|
||||
|
||||
Examples:
|
||||
```curl
|
||||
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devicegroups
|
||||
```
|
||||
|
||||
Output:
|
||||
```text
|
||||
[
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "Found 1 device groups",
|
||||
"count": 1,
|
||||
"groups": [
|
||||
{
|
||||
"id": "1",
|
||||
"name": "Testing",
|
||||
"desc": "Testing",
|
||||
"pattern": "%devices.status = \"1\" &&"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### <a name="api-route-get_devices_by_group">Function `get_devices_by_group`</a> [`top`](#top)
|
||||
|
||||
List all devices matching the group provided.
|
||||
|
||||
Route: /api/v0/devicegroups/:name
|
||||
|
||||
- name Is the name of the device group which can be obtained using [`get_devicegroups`](#api-route-get_devicegroups). Please ensure that the name is urlencoded if it needs to be (i.e Linux Servers would need to be urlencoded.
|
||||
|
||||
Input (JSON):
|
||||
|
||||
-
|
||||
|
||||
Examples:
|
||||
```curl
|
||||
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/devicegroups/LinuxServers
|
||||
```
|
||||
|
||||
Output:
|
||||
```text
|
||||
[
|
||||
{
|
||||
"status": "error",
|
||||
"message": "Found 1 in group LinuxServers",
|
||||
"count": 1,
|
||||
"devices": [
|
||||
{
|
||||
"device_id": "1",
|
||||
"hostname": "localhost",
|
||||
"sysName": "hostname",
|
||||
"community": "librenms",
|
||||
"authlevel": null,
|
||||
"authname": null,
|
||||
"authpass": null,
|
||||
"authalgo": null,
|
||||
"cryptopass": null,
|
||||
"cryptoalgo": null,
|
||||
"snmpver": "v2c",
|
||||
"port": "161",
|
||||
"transport": "udp",
|
||||
"timeout": null,
|
||||
"retries": null,
|
||||
"bgpLocalAs": null,
|
||||
"sysObjectID": ".1.3.6.1.4.1.8072.3.2.10",
|
||||
"sysDescr": "Linux li1045-133.members.linode.com 4.1.5-x86_64-linode61 #7 SMP Mon Aug 24 13:46:31 EDT 2015 x86_64",
|
||||
"sysContact": "",
|
||||
"version": "4.1.5-x86_64-linode61",
|
||||
"hardware": "Generic x86 64-bit",
|
||||
"features": "CentOS 7.1.1503",
|
||||
"location": "",
|
||||
"os": "linux",
|
||||
"status": "1",
|
||||
"status_reason": "",
|
||||
"ignore": "0",
|
||||
"disabled": "0",
|
||||
"uptime": "4615964",
|
||||
"agent_uptime": "0",
|
||||
"last_polled": "2015-12-12 13:20:04",
|
||||
"last_poll_attempted": null,
|
||||
"last_polled_timetaken": "1.90",
|
||||
"last_discovered_timetaken": "79.53",
|
||||
"last_discovered": "2015-12-12 12:34:21",
|
||||
"last_ping": "2015-12-12 13:20:04",
|
||||
"last_ping_timetaken": "0.08",
|
||||
"purpose": null,
|
||||
"type": "server",
|
||||
"serial": null,
|
||||
"icon": null,
|
||||
"poller_group": "0",
|
||||
"override_sysLocation": "0",
|
||||
"notes": "Nope"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## <a name="api-routing">`Routing`</a> [`top`](#top)
|
||||
|
||||
### <a name="api-route-1">Function: `list_bgp`</a> [`top`](#top)
|
||||
|
||||
@@ -13,6 +13,8 @@ Here we will provide configuration details for these modules.
|
||||
|
||||
- HTTP Auth: http-auth
|
||||
|
||||
- Radius: radius
|
||||
|
||||
#### User levels
|
||||
|
||||
- 1: Normal User. You will need to assign device / port permissions for users at this level.
|
||||
@@ -125,3 +127,19 @@ $config['auth_ad_groups']['admin']['level'] = 10;
|
||||
$config['auth_ad_groups']['pfy']['level'] = 7;
|
||||
$config['auth_ad_require_groupmembership'] = 0;
|
||||
```
|
||||
|
||||
#### Radius Authentication
|
||||
|
||||
Please note that a mysql user is created for each user the logs in successfully. User level 1 is assigned to those accounts so you will then need to assign the relevant permissions unless you set `$config['radius']['userlevel']` to be something other than 1.
|
||||
|
||||
> Cleanup of old accounts is done using the authlog. You will need to set the cleanup date for when old accounts will be purged which will happen AUTOMATICALLY.
|
||||
> Please ensure that you set the $config['authlog_purge'] value to be greater than $config['radius']['users_purge'] otherwise old users won't be removed.
|
||||
|
||||
```php
|
||||
$config['radius']['hostname'] = 'localhost';
|
||||
$config['radius']['port'] = '1812';
|
||||
$config['radius']['secret'] = 'testing123';
|
||||
$config['radius']['timeout'] = 3;
|
||||
$config['radius']['users_purge'] = 14;//Purge users who haven't logged in for 14 days.
|
||||
$config['radius']['default_level'] = 1;//Set the default user level when automatically creating a user.
|
||||
```
|
||||
|
||||
@@ -23,6 +23,7 @@ LibreNMS 3rd party acknowledgements
|
||||
- Tag Manager (http://soliantconsulting.github.io/tagmanager/): MIT
|
||||
- TW Sack (https://code.google.com/p/tw-sack/): GPLv3
|
||||
- Gridster (http://gridster.net/): MIT
|
||||
- Pure PHP radius class (http://developer.sysco.ch/php/): GPLv3
|
||||
|
||||
#### 3rd Party GPLv3 Non-compliant
|
||||
|
||||
|
||||
@@ -5,26 +5,59 @@
|
||||
- Fixed regex for negative lat/lng coords (PR2524)
|
||||
- Fixed map page looping due to device connected to itself (PR2545)
|
||||
- Fixed PATH_INFO for nginx (PR2551)
|
||||
- urlencode the custom port types (PR2597)
|
||||
- Stop non-admin users from being able to get to settings pages (PR2627)
|
||||
- Fix JpGraph php version compare (PR2631)
|
||||
- Discovery / Polling:
|
||||
- Pointed snmp calls for Huawei to correct MIB folder (PR2541)
|
||||
- Fixed Ceph unix-agent support. (PR2588)
|
||||
- Moved memory graphs from storage to memory polling (PR2616)
|
||||
- Mask alert_log mysql output when debug is enabled to stop console crashes (PR2618)
|
||||
- Stop Quanta devices being detected as Ubiquiti (PR2632)
|
||||
- Fix MySQL unix-agent graphs (PR2645)
|
||||
- Added MTA-MIB and NETWORK-SERVICES-MIB to stop warnings printed in poller debug (PR2653)
|
||||
- Services:
|
||||
- Fix SSL check for PHP 7 (PR2647)
|
||||
- Alerting:
|
||||
- Fix glue-expansion for alerts (PR2522)
|
||||
- Fix HipChat transport (PR2586)
|
||||
- Documentation:
|
||||
- Removed duplicate mysql-client install from Debian/Ubuntu install docs (PR2543)
|
||||
- Misc:
|
||||
- Update daily.sh to ignore issues writing to log file (PR2595)
|
||||
|
||||
#### Improvements
|
||||
- WebUI:
|
||||
- Converted sensors page to use bootgrid (PR2531)
|
||||
- Added new widgets for dashboard. Notes (PR2582), Generic image (PR2617)
|
||||
- Added config option to disable lazy loading of images (PR2589)
|
||||
- Visual update to Navbar. (PR2593)
|
||||
- Update alert rules to show actual alert rule ID (PR2603)
|
||||
- Initial support added for per user default dashboard (PR2620)
|
||||
- Updated Worldmap to show clusters in red if one device is down (PR2621)
|
||||
- Discovery / Polling
|
||||
- Added traffic bits as default for Cambium devices (PR2525)
|
||||
- Overwrite eth0 port data from UniFi MIBs for AirFibre devices (PR2544)
|
||||
- Added lastupdate column to sensors table for use with alerts (PR2590,PR2592)
|
||||
- Updated auto discovery via lldp to check for devices that use mac address in lldpRemPortId (PR2591)
|
||||
- Updated auto discovery via lldp with absent lldpRemSysName (PR2619)
|
||||
- API:
|
||||
- Added ability to filter devices by type and os for Oxidized API call (PR2539)
|
||||
- Added ability to update device information (PR2585)
|
||||
- Added support for returning device groups (PR2611)
|
||||
- Added ability to select port graphs based on ifDescr (PR2648)
|
||||
- Documentation:
|
||||
- Improved alerting docs explaining more options (PR2560)
|
||||
- Added Docs for Ubuntu/Debian Smokeping integration (PR2610)
|
||||
- Added detection for:
|
||||
- Updated Netonix switch MIBs (PR2523)
|
||||
- Updated Fotinet MIBs (PR2529, PR2534)
|
||||
- Cisco SG500 (PR2609)
|
||||
- Updated processor support for Fortigate (PR2613)
|
||||
- Misc:
|
||||
- Updated validation to check for php extension and classes required (PR2602)
|
||||
- Added Radius Authentication support (PR2615)
|
||||
- Removed distinct() from alerts query to use indexes (PR2649)
|
||||
|
||||
### November 2015
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ $app->group(
|
||||
// api/v0/devices/$hostname/ports
|
||||
$app->get('/:hostname/components', 'authToken', 'get_components')->name('get_components');
|
||||
// api/v0/devices/$hostname/components
|
||||
$app->get('/:hostname/groups', 'authToken', 'get_device_groups')->name('get_device_groups');
|
||||
$app->get('/:hostname/:type', 'authToken', 'get_graph_generic_by_hostname')->name('get_graph_generic_by_hostname');
|
||||
// api/v0/devices/$hostname/$type
|
||||
$app->get('/:hostname/ports/:ifname', 'authToken', 'get_port_stats_by_port_hostname')->name('get_port_stats_by_port_hostname');
|
||||
@@ -63,6 +64,13 @@ $app->group(
|
||||
// api/v0/devices
|
||||
$app->post('/devices', 'authToken', 'add_device')->name('add_device');
|
||||
// api/v0/devices (json data needs to be passed)
|
||||
$app->group(
|
||||
'/devicegroups',
|
||||
function () use ($app) {
|
||||
$app->get('/:name', 'authToken', 'get_devices_by_group')->name('get_devices_by_group');
|
||||
}
|
||||
);
|
||||
$app->get('/devicegroups', 'authToken', 'get_device_groups')->name('get_devicegroups');
|
||||
$app->group(
|
||||
'/portgroups',
|
||||
function () use ($app) {
|
||||
|
||||
@@ -1834,3 +1834,24 @@ label {
|
||||
|
||||
@media only screen and (min-width: 1024px) {
|
||||
}
|
||||
|
||||
.redCluster {
|
||||
background-color: rgba(255,0,0);
|
||||
background-color: rgba(255,0,0,0.7);
|
||||
text-align: center;
|
||||
width: 25px !important;
|
||||
height: 25px !important;
|
||||
font-size: 14px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.greenCluster {
|
||||
background-color: rgba(0,255,0);
|
||||
background-color: rgba(0,255,0,0.7);
|
||||
text-align: center;
|
||||
width: 25px !important;
|
||||
height: 25px !important;
|
||||
font-size: 14px;
|
||||
color: black;
|
||||
border-color:transparent;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -14,7 +14,7 @@
|
||||
|
||||
require_once '../includes/functions.php';
|
||||
require_once '../includes/component.php';
|
||||
|
||||
require_once '../includes/device-groups.inc.php';
|
||||
|
||||
function authToken(\Slim\Route $route) {
|
||||
$app = \Slim\Slim::getInstance();
|
||||
@@ -63,10 +63,17 @@ function get_graph_by_port_hostname() {
|
||||
$vars['to'] = $_GET['to'];
|
||||
}
|
||||
|
||||
if ($_GET['ifDescr'] == true) {
|
||||
$port = 'ifDescr';
|
||||
}
|
||||
else {
|
||||
$port = 'ifName';
|
||||
}
|
||||
|
||||
$vars['width'] = $_GET['width'] ?: 1075;
|
||||
$vars['height'] = $_GET['height'] ?: 300;
|
||||
$auth = '1';
|
||||
$vars['id'] = dbFetchCell('SELECT `P`.`port_id` FROM `ports` AS `P` JOIN `devices` AS `D` ON `P`.`device_id` = `D`.`device_id` WHERE `D`.`hostname`=? AND `P`.`ifName`=?', array($hostname, $vars['port']));
|
||||
$vars['id'] = dbFetchCell("SELECT `P`.`port_id` FROM `ports` AS `P` JOIN `devices` AS `D` ON `P`.`device_id` = `D`.`device_id` WHERE `D`.`hostname`=? AND `P`.`$port`=?", array($hostname, $vars['port']));
|
||||
$app->response->headers->set('Content-Type', 'image/png');
|
||||
include 'includes/graphs/graph.inc.php';
|
||||
|
||||
@@ -1068,3 +1075,73 @@ function update_device() {
|
||||
$app->response->headers->set('Content-Type', 'application/json');
|
||||
echo _json_encode($output);
|
||||
}
|
||||
|
||||
function get_device_groups() {
|
||||
$app = \Slim\Slim::getInstance();
|
||||
$router = $app->router()->getCurrentRoute()->getParams();
|
||||
$status = 'error';
|
||||
$code = 404;
|
||||
$hostname = $router['hostname'];
|
||||
// use hostname as device_id if it's all digits
|
||||
$device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname);
|
||||
if (is_numeric($device_id)) {
|
||||
$groups = GetGroupsFromDevice($device_id,1);
|
||||
}
|
||||
else {
|
||||
$groups = GetDeviceGroups();
|
||||
}
|
||||
if (empty($groups)) {
|
||||
$message = 'No device groups found';
|
||||
}
|
||||
else {
|
||||
$status = 'ok';
|
||||
$code = 200;
|
||||
$message = 'Found ' . count($groups) . ' device groups';
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'count' => count($groups),
|
||||
'groups' => $groups,
|
||||
);
|
||||
$app->response->setStatus($code);
|
||||
$app->response->headers->set('Content-Type', 'application/json');
|
||||
echo _json_encode($output);
|
||||
}
|
||||
|
||||
function get_devices_by_group() {
|
||||
$app = \Slim\Slim::getInstance();
|
||||
$router = $app->router()->getCurrentRoute()->getParams();
|
||||
$status = 'error';
|
||||
$code = 404;
|
||||
$count = 0;
|
||||
$name = urldecode($router['name']);
|
||||
$devices = array();
|
||||
if (empty($name)) {
|
||||
$message = 'No device group name provided';
|
||||
}
|
||||
else {
|
||||
$group_id = dbFetchCell("SELECT `id` FROM `device_groups` WHERE `name`=?",array($name));
|
||||
$devices = GetDevicesFromGroup($group_id);
|
||||
$count = count($devices);
|
||||
if (empty($devices)) {
|
||||
$message = 'No devices found in group ' . $name;
|
||||
}
|
||||
else {
|
||||
$message = "Found $count in group $name";
|
||||
$code = 200;
|
||||
}
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'count' => $count,
|
||||
'devices' => $devices,
|
||||
);
|
||||
|
||||
$app->response->setStatus($code);
|
||||
$app->response->headers->set('Content-Type', 'application/json');
|
||||
echo _json_encode($output);
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ else {
|
||||
$auth_success = 0;
|
||||
|
||||
if ((isset($_SESSION['username'])) || (isset($_COOKIE['sess_id'],$_COOKIE['token']))) {
|
||||
if ((authenticate($_SESSION['username'], $_SESSION['password'])) || (reauthenticate($_COOKIE['sess_id'], $_COOKIE['token']))) {
|
||||
if (reauthenticate($_COOKIE['sess_id'], $_COOKIE['token']) || authenticate($_SESSION['username'], $_SESSION['password'])) {
|
||||
$_SESSION['userlevel'] = get_userlevel($_SESSION['username']);
|
||||
$_SESSION['user_id'] = get_userid($_SESSION['username']);
|
||||
if (!$_SESSION['authenticated']) {
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
require_once $config['install_dir'].'/lib/pure_php_radius/radius.class.php';
|
||||
|
||||
$radius = new Radius($config['radius']['hostname'], $config['radius']['secret'], $config['radius']['suffix'], $config['radius']['timeout'], $config['radius']['port']);
|
||||
|
||||
function authenticate($username, $password) {
|
||||
global $config, $radius, $debug;
|
||||
|
||||
if (empty($username)) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if ($debug) {
|
||||
$radius->SetDebugMode(TRUE);
|
||||
}
|
||||
$rad = $radius->AccessRequest($username,$password);
|
||||
if($rad === true) {
|
||||
adduser($username);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reauthenticate() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function passwordscanchange() {
|
||||
// not supported so return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function changepassword() {
|
||||
// not supported so return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function auth_usermanagement() {
|
||||
// not supported so return 0
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
function adduser($username, $password, $level=1, $email='', $realname='', $can_modify_passwd=0, $description='', $twofactor=0) {
|
||||
// Check to see if user is already added in the database
|
||||
global $config;
|
||||
if (!user_exists($username)) {
|
||||
$hasher = new PasswordHash(8, false);
|
||||
$encrypted = $hasher->HashPassword($password);
|
||||
if ($config['radius']['default_level'] > 0) {
|
||||
$level = $config['radius']['default_level'];
|
||||
}
|
||||
$userid = dbInsert(array('username' => $username, 'password' => $encrypted, 'realname' => $realname, 'email' => $email, 'descr' => $description, 'level' => $level, 'can_modify_passwd' => $can_modify_passwd, 'twofactor' => $twofactor), 'users');
|
||||
if ($userid == false) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
foreach (dbFetchRows('select notifications.* from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?) order by notifications.notifications_id desc',array($userid)) as $notif) {
|
||||
dbInsert(array('notifications_id'=>$notif['notifications_id'],'user_id'=>$userid,'key'=>'read','value'=>1),'notifications_attribs');
|
||||
}
|
||||
}
|
||||
return $userid;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function user_exists($username) {
|
||||
return dbFetchCell('SELECT COUNT(*) FROM users WHERE username = ?', array($username), true);
|
||||
}
|
||||
|
||||
|
||||
function get_userlevel($username) {
|
||||
return dbFetchCell('SELECT `level` FROM `users` WHERE `username` = ?', array($username), true);
|
||||
}
|
||||
|
||||
|
||||
function get_userid($username) {
|
||||
return dbFetchCell('SELECT `user_id` FROM `users` WHERE `username` = ?', array($username), true);
|
||||
}
|
||||
|
||||
|
||||
function deluser($username) {
|
||||
dbDelete('bill_perms', '`user_name` = ?', array($username));
|
||||
dbDelete('devices_perms', '`user_name` = ?', array($username));
|
||||
dbDelete('ports_perms', '`user_name` = ?', array($username));
|
||||
dbDelete('users_prefs', '`user_name` = ?', array($username));
|
||||
dbDelete('users', '`user_name` = ?', array($username));
|
||||
return dbDelete('users', '`username` = ?', array($username));
|
||||
}
|
||||
|
||||
|
||||
function get_userlist() {
|
||||
return dbFetchRows('SELECT * FROM `users`');
|
||||
}
|
||||
|
||||
|
||||
function can_update_users() {
|
||||
// supported so return 1
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
function get_user($user_id) {
|
||||
return dbFetchRow('SELECT * FROM `users` WHERE `user_id` = ?', array($user_id), true);
|
||||
}
|
||||
|
||||
|
||||
function update_user($user_id, $realname, $level, $can_modify_passwd, $email) {
|
||||
dbUpdate(array('realname' => $realname, 'level' => $level, 'can_modify_passwd' => $can_modify_passwd, 'email' => $email), 'users', '`user_id` = ?', array($user_id));
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Daniel Preussker, QuxLabs UG <preussker@quxlabs.com>
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/**
|
||||
* Generic Image Widget
|
||||
* @author Daniel Preussker
|
||||
* @copyright 2015 Daniel Preussker, QuxLabs UG
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Widgets
|
||||
*/
|
||||
|
||||
if( defined('show_settings') || empty($widget_settings) ) {
|
||||
$common_output[] = '
|
||||
<form class="form" onsubmit="widget_settings(this); return false;">
|
||||
<div class="form-group input_'.$unique_id.'" id="input_'.$unique_id.'">
|
||||
<div class="col-sm-2">
|
||||
<label for="image_url" class="control-label">Title: </label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control input_'.$unique_id.'" name="image_title" placeholder="Title" value="'.htmlspecialchars($widget_settings['image_title']).'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group input_'.$unique_id.'" id="input_'.$unique_id.'">
|
||||
<div class="col-sm-2">
|
||||
<label for="image_url" class="control-label">Image URL: </label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control input_'.$unique_id.'" name="image_url" placeholder="Image URL" value="'.htmlspecialchars($widget_settings['image_url']).'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
<button type="submit" class="btn btn-default">Set</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
}
|
||||
else {
|
||||
$widget_settings['title'] = $widget_settings['image_title'];
|
||||
$common_output[] = '<img class="minigraph-image" width="'.$widget_dimensions['x'].'" height="'.$widget_dimensions['y'].'" src="'.$widget_settings['image_url'].'"/>';
|
||||
}
|
||||
@@ -137,6 +137,17 @@ L.tileLayer(\'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\', {
|
||||
|
||||
var markers = L.markerClusterGroup({
|
||||
maxClusterRadius: ' . $group_radius . ',
|
||||
iconCreateFunction: function (cluster) {
|
||||
var markers = cluster.getAllChildMarkers();
|
||||
var n = 0;
|
||||
newClass = "greenCluster marker-cluster marker-cluster-small leaflet-zoom-animated leaflet-clickable";
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
if (markers[i].options.icon.options.markerColor == "red") {
|
||||
newClass = "redCluster marker-cluster marker-cluster-small leaflet-zoom-animated leaflet-clickable";
|
||||
}
|
||||
}
|
||||
return L.divIcon({ html: cluster.getChildCount(), className: newClass, iconSize: L.point(40, 40) });
|
||||
},
|
||||
});
|
||||
var redMarker = L.AwesomeMarkers.icon({
|
||||
icon: \'server\',
|
||||
|
||||
@@ -222,21 +222,16 @@ if (!defined('MBTTF_DIR')) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check minimum PHP version
|
||||
//
|
||||
/*
|
||||
* Check minimum PHP version
|
||||
* @author f0o <f0o@devilcode.org>
|
||||
* @copyright 2015 f0o, LibreNMS
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Billing
|
||||
*/
|
||||
function CheckPHPVersion($aMinVersion) {
|
||||
list($majorC, $minorC, $editC) = preg_split('/[\/.-]/', PHP_VERSION);
|
||||
list($majorR, $minorR, $editR) = preg_split('/[\/.-]/', $aMinVersion);
|
||||
|
||||
if ($majorC != $majorR) return false;
|
||||
if ($majorC < $majorR) return false;
|
||||
// same major - check minor
|
||||
if ($minorC > $minorR) return true;
|
||||
if ($minorC < $minorR) return false;
|
||||
// and same minor
|
||||
if ($editC >= $editR) return true;
|
||||
return true;
|
||||
return version_compare(PHP_VERSION, $aMinVersion, '>=');
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -38,9 +38,18 @@ else {
|
||||
|
||||
echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" style='cursor: pointer;'>
|
||||
<td valign=top width=350 onclick=\"location.href='".generate_port_url($port)."'\">";
|
||||
echo ' <span class=list-large>
|
||||
|
||||
// Don't echo out ports ifIndex if it's a NOS device since their ifIndex is, for lack of better words....different
|
||||
if ($device['os'] == 'nos') {
|
||||
echo ' <span class=list-large>
|
||||
'.generate_port_link($port, $port['label'])." $error_img $mac
|
||||
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
|
||||
}
|
||||
else {
|
||||
echo ' <span class=list-large>
|
||||
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
|
||||
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
|
||||
}
|
||||
|
||||
if ($port['ifAlias']) {
|
||||
echo '<br />';
|
||||
|
||||
@@ -312,6 +312,10 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($vars['dashboard'])) {
|
||||
dbUpdate(array('dashboard'=>$vars['dashboard']),'users','user_id = ?',array($vars['user_id']));
|
||||
}
|
||||
|
||||
echo "<form class='form-horizontal' role='form' method='post' action=''>
|
||||
<input type='hidden' name='user_id' value='".$vars['user_id']."'>
|
||||
<input type='hidden' name='cur_username' value='" . $users_details['username'] . "'>
|
||||
@@ -374,6 +378,18 @@ if (passwordscanchange($users_details['username'])) {
|
||||
</div>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<div class='form-group'>
|
||||
<label for='dashboard' class='col-sm-2 control-label'>Dashboard</label>
|
||||
<div class='col-sm-4'><select class='form-control' name='dashboard'>";
|
||||
$defdash = dbFetchCell("SELECT dashboard FROM users WHERE user_id = ?",array($vars['user_id']));
|
||||
foreach(dbFetchRows("SELECT dashboards.*,users.username FROM `dashboards` INNER JOIN `users` ON users.user_id = dashboards.user_id WHERE (dashboards.access > 0 && dashboards.user_id != ?) || dashboards.user_id = ?",array($vars['user_id'],$vars['user_id'])) as $dash) {
|
||||
echo "<option value='".$dash['dashboard_id']."'".($defdash == $dash['dashboard_id'] ? ' selected' : '').">".$dash['dashboard_name']."</option>";
|
||||
}
|
||||
echo "</select>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
echo "<div class='form-group'>
|
||||
<div class='col-sm-6'>
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
* Code for Gridster.sort_by_row_and_col_asc(serialization) call is from http://gridster.net/demos/grid-from-serialize.html
|
||||
*/
|
||||
|
||||
$no_refresh = true;
|
||||
if (dbFetchCell('SELECT dashboard_id FROM dashboards WHERE user_id=?',array($_SESSION['user_id'])) == 0) {
|
||||
$no_refresh = true;
|
||||
$default_dash = 0;
|
||||
if (($tmp = dbFetchCell('SELECT dashboard FROM users WHERE user_id=?',array($_SESSION['user_id']))) != 0) {
|
||||
$default_dash = $tmp;
|
||||
}
|
||||
else if (dbFetchCell('SELECT dashboard_id FROM dashboards WHERE user_id=?',array($_SESSION['user_id'])) == 0) {
|
||||
$tmp = dbInsert(array('dashboard_name'=>'Default','user_id'=>$_SESSION['user_id']),'dashboards');
|
||||
$vars['dashboard'] = dbInsert(array('dashboard_name'=>'Default','user_id'=>$_SESSION['user_id']),'dashboards');
|
||||
if (dbFetchCell('select 1 from users_widgets where user_id = ? && dashboard_id = ?',array($_SESSION['user_id'],0)) == 1) {
|
||||
dbUpdate(array('dashboard_id'=>$vars['dashboard']),'users_widgets','user_id = ? && dashboard_id = ?',array($_SESSION['user_id'],0));
|
||||
@@ -31,7 +36,12 @@ if (!empty($vars['dashboard'])) {
|
||||
}
|
||||
}
|
||||
if (empty($vars['dashboard'])) {
|
||||
$vars['dashboard'] = dbFetchRow('select * from dashboards where user_id = ? order by dashboard_id limit 1',array($_SESSION['user_id']));
|
||||
if ($default_dash != 0) {
|
||||
$vars['dashboard'] = dbFetchRow('select * from dashboards where dashboard_id = ?',array($default_dash));
|
||||
}
|
||||
else {
|
||||
$vars['dashboard'] = dbFetchRow('select * from dashboards where user_id = ? order by dashboard_id limit 1',array($_SESSION['user_id']));
|
||||
}
|
||||
if (isset($orig)) {
|
||||
$msg_box[] = array('type' => 'error', 'message' => 'Dashboard <code>#'.$orig.'</code> does not exist! Loaded <code>'.$vars['dashboard']['dashboard_name'].'</code> instead.','title' => 'Requested Dashboard Not Found!');
|
||||
}
|
||||
|
||||
+35
-35
@@ -53,31 +53,32 @@ echo $pagetitle[0];
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($vars['sub'])) {
|
||||
if (is_admin() === true) {
|
||||
if (isset($vars['sub'])) {
|
||||
|
||||
if (file_exists("pages/settings/".mres($vars['sub']).".inc.php")) {
|
||||
require_once "pages/settings/".mres($vars['sub']).".inc.php";
|
||||
}
|
||||
else {
|
||||
print_error("This settings page doesn't exist, please go to the main settings page");
|
||||
}
|
||||
|
||||
if (file_exists("pages/settings/".mres($vars['sub']).".inc.php")) {
|
||||
require_once "pages/settings/".mres($vars['sub']).".inc.php";
|
||||
}
|
||||
else {
|
||||
print_error("This settings page doesn't exist, please go to the main settings page");
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
?>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<?php
|
||||
foreach (dbFetchRows("SELECT `config_group` FROM `config` GROUP BY `config_group`") as $sub_page) {
|
||||
$sub_page = $sub_page['config_group'];
|
||||
foreach (dbFetchRows("SELECT `config_group` FROM `config` GROUP BY `config_group`") as $sub_page) {
|
||||
$sub_page = $sub_page['config_group'];
|
||||
?>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<a class="btn btn-primary" href="<?php echo(generate_url(array('page'=>'settings','sub'=>$sub_page))); ?>"><?php echo ucfirst($sub_page); ?> Settings</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,33 +91,32 @@ else {
|
||||
* @return string
|
||||
*/
|
||||
|
||||
function a2t($a) {
|
||||
$r = "<table class='table table-condensed table-hover'><tbody>";
|
||||
foreach( $a as $k=>$v ) {
|
||||
if( !empty($v) ) {
|
||||
$r .= "<tr><td class='col-md-2'><i><b>".$k."</b></i></td><td class='col-md-10'>".(is_array($v)?a2t($v):"<code>".wordwrap($v,75,"<br/>")."</code>")."</td></tr>";
|
||||
function a2t($a) {
|
||||
$r = "<table class='table table-condensed table-hover'><tbody>";
|
||||
foreach( $a as $k=>$v ) {
|
||||
if( !empty($v) ) {
|
||||
$r .= "<tr><td class='col-md-2'><i><b>".$k."</b></i></td><td class='col-md-10'>".(is_array($v)?a2t($v):"<code>".wordwrap($v,75,"<br/>")."</code>")."</td></tr>";
|
||||
}
|
||||
}
|
||||
$r .= '</tbody></table>';
|
||||
return $r;
|
||||
}
|
||||
echo "<div class='table-responsive'>".a2t($config)."</div>";
|
||||
|
||||
if ($_SESSION['userlevel'] >= '10') {
|
||||
|
||||
if ($debug) {
|
||||
echo("<pre>");
|
||||
print_r($config);
|
||||
echo("</pre>");
|
||||
}
|
||||
}
|
||||
$r .= '</tbody></table>';
|
||||
return $r;
|
||||
}
|
||||
if( $_SESSION['userlevel'] >= 10 ) {
|
||||
echo "<div class='table-responsive'>".a2t($config)."</div>";
|
||||
}
|
||||
else {
|
||||
include 'includes/error-no-perm.inc.php';
|
||||
}
|
||||
|
||||
if ($_SESSION['userlevel'] >= '10') {
|
||||
|
||||
if ($debug) {
|
||||
echo("<pre>");
|
||||
print_r($config);
|
||||
echo("</pre>");
|
||||
else {
|
||||
include 'includes/error-no-perm.inc.php';
|
||||
}
|
||||
}
|
||||
else {
|
||||
include 'includes/error-no-perm.inc.php';
|
||||
}
|
||||
}
|
||||
else {
|
||||
include 'includes/error-no-perm.inc.php';
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -207,7 +207,7 @@ function IsMaintenance( $device ) {
|
||||
$where .= " || alert_schedule_items.target = ?";
|
||||
$params[] = 'g'.$group;
|
||||
}
|
||||
return dbFetchCell('SELECT DISTINCT(alert_schedule.schedule_id) FROM alert_schedule LEFT JOIN alert_schedule_items ON alert_schedule.schedule_id=alert_schedule_items.schedule_id WHERE ( alert_schedule_items.target = ?'.$where.' ) && NOW() BETWEEN alert_schedule.start AND alert_schedule.end LIMIT 1',$params);
|
||||
return dbFetchCell('SELECT alert_schedule.schedule_id FROM alert_schedule LEFT JOIN alert_schedule_items ON alert_schedule.schedule_id=alert_schedule_items.schedule_id WHERE ( alert_schedule_items.target = ?'.$where.' ) && NOW() BETWEEN alert_schedule.start AND alert_schedule.end LIMIT 1',$params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,12 @@ function dbQuery($sql, $parameters=array()) {
|
||||
$fullSql = dbMakeQuery($sql, $parameters);
|
||||
if ($debug) {
|
||||
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
||||
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
|
||||
if (preg_match('/(INSERT INTO `alert_log`).*(details)/i',$fullSql)) {
|
||||
echo "\nINSERT INTO `alert_log` entry masked due to binary data\n";
|
||||
}
|
||||
else {
|
||||
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql_debug[] = $fullSql;
|
||||
|
||||
@@ -28,7 +28,12 @@ function dbQuery($sql, $parameters=array()) {
|
||||
$fullSql = dbMakeQuery($sql, $parameters);
|
||||
if ($debug) {
|
||||
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
||||
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
|
||||
if (preg_match('/(INSERT INTO `alert_log`).*(details)/i',$fullSql)) {
|
||||
echo "\nINSERT INTO `alert_log` entry masked due to binary data\n";
|
||||
}
|
||||
else {
|
||||
print $console_color->convert("\nSQL[%y".$fullSql.'%n] ');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql_debug[] = $fullSql;
|
||||
|
||||
@@ -110,6 +110,7 @@ $config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
$os = 'infinity';
|
||||
$config['os'][$os]['text'] = 'LigoWave Infinity';
|
||||
$config['os'][$os]['type'] = 'wireless';
|
||||
$config['os'][$os]['icon'] = 'ligowave';
|
||||
$config['os'][$os]['nobulk'] = 1;
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
@@ -452,7 +453,6 @@ $os = 'nos';
|
||||
$config['os'][$os]['text'] = 'Brocade NOS';
|
||||
$config['os'][$os]['type'] = 'network';
|
||||
$config['os'][$os]['ifname'] = 1;
|
||||
$config['os'][$os]['descr_to_alias'] = 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';
|
||||
@@ -1380,6 +1380,14 @@ $config['os'][$os]['icon'] = 'riverbed';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Traffic';
|
||||
|
||||
// Ligowave LigoOS
|
||||
$os = 'ligoos';
|
||||
$config['os'][$os]['text'] = 'LigoWave LigoOS';
|
||||
$config['os'][$os]['type'] = 'wireless';
|
||||
$config['os'][$os]['icon'] = 'ligowave';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Traffic';
|
||||
|
||||
// Appliances
|
||||
$os = 'fortios';
|
||||
$config['os'][$os]['text'] = 'FortiOS';
|
||||
@@ -1770,10 +1778,6 @@ if (isset($config['rrdgraph_def_text'])) {
|
||||
$config['rrd_opts_array'] = explode(' ', trim($config['rrdgraph_def_text']));
|
||||
}
|
||||
|
||||
if (!isset($config['log_file'])) {
|
||||
$config['log_file'] = $config['log_dir'].'/'.$config['project_id'].'.log';
|
||||
}
|
||||
|
||||
if (isset($config['cdp_autocreate'])) {
|
||||
$config['dp_autocreate'] = $config['cdp_autocreate'];
|
||||
}
|
||||
@@ -1842,7 +1846,7 @@ if (!isset($config['log_dir'])) {
|
||||
}
|
||||
|
||||
if (!isset($config['log_file'])) {
|
||||
$config['log_dir'].'/'.$config['project_id'].'.log';
|
||||
$config['log_file'] = $config['log_dir'].'/'.$config['project_id'].'.log';
|
||||
}
|
||||
|
||||
if (!isset($config['plugin_dir'])) {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* @param string $search What to searchid for
|
||||
* @return string
|
||||
*/
|
||||
function GenGroupSQL($pattern, $search='') {
|
||||
function GenGroupSQL($pattern, $search='',$extra=0) {
|
||||
$pattern = RunGroupMacros($pattern);
|
||||
if ($pattern === false) {
|
||||
return false;
|
||||
@@ -66,7 +66,11 @@ function GenGroupSQL($pattern, $search='') {
|
||||
$search .= ' &&';
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT('.str_replace('(', '', $tables[0]).'.device_id) FROM '.implode(',', $tables).' WHERE '.$search.' ('.str_replace(array('%', '@', '!~', '~'), array('', '.*', 'NOT REGEXP', 'REGEXP'), $pattern).')';
|
||||
$sql_extra = '';
|
||||
if ($extra === 1) {
|
||||
$sql_extra = ",`devices`.*";
|
||||
}
|
||||
$sql = 'SELECT DISTINCT('.str_replace('(', '', $tables[0]).'.device_id)'.$sql_extra.' FROM '.implode(',', $tables).' WHERE '.$search.' ('.str_replace(array('%', '@', '!~', '~'), array('', '.*', 'NOT REGEXP', 'REGEXP'), $pattern).')';
|
||||
return $sql;
|
||||
|
||||
}//end GenGroupSQL()
|
||||
@@ -99,17 +103,21 @@ function GetDeviceGroups() {
|
||||
|
||||
}//end GetDeviceGroups()
|
||||
|
||||
|
||||
/**
|
||||
* Get all groups of Device
|
||||
* @param integer $device Device-ID
|
||||
* @return array
|
||||
*/
|
||||
function GetGroupsFromDevice($device) {
|
||||
function GetGroupsFromDevice($device,$extra=0) {
|
||||
$ret = array();
|
||||
foreach (GetDeviceGroups() as $group) {
|
||||
if (dbFetchCell(GenGroupSQL($group['pattern'], 'device_id=?').' LIMIT 1', array($device)) == $device) {
|
||||
$ret[] = $group['id'];
|
||||
if (dbFetchCell(GenGroupSQL($group['pattern'], 'device_id=?',$extra).' LIMIT 1', array($device)) == $device) {
|
||||
if ($extra === 0) {
|
||||
$ret[] = $group['id'];
|
||||
}
|
||||
else {
|
||||
$ret[] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -143,12 +143,24 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) {
|
||||
if (!$remote_device_id && is_valid_hostname($lldp['lldpRemSysName'])) {
|
||||
$remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface);
|
||||
}
|
||||
|
||||
// normalize MAC address if present
|
||||
if ($lldp['lldpRemChassisIdSubtype'] == 'macAddress') {
|
||||
$remote_mac_address = str_replace(array(' ', ':', '-'), '', strtolower($lldp['lldpRemChassisId']));
|
||||
}
|
||||
// get remote device hostname from db by MAC address and replace lldpRemSysName if absent
|
||||
if (!$remote_device_id && $remote_mac_address) {
|
||||
$remote_device_id = dbFetchCell('SELECT `device_id` FROM `ports` WHERE ifPhysAddress = ? AND `deleted` = ?', array($remote_mac_address, '0'));
|
||||
if ($remote_device_id) {
|
||||
$remote_device_hostname = dbFetchRow('SELECT `hostname` FROM `devices` WHERE `device_id` = ?', array($remote_device_id));
|
||||
}
|
||||
if ($remote_device_hostname['hostname']) {
|
||||
$lldp['lldpRemSysName'] = $remote_device_hostname['hostname'];
|
||||
}
|
||||
}
|
||||
if ($remote_device_id) {
|
||||
$if = $lldp['lldpRemPortDesc'];
|
||||
$id = $lldp['lldpRemPortId'];
|
||||
$PhysAddress = preg_replace('/ /', '', $id);
|
||||
$remote_port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ? OR `ifDescr` = ? OR `ifName` = ? OR `ifPhysAddress` = ?) AND `device_id` = ?', array($if, $if, $id, $id, $PhysAddress, $remote_device_id));
|
||||
$remote_port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ? OR `ifDescr` = ? OR `ifName` = ? OR `ifPhysAddress` = ?) AND `device_id` = ?', array($if, $if, $id, $id, $remote_mac_address, $remote_device_id));
|
||||
}
|
||||
else {
|
||||
$remote_port_id = '0';
|
||||
@@ -163,7 +175,7 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) {
|
||||
}//end if
|
||||
}//end elseif
|
||||
|
||||
echo 'OSPF Discovery: ';
|
||||
echo ' OSPF Discovery: ';
|
||||
|
||||
if ($config['autodiscovery']['ospf'] === true) {
|
||||
echo "enabled\n";
|
||||
|
||||
@@ -31,6 +31,10 @@ if (is_array($storage_array)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($device['os'] == 'vmware' && $descr == 'Real Memory') {
|
||||
$deny = 0;
|
||||
}
|
||||
|
||||
if ($device['os'] == 'routeros' && $descr == 'main memory') {
|
||||
$deny = 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == "nos") {
|
||||
echo("nos: ");
|
||||
|
||||
$used = snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.6.0", "-Ovq");
|
||||
$total = "100";
|
||||
$free = ($total - $used);
|
||||
|
||||
$percent = $used;
|
||||
|
||||
if (is_numeric($used)) {
|
||||
discover_mempool($valid_mempool, $device, 0, "nos", "Memory", "1", NULL, NULL);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.4413') && !stristr($sysDescr, 'vxworks')) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.4413') && (!stristr($sysDescr, 'vxworks') && !stristr($sysDescr, 'Quanta'))) {
|
||||
$os = 'edgeswitch';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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 (!$os) {
|
||||
if (preg_match('/^LigoPTP/', $sysDescr)) {
|
||||
$os = 'ligoos';
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.2.1.1.1.5') || stristr($sysDescr, 'Brocade Communications Systems')) {
|
||||
$os = 'nos';
|
||||
if (strstr($sysDescr, "Brocade VDX") || strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.2.1.1.1.5') || stristr($sysDescr, 'Brocade Communications Systems')) {
|
||||
$os = "nos";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.4413') && stristr($sysDescr, 'vxworks')) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.4413') && (stristr($sysDescr, 'vxworks') || stristr($sysDescr, 'Quanta'))) {
|
||||
$os = 'quanta';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// Hardcoded discovery of cpu usage on Fortigate devices.
|
||||
// Somewhat dynamic processor discovery for Fortigate boxes.
|
||||
//
|
||||
// FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0
|
||||
// FORTINET-FORTIGATE-MIB::fgSysCpuUsage.X where X is the CPU number
|
||||
// FORTINET-FORTIGATE-MIB::fgProcModDescr.X where X is the CPU number
|
||||
// FORTINET-FORTIGATE-MIB::fgProcessorCount.0 -> Num CPUs in the device
|
||||
|
||||
if ($device['os'] == 'fortigate') {
|
||||
echo 'Fortigate : ';
|
||||
echo 'Fortigate : ';
|
||||
|
||||
$descr = 'Processor';
|
||||
$usage = snmp_get($device, '.1.3.6.1.4.1.12356.101.4.1.3.0', '-Ovq');
|
||||
// Forti have logical CPU numbering - start at 1 and increment to $num_cpu in the box.
|
||||
$num_cpu = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgProcessorCount.0', '-Ovq');
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.12356.101.4.1.3.0', '0', 'fortigate-fixed', $descr, '1', $usage, null, null);
|
||||
}
|
||||
}
|
||||
print "Forti-found $num_cpu CPUs\n";
|
||||
|
||||
for($i = 1; $i <= $num_cpu; $i++) {
|
||||
// HERP DERP IM A FORTIGATE AND I PUT NON NUMERIC VALUES IN A GAUGE
|
||||
$cpu_usage = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgProcessorUsage.$i", '-Ovq');
|
||||
$usage = trim ( str_replace(" %", "", $cpu_usage ) ) ;
|
||||
$descr = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgProcModDescr.$i", '-Ovq');
|
||||
print "CPU: $num_cpu - USAGE: $cpu_usage - TYPE $descr\n";
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, "FORTINET-FORTIGATE-MIB::fgProcessorUsage." . $num_cpu, '0', 'fortigate-fixed', $descr, '1', $usage, null, null);
|
||||
}
|
||||
} // END For loop for CPU discovery
|
||||
|
||||
} // END if device is Fortigate
|
||||
|
||||
unset($processors_array);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == "nos") {
|
||||
echo("nos : ");
|
||||
|
||||
$descr = "CPU";
|
||||
$usage = snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.1.0", "-Ovq");
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, "1.3.6.1.4.1.1588.2.1.1.1.26.1", "0", "nos", $descr, "1", $usage, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
unset ($processors_array);
|
||||
@@ -33,6 +33,13 @@ if (is_array($hrstorage_array)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($device['os'] == 'vmware' && $descr == 'Real Memory') {
|
||||
$old_rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('storage-hrstorage-'.safename($descr).'.rrd');
|
||||
$new_rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('mempool-hrstorage-'.$storage['hrStorageIndex'].'.rrd');
|
||||
rename($old_rrdfile, $new_rrdfile);
|
||||
$deny = 1;
|
||||
}
|
||||
|
||||
foreach ($config['ignore_mount'] as $bi) {
|
||||
if ($bi == $descr) {
|
||||
$deny = 1;
|
||||
|
||||
@@ -109,6 +109,7 @@ $mapping = array(
|
||||
);
|
||||
|
||||
$values = array();
|
||||
unset($fields);
|
||||
foreach ($mapping as $k => $v) {
|
||||
$fields[$k] = isset($map[$v]) ? $map[$v] : (-1);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ function poll_sensor($device, $class, $unit) {
|
||||
log_event(ucfirst($class).' '.$sensor['sensor_descr'].' above threshold: '.$sensor_value." $unit (> ".$sensor['sensor_limit']." $unit)", $device, $class, $sensor['sensor_id']);
|
||||
}
|
||||
|
||||
dbUpdate(array('sensor_current' => $sensor_value), 'sensors', '`sensor_class` = ? AND `sensor_id` = ?', array($class, $sensor['sensor_id']));
|
||||
dbUpdate(array('sensor_current' => $sensor_value, 'lastupdate' => array('NOW()')), 'sensors', '`sensor_class` = ? AND `sensor_id` = ?', array($class, $sensor['sensor_id']));
|
||||
}//end foreach
|
||||
|
||||
}//end poll_sensor()
|
||||
|
||||
@@ -50,7 +50,7 @@ if ($ipmi['host'] = get_dev_attrib($device, 'ipmi_hostname')) {
|
||||
rrdtool_update($rrd_file, $fields);
|
||||
|
||||
// FIXME warnings in event & mail not done here yet!
|
||||
dbUpdate(array('sensor_current' => $sensor), 'sensors', 'poller_type = ? AND sensor_class = ? AND sensor_id = ?', array('ipmi', $ipmisensors['sensor_class'], $ipmisensors['sensor_id']));
|
||||
dbUpdate(array('sensor_current' => $sensor, 'lastupdate' => array('NOW()')), 'sensors', 'poller_type = ? AND sensor_class = ? AND sensor_id = ?', array('ipmi', $ipmisensors['sensor_class'], $ipmisensors['sensor_id']));
|
||||
}
|
||||
|
||||
unset($ipmi_sensor);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Somewhat of an uggly hack since NOS doesn't support fetching total memory of the device over SNMP
|
||||
// Given OID returns usage in percent so we set total to 100 in order to get a proper graph
|
||||
$mempool['total'] = "100";
|
||||
$mempool['used'] = snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.6.0", "-Ovq");
|
||||
$mempool['free'] = ($mempool['total'] - $mempool['used']);
|
||||
@@ -33,21 +33,4 @@ if (is_numeric($sessions)) {
|
||||
$graphs['fortigate_sessions'] = true;
|
||||
}
|
||||
|
||||
$cpurrd = $config['rrd_dir'].'/'.$device['hostname'].'/fortigate_cpu.rrd';
|
||||
$cpu_usage = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0', '-Ovq');
|
||||
|
||||
if (is_numeric($cpu_usage)) {
|
||||
if (!is_file($cpurrd)) {
|
||||
rrdtool_create($cpurrd, ' --step 300 DS:LOAD:GAUGE:600:-1:100 '.$config['rrd_rra']);
|
||||
}
|
||||
|
||||
echo "CPU: $cpu_usage%\n";
|
||||
|
||||
$fields = array(
|
||||
'LOAD' => $cpu_usage,
|
||||
);
|
||||
|
||||
rrdtool_update($cpurrd, $fields);
|
||||
|
||||
$graphs['fortigate_cpu'] = true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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.
|
||||
*/
|
||||
|
||||
list($hardware,$version) = explode(',', $poll_device['sysDescr']);
|
||||
preg_match('/(v[0-9\-\.]+)/', $version, $tmp_version);
|
||||
$version = rtrim($tmp_version[0],'.');
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
// SNMPv2-MIB::sysDescr.0 Brocade VDX Switch.
|
||||
if (preg_match('/Brocade ([\s\d\w]+)/', $poll_device['sysDescr'], $hardware)) {
|
||||
$hardware = $hardware[1];
|
||||
}
|
||||
$version = trim(snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.1.6.0", "-Ovq"),'"');
|
||||
$hardware = trim(snmp_get($device, "ENTITY-MIB::entPhysicalDescr.1", "-Ovq"),'"');
|
||||
$serial = trim(snmp_get($device, "1.3.6.1.2.1.47.1.1.1.1.11.1", "-Ovq"),'"');
|
||||
@@ -354,7 +354,7 @@ foreach ($ports as $port) {
|
||||
echo 'VLAN == '.$this_port['ifVlan'];
|
||||
|
||||
// When devices do not provide ifAlias data, populate with ifDescr data if configured
|
||||
if (($this_port['ifAlias'] == '' || $this_port['ifAlias'] == NULL) || $config['os'][$device['os']]['descr_to_alias'] == 1) {
|
||||
if ($this_port['ifAlias'] == '' || $this_port['ifAlias'] == NULL) {
|
||||
$this_port['ifAlias'] = $this_port['ifDescr'];
|
||||
d_echo('Using ifDescr as ifAlias');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$proc = trim(snmp_get($device, "1.3.6.1.4.1.1588.2.1.1.1.26.1.0", "-Ovq"),'"');
|
||||
@@ -9,7 +9,7 @@ if( !empty($service['service_ip']) ) {
|
||||
$cmd .= " ".$service['service_param'];
|
||||
|
||||
$check = shell_exec($cmd);
|
||||
list($check, $time) = split("\|", $check);
|
||||
list($check, $time) = explode("\|", $check);
|
||||
|
||||
if(strstr($check, "SSL_CERT OK")) {
|
||||
$status = '1';
|
||||
|
||||
@@ -0,0 +1,840 @@
|
||||
<?php
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Pure PHP radius class
|
||||
*
|
||||
* This Radius class is a radius client implementation in pure PHP
|
||||
* following the RFC 2865 rules (http://www.ietf.org/rfc/rfc2865.txt)
|
||||
*
|
||||
* This class works with at least the following RADIUS servers:
|
||||
* - Authenex Strong Authentication System (ASAS) with two-factor authentication
|
||||
* - FreeRADIUS, a free Radius server implementation for Linux and *nix environments
|
||||
* - Microsoft Radius server IAS
|
||||
* - Mideye RADIUS server (http://www.mideye.com)
|
||||
* - Radl, a free Radius server for Windows
|
||||
* - RSA SecurID
|
||||
* - VASCO Middleware 3.0 server
|
||||
* - WinRadius, Windows Radius server (free for 5 users)
|
||||
* - ZyXEL ZyWALL OTP (Authenex ASAS branded by ZyXEL, cheaper)
|
||||
*
|
||||
*
|
||||
* LICENCE
|
||||
*
|
||||
* Copyright (c) 2008, SysCo systemes de communication sa
|
||||
* SysCo (tm) is a trademark of SysCo systemes de communication sa
|
||||
* (http://www.sysco.ch/)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of the Pure PHP radius class
|
||||
*
|
||||
* Pure PHP radius class is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the License,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* Pure PHP radius class is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with Pure PHP radius class.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* @author: SysCo/al
|
||||
* @since CreationDate: 2008-01-04
|
||||
* @copyright (c) 2008 by SysCo systemes de communication sa
|
||||
* @version $LastChangedRevision: 1.2.2 $
|
||||
* @version $LastChangedDate: 2009-01-05 $
|
||||
* @version $LastChangedBy: SysCo/al $
|
||||
* @link $HeadURL: radius.class.php $
|
||||
* @link http://developer.sysco.ch/php/
|
||||
* @link developer@sysco.ch
|
||||
* Language: PHP 4.0.7 or higher
|
||||
*
|
||||
*
|
||||
* Usage
|
||||
*
|
||||
* require_once('radius.class.php');
|
||||
* $radius = new Radius($ip_radius_server = 'radius_server_ip_address', $shared_secret = 'radius_shared_secret'[, $radius_suffix = 'optional_radius_suffix'[, $udp_timeout = udp_timeout_in_seconds[, $authentication_port = 1812]]]);
|
||||
* $result = $radius->Access_Request($username = 'username', $password = 'password'[, $udp_timeout = udp_timeout_in_seconds]);
|
||||
*
|
||||
*
|
||||
* Examples
|
||||
*
|
||||
* Example 1
|
||||
* <?php
|
||||
* require_once('radius.class.php');
|
||||
* $radius = new Radius('127.0.0.1', 'secret');
|
||||
* $radius->SetNasIpAddress('1.2.3.4'); // Needed for some devices, and not auto_detected if PHP not runned through a web server
|
||||
* if ($radius->AccessRequest('user', 'pass'))
|
||||
* {
|
||||
* echo "Authentication accepted.";
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* echo "Authentication rejected.";
|
||||
* }
|
||||
* ?>
|
||||
*
|
||||
* Example 2
|
||||
* <?php
|
||||
* require_once('radius.class.php');
|
||||
* $radius = new Radius('127.0.0.1', 'secret');
|
||||
* $radius->SetNasPort(0);
|
||||
* $radius->SetNasIpAddress('1.2.3.4'); // Needed for some devices, and not auto_detected if PHP not runned through a web server
|
||||
* if ($radius->AccessRequest('user', 'pass'))
|
||||
* {
|
||||
* echo "Authentication accepted.";
|
||||
* echo "<br />";
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* echo "Authentication rejected.";
|
||||
* echo "<br />";
|
||||
* }
|
||||
* echo $radius->GetReadableReceivedAttributes();
|
||||
* ?>
|
||||
*
|
||||
*
|
||||
* External file needed
|
||||
*
|
||||
* none.
|
||||
*
|
||||
*
|
||||
* External file created
|
||||
*
|
||||
* none.
|
||||
*
|
||||
*
|
||||
* Special issues
|
||||
*
|
||||
* - Sockets support must be enabled.
|
||||
* * In Linux and *nix environments, the extension is enabled at
|
||||
* compile time using the --enable-sockets configure option
|
||||
* * In Windows, PHP Sockets can be activated by un-commenting
|
||||
* extension=php_sockets.dll in php.ini
|
||||
*
|
||||
*
|
||||
* Other related ressources
|
||||
*
|
||||
* FreeRADIUS, a free Radius server implementation for Linux and *nix environments:
|
||||
* http://www.freeradius.org/
|
||||
*
|
||||
* WinRadius, Windows Radius server (free for 5 users):
|
||||
* http://www.itconsult2000.com/en/product/WinRadius.zip
|
||||
*
|
||||
* Radl, a free Radius server for Windows:
|
||||
* http://www.loriotpro.com/Products/RadiusServer/FreeRadiusServer_EN.php
|
||||
*
|
||||
* DOS command line Radius client:
|
||||
* http://www.itconsult2000.com/en/product/WinRadiusClient.zip
|
||||
*
|
||||
*
|
||||
* Users feedbacks and comments
|
||||
*
|
||||
* 2008-07-02 Pim Koeman/Parantion
|
||||
*
|
||||
* When using a radius connection behind a linux iptables firewall
|
||||
* allow port 1812 and 1813 with udp protocol
|
||||
*
|
||||
* IPTABLES EXAMPLE (command line):
|
||||
* iptables -A AlwaysACCEPT -p udp --dport 1812 -j ACCEPT
|
||||
* iptables -A AlwaysACCEPT -p udp --dport 1813 -j ACCEPT
|
||||
*
|
||||
* or put the lines in /etc/sysconfig/iptables (red-hat type systems (fedora, centos, rhel etc.)
|
||||
* -A AlwaysACCEPT -p udp --dport 1812 -j ACCEPT
|
||||
* -A AlwaysACCEPT -p udp --dport 1813 -j ACCEPT
|
||||
*
|
||||
*
|
||||
* Change Log
|
||||
*
|
||||
* 2009-01-05 1.2.2 SysCo/al Added Robert Svensson feedback, Mideye RADIUS server is supported
|
||||
* 2008-11-11 1.2.1 SysCo/al Added Carlo Ferrari resolution in examples (add NAS IP Address for a VASCO Middleware server)
|
||||
* 2008-07-07 1.2 SysCo/al Added Pim Koeman (Parantion) contribution
|
||||
* - comments concerning using radius behind a linux iptables firewall
|
||||
* Added Jon Bright (tick Trading Software AG) contribution
|
||||
* - false octal encoding with 0xx indexes (indexes are now rewritten in xx only)
|
||||
* - challenge/response support for the RSA SecurID New-PIN mode
|
||||
* Added GetRadiusPacketInfo() method
|
||||
* Added GetAttributesInfo() method
|
||||
* Added DecodeVendorSpecificContent() (to answer Raul Carvalho's question)
|
||||
* Added Decoded Vendor Specific Content in debug messages
|
||||
* 2008-02-04 1.1 SysCo/al Typo error for the udp_timeout parameter (line 256 in the version 1.0)
|
||||
* 2008-01-07 1.0 SysCo/al Initial release
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Radius
|
||||
* Pure PHP radius class
|
||||
*
|
||||
* Creation 2008-01-04
|
||||
* Update 2009-01-05
|
||||
* @package radius
|
||||
* @version v.1.2.2
|
||||
* @author SysCo/al
|
||||
*
|
||||
*********************************************************************/
|
||||
class Radius
|
||||
{
|
||||
var $_ip_radius_server; // Radius server IP address
|
||||
var $_shared_secret; // Shared secret with the radius server
|
||||
var $_radius_suffix; // Radius suffix (default is '');
|
||||
var $_udp_timeout; // Timeout of the UDP connection in seconds (default value is 5)
|
||||
var $_authentication_port; // Authentication port (default value is 1812)
|
||||
var $_accounting_port; // Accouting port (default value is 1813)
|
||||
var $_nas_ip_address; // NAS IP address
|
||||
var $_nas_port; // NAS port
|
||||
var $_encrypted_password; // Encrypted password, as described in the RFC 2865
|
||||
var $_user_ip_address; // Remote IP address of the user
|
||||
var $_request_authenticator; // Request-Authenticator, 16 octets random number
|
||||
var $_response_authenticator; // Request-Authenticator, 16 octets random number
|
||||
var $_username; // Username to sent to the Radius server
|
||||
var $_password; // Password to sent to the Radius server (clear password, must be encrypted)
|
||||
var $_identifier_to_send; // Identifier field for the packet to be sent
|
||||
var $_identifier_received; // Identifier field for the received packet
|
||||
var $_radius_packet_to_send; // Radius packet code (1=Access-Request, 2=Access-Accept, 3=Access-Reject, 4=Accounting-Request, 5=Accounting-Response, 11=Access-Challenge, 12=Status-Server (experimental), 13=Status-Client (experimental), 255=Reserved
|
||||
var $_radius_packet_received; // Radius packet code (1=Access-Request, 2=Access-Accept, 3=Access-Reject, 4=Accounting-Request, 5=Accounting-Response, 11=Access-Challenge, 12=Status-Server (experimental), 13=Status-Client (experimental), 255=Reserved
|
||||
var $_attributes_to_send; // Radius attributes to send
|
||||
var $_attributes_received; // Radius attributes received
|
||||
var $_socket_to_server; // Socket connection
|
||||
var $_debug_mode; // Debug mode flag
|
||||
var $_attributes_info; // Attributes info array
|
||||
var $_radius_packet_info; // Radius packet codes info array
|
||||
var $_last_error_code; // Last error code
|
||||
var $_last_error_message; // Last error message
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Name: Radius
|
||||
* short description: Radius class constructor
|
||||
*
|
||||
* Creation 2008-01-04
|
||||
* Update 2009-01-05
|
||||
* @version v.1.2.2
|
||||
* @author SysCo/al
|
||||
* @param string ip address of the radius server
|
||||
* @param string shared secret with the radius server
|
||||
* @param string radius domain name suffix (default is empty)
|
||||
* @param integer UDP timeout (default is 5)
|
||||
* @param integer authentication port
|
||||
* @param integer accounting port
|
||||
* @return NULL
|
||||
*********************************************************************/
|
||||
public function Radius($ip_radius_server = '127.0.0.1', $shared_secret = '', $radius_suffix = '', $udp_timeout = 5, $authentication_port = 1812, $accounting_port = 1813)
|
||||
{
|
||||
$this->_radius_packet_info[1] = 'Access-Request';
|
||||
$this->_radius_packet_info[2] = 'Access-Accept';
|
||||
$this->_radius_packet_info[3] = 'Access-Reject';
|
||||
$this->_radius_packet_info[4] = 'Accounting-Request';
|
||||
$this->_radius_packet_info[5] = 'Accounting-Response';
|
||||
$this->_radius_packet_info[11] = 'Access-Challenge';
|
||||
$this->_radius_packet_info[12] = 'Status-Server (experimental)';
|
||||
$this->_radius_packet_info[13] = 'Status-Client (experimental)';
|
||||
$this->_radius_packet_info[255] = 'Reserved';
|
||||
|
||||
$this->_attributes_info[1] = array('User-Name', 'S');
|
||||
$this->_attributes_info[2] = array('User-Password', 'S');
|
||||
$this->_attributes_info[3] = array('CHAP-Password', 'S'); // Type (1) / Length (1) / CHAP Ident (1) / String
|
||||
$this->_attributes_info[4] = array('NAS-IP-Address', 'A');
|
||||
$this->_attributes_info[5] = array('NAS-Port', 'I');
|
||||
$this->_attributes_info[6] = array('Service-Type', 'I');
|
||||
$this->_attributes_info[7] = array('Framed-Protocol', 'I');
|
||||
$this->_attributes_info[8] = array('Framed-IP-Address', 'A');
|
||||
$this->_attributes_info[9] = array('Framed-IP-Netmask', 'A');
|
||||
$this->_attributes_info[10] = array('Framed-Routing', 'I');
|
||||
$this->_attributes_info[11] = array('Filter-Id', 'T');
|
||||
$this->_attributes_info[12] = array('Framed-MTU', 'I');
|
||||
$this->_attributes_info[13] = array('Framed-Compression', 'I');
|
||||
$this->_attributes_info[14] = array( 'Login-IP-Host', 'A');
|
||||
$this->_attributes_info[15] = array('Login-service', 'I');
|
||||
$this->_attributes_info[16] = array('Login-TCP-Port', 'I');
|
||||
$this->_attributes_info[17] = array('(unassigned)', '');
|
||||
$this->_attributes_info[18] = array('Reply-Message', 'T');
|
||||
$this->_attributes_info[19] = array('Callback-Number', 'S');
|
||||
$this->_attributes_info[20] = array('Callback-Id', 'S');
|
||||
$this->_attributes_info[21] = array('(unassigned)', '');
|
||||
$this->_attributes_info[22] = array('Framed-Route', 'T');
|
||||
$this->_attributes_info[23] = array('Framed-IPX-Network', 'I');
|
||||
$this->_attributes_info[24] = array('State', 'S');
|
||||
$this->_attributes_info[25] = array('Class', 'S');
|
||||
$this->_attributes_info[26] = array('Vendor-Specific', 'S'); // Type (1) / Length (1) / Vendor-Id (4) / Vendor type (1) / Vendor length (1) / Attribute-Specific...
|
||||
$this->_attributes_info[27] = array('Session-Timeout', 'I');
|
||||
$this->_attributes_info[28] = array('Idle-Timeout', 'I');
|
||||
$this->_attributes_info[29] = array('Termination-Action', 'I');
|
||||
$this->_attributes_info[30] = array('Called-Station-Id', 'S');
|
||||
$this->_attributes_info[31] = array('Calling-Station-Id', 'S');
|
||||
$this->_attributes_info[32] = array('NAS-Identifier', 'S');
|
||||
$this->_attributes_info[33] = array('Proxy-State', 'S');
|
||||
$this->_attributes_info[34] = array('Login-LAT-Service', 'S');
|
||||
$this->_attributes_info[35] = array('Login-LAT-Node', 'S');
|
||||
$this->_attributes_info[36] = array('Login-LAT-Group', 'S');
|
||||
$this->_attributes_info[37] = array('Framed-AppleTalk-Link', 'I');
|
||||
$this->_attributes_info[38] = array('Framed-AppleTalk-Network', 'I');
|
||||
$this->_attributes_info[39] = array('Framed-AppleTalk-Zone', 'S');
|
||||
$this->_attributes_info[60] = array('CHAP-Challenge', 'S');
|
||||
$this->_attributes_info[61] = array('NAS-Port-Type', 'I');
|
||||
$this->_attributes_info[62] = array('Port-Limit', 'I');
|
||||
$this->_attributes_info[63] = array('Login-LAT-Port', 'S');
|
||||
$this->_attributes_info[76] = array('Prompt', 'I');
|
||||
|
||||
$this->_identifier_to_send = 0;
|
||||
$this->_user_ip_address = (isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:'0.0.0.0');
|
||||
|
||||
$this->GenerateRequestAuthenticator();
|
||||
$this->SetIpRadiusServer($ip_radius_server);
|
||||
$this->SetSharedSecret($shared_secret);
|
||||
$this->SetAuthenticationPort($authentication_port);
|
||||
$this->SetAccountingPort($accounting_port);
|
||||
$this->SetRadiusSuffix($radius_suffix);
|
||||
$this->SetUdpTimeout($udp_timeout);
|
||||
$this->SetUsername();
|
||||
$this->SetPassword();
|
||||
$this->SetNasIpAddress();
|
||||
$this->SetNasPort();
|
||||
|
||||
$this->ClearLastError();
|
||||
$this->ClearDataToSend();
|
||||
$this->ClearDataReceived();
|
||||
}
|
||||
|
||||
|
||||
function GetNextIdentifier()
|
||||
{
|
||||
$this->_identifier_to_send = (($this->_identifier_to_send + 1) % 256);
|
||||
return $this->_identifier_to_send;
|
||||
}
|
||||
|
||||
|
||||
function GenerateRequestAuthenticator()
|
||||
{
|
||||
$this->_request_authenticator = '';
|
||||
for ($ra_loop = 0; $ra_loop <= 15; $ra_loop++)
|
||||
{
|
||||
$this->_request_authenticator .= chr(rand(1, 255));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function GetRequestAuthenticator()
|
||||
{
|
||||
return $this->_request_authenticator;
|
||||
}
|
||||
|
||||
|
||||
function GetLastError()
|
||||
{
|
||||
if (0 < $this->_last_error_code)
|
||||
{
|
||||
return $this->_last_error_message.' ('.$this->_last_error_code.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ClearDataToSend()
|
||||
{
|
||||
$this->_radius_packet_to_send = 0;
|
||||
$this->_attributes_to_send = NULL;
|
||||
}
|
||||
|
||||
|
||||
function ClearDataReceived()
|
||||
{
|
||||
$this->_radius_packet_received = 0;
|
||||
$this->_attributes_received = NULL;
|
||||
}
|
||||
|
||||
|
||||
function SetPacketCodeToSend($packet_code)
|
||||
{
|
||||
$this->_radius_packet_to_send = $packet_code;
|
||||
}
|
||||
|
||||
|
||||
function SetDebugMode($debug_mode)
|
||||
{
|
||||
$this->_debug_mode = (TRUE === $debug_mode);
|
||||
}
|
||||
|
||||
|
||||
function SetIpRadiusServer($ip_radius_server)
|
||||
{
|
||||
$this->_ip_radius_server = gethostbyname($ip_radius_server);
|
||||
}
|
||||
|
||||
|
||||
function SetSharedSecret($shared_secret)
|
||||
{
|
||||
$this->_shared_secret = $shared_secret;
|
||||
}
|
||||
|
||||
|
||||
function SetRadiusSuffix($radius_suffix)
|
||||
{
|
||||
$this->_radius_suffix = $radius_suffix;
|
||||
}
|
||||
|
||||
|
||||
function SetUsername($username = '')
|
||||
{
|
||||
$temp_username = $username;
|
||||
if (false === strpos($temp_username, '@'))
|
||||
{
|
||||
$temp_username .= $this->_radius_suffix;
|
||||
}
|
||||
|
||||
$this->_username = $temp_username;
|
||||
$this->SetAttribute(1, $this->_username);
|
||||
}
|
||||
|
||||
|
||||
function SetPassword($password = '')
|
||||
{
|
||||
$this->_password = $password;
|
||||
$encrypted_password = '';
|
||||
$padded_password = $password;
|
||||
|
||||
if (0 != (strlen($password)%16))
|
||||
{
|
||||
$padded_password .= str_repeat(chr(0),(16-strlen($password)%16));
|
||||
}
|
||||
|
||||
$previous_result = $this->_request_authenticator;
|
||||
|
||||
for ($full_loop = 0; $full_loop < (strlen($padded_password)/16); $full_loop++)
|
||||
{
|
||||
$xor_value = md5($this->_shared_secret.$previous_result);
|
||||
|
||||
$previous_result = '';
|
||||
for ($xor_loop = 0; $xor_loop <= 15; $xor_loop++)
|
||||
{
|
||||
$value1 = ord(substr($padded_password, ($full_loop * 16) + $xor_loop, 1));
|
||||
$value2 = hexdec(substr($xor_value, 2*$xor_loop, 2));
|
||||
$xor_result = $value1 ^ $value2;
|
||||
$previous_result .= chr($xor_result);
|
||||
}
|
||||
$encrypted_password .= $previous_result;
|
||||
}
|
||||
|
||||
$this->_encrypted_password = $encrypted_password;
|
||||
$this->SetAttribute(2, $this->_encrypted_password);
|
||||
}
|
||||
|
||||
|
||||
function SetNasIPAddress($nas_ip_address = '')
|
||||
{
|
||||
if (0 < strlen($nas_ip_address))
|
||||
{
|
||||
$this->_nas_ip_address = gethostbyname($nas_ip_address);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_nas_ip_address = gethostbyname(isset($_SERVER['SERVER_ADDR'])?$_SERVER['SERVER_ADDR']:'0.0.0.0');
|
||||
}
|
||||
$this->SetAttribute(4, $this->_nas_ip_address);
|
||||
}
|
||||
|
||||
|
||||
function SetNasPort($nas_port = 0)
|
||||
{
|
||||
$this->_nas_port = intval($nas_port);
|
||||
$this->SetAttribute(5, $this->_nas_port);
|
||||
}
|
||||
|
||||
|
||||
function SetUdpTimeout($udp_timeout = 5)
|
||||
{
|
||||
if (intval($udp_timeout) > 0)
|
||||
{
|
||||
$this->_udp_timeout = intval($udp_timeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ClearLastError()
|
||||
{
|
||||
$this->_last_error_code = 0;
|
||||
$this->_last_error_message = '';
|
||||
}
|
||||
|
||||
|
||||
function SetAuthenticationPort($authentication_port)
|
||||
{
|
||||
if ((intval($authentication_port) > 0) && (intval($authentication_port) < 65536))
|
||||
{
|
||||
$this->_authentication_port = intval($authentication_port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function SetAccountingPort($accounting_port)
|
||||
{
|
||||
if ((intval($accounting_port) > 0) && (intval($accounting_port) < 65536))
|
||||
{
|
||||
$this->_accounting_port = intval($accounting_port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function GetReceivedPacket()
|
||||
{
|
||||
return $this->_radius_packet_received;
|
||||
}
|
||||
|
||||
|
||||
function GetReceivedAttributes()
|
||||
{
|
||||
return $this->_attributes_received;
|
||||
}
|
||||
|
||||
|
||||
function GetReadableReceivedAttributes()
|
||||
{
|
||||
$readable_attributes = '';
|
||||
if (isset($this->_attributes_received))
|
||||
{
|
||||
foreach($this->_attributes_received as $one_received_attribute)
|
||||
{
|
||||
$attributes_info = $this->GetAttributesInfo($one_received_attribute[0]);
|
||||
$readable_attributes .= $attributes_info[0].": ";
|
||||
if (26 == $one_received_attribute[0])
|
||||
{
|
||||
$vendor_array = $this->DecodeVendorSpecificContent($one_received_attribute[1]);
|
||||
foreach($vendor_array as $vendor_one)
|
||||
{
|
||||
$readable_attributes .= 'Vendor-Id: '.$vendor_one[0].", Vendor-type: ".$vendor_one[1].", Attribute-specific: ".$vendor_one[2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$readable_attributes .= $one_received_attribute[1];
|
||||
}
|
||||
$readable_attributes .= "<br />\n";
|
||||
}
|
||||
}
|
||||
return $readable_attributes;
|
||||
}
|
||||
|
||||
|
||||
function GetAttribute($attribute_type)
|
||||
{
|
||||
$attribute_value = NULL;
|
||||
foreach($this->_attributes_received as $one_received_attribute)
|
||||
{
|
||||
if (intval($attribute_type) == $one_received_attribute[0])
|
||||
{
|
||||
$attribute_value = $one_received_attribute[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $attribute_value;
|
||||
}
|
||||
|
||||
|
||||
function GetRadiusPacketInfo($info_index)
|
||||
{
|
||||
if (isset($this->_radius_packet_info[intval($info_index)]))
|
||||
{
|
||||
return $this->_radius_packet_info[intval($info_index)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function GetAttributesInfo($info_index)
|
||||
{
|
||||
if (isset($this->_attributes_info[intval($info_index)]))
|
||||
{
|
||||
return $this->_attributes_info[intval($info_index)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return array('','');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function DebugInfo($debug_info)
|
||||
{
|
||||
if ($this->_debug_mode)
|
||||
{
|
||||
echo date('Y-m-d H:i:s').' DEBUG: ';
|
||||
echo $debug_info;
|
||||
echo '<br />';
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function SetAttribute($type, $value)
|
||||
{
|
||||
$attribute_index = -1;
|
||||
for ($attributes_loop = 0; $attributes_loop < count($this->_attributes_to_send); $attributes_loop++)
|
||||
{
|
||||
if ($type == ord(substr($this->_attributes_to_send[$attributes_loop], 0, 1)))
|
||||
{
|
||||
$attribute_index = $attributes_loop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$temp_attribute = NULL;
|
||||
|
||||
if (isset($this->_attributes_info[$type]))
|
||||
{
|
||||
switch ($this->_attributes_info[$type][1])
|
||||
{
|
||||
case 'T': // Text, 1-253 octets containing UTF-8 encoded ISO 10646 characters (RFC 2279).
|
||||
$temp_attribute = chr($type).chr(2+strlen($value)).$value;
|
||||
break;
|
||||
case 'S': // String, 1-253 octets containing binary data (values 0 through 255 decimal, inclusive).
|
||||
$temp_attribute = chr($type).chr(2+strlen($value)).$value;
|
||||
break;
|
||||
case 'A': // Address, 32 bit value, most significant octet first.
|
||||
$ip_array = explode(".", $value);
|
||||
$temp_attribute = chr($type).chr(6).chr($ip_array[0]).chr($ip_array[1]).chr($ip_array[2]).chr($ip_array[3]);
|
||||
break;
|
||||
case 'I': // Integer, 32 bit unsigned value, most significant octet first.
|
||||
$temp_attribute = chr($type).chr(6).chr(($value/(256*256*256))%256).chr(($value/(256*256))%256).chr(($value/(256))%256).chr($value%256);
|
||||
break;
|
||||
case 'D': // Time, 32 bit unsigned value, most significant octet first -- seconds since 00:00:00 UTC, January 1, 1970. (not used in this RFC)
|
||||
$temp_attribute = NULL;
|
||||
break;
|
||||
default:
|
||||
$temp_attribute = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ($attribute_index > -1)
|
||||
{
|
||||
$this->_attributes_to_send[$attribute_index] = $temp_attribute;
|
||||
$additional_debug = 'Modified';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_attributes_to_send[] = $temp_attribute;
|
||||
$additional_debug = 'Added';
|
||||
}
|
||||
$attribute_info = $this->GetAttributesInfo($type);
|
||||
$this->DebugInfo($additional_debug.' Attribute '.$type.' ('.$attribute_info[0].'), format '.$attribute_info[1].', value <em>'.$value.'</em>');
|
||||
}
|
||||
|
||||
|
||||
function DecodeAttribute($attribute_raw_value, $attribute_format)
|
||||
{
|
||||
$attribute_value = NULL;
|
||||
|
||||
if (isset($this->_attributes_info[$attribute_format]))
|
||||
{
|
||||
switch ($this->_attributes_info[$attribute_format][1])
|
||||
{
|
||||
case 'T': // Text, 1-253 octets containing UTF-8 encoded ISO 10646 characters (RFC 2279).
|
||||
$attribute_value = $attribute_raw_value;
|
||||
break;
|
||||
case 'S': // String, 1-253 octets containing binary data (values 0 through 255 decimal, inclusive).
|
||||
$attribute_value = $attribute_raw_value;
|
||||
break;
|
||||
case 'A': // Address, 32 bit value, most significant octet first.
|
||||
$attribute_value = ord(substr($attribute_raw_value, 0, 1)).'.'.ord(substr($attribute_raw_value, 1, 1)).'.'.ord(substr($attribute_raw_value, 2, 1)).'.'.ord(substr($attribute_raw_value, 3, 1));
|
||||
break;
|
||||
case 'I': // Integer, 32 bit unsigned value, most significant octet first.
|
||||
$attribute_value = (ord(substr($attribute_raw_value, 0, 1))*256*256*256)+(ord(substr($attribute_raw_value, 1, 1))*256*256)+(ord(substr($attribute_raw_value, 2, 1))*256)+ord(substr($attribute_raw_value, 3, 1));
|
||||
break;
|
||||
case 'D': // Time, 32 bit unsigned value, most significant octet first -- seconds since 00:00:00 UTC, January 1, 1970. (not used in this RFC)
|
||||
$attribute_value = NULL;
|
||||
break;
|
||||
default:
|
||||
$attribute_value = NULL;
|
||||
}
|
||||
}
|
||||
return $attribute_value;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Array returned: array(array(Vendor-Id1, Vendor type1, Attribute-Specific1), ..., array(Vendor-IdN, Vendor typeN, Attribute-SpecificN)
|
||||
*********************************************************************/
|
||||
function DecodeVendorSpecificContent($vendor_specific_raw_value)
|
||||
{
|
||||
$result = array();
|
||||
$offset_in_raw = 0;
|
||||
$vendor_id = (ord(substr($vendor_specific_raw_value, 0, 1))*256*256*256)+(ord(substr($vendor_specific_raw_value, 1, 1))*256*256)+(ord(substr($vendor_specific_raw_value, 2, 1))*256)+ord(substr($vendor_specific_raw_value, 3, 1));
|
||||
$offset_in_raw += 4;
|
||||
while ($offset_in_raw < strlen($vendor_specific_raw_value))
|
||||
{
|
||||
$vendor_type = (ord(substr($vendor_specific_raw_value, 0+$offset_in_raw, 1)));
|
||||
$vendor_length = (ord(substr($vendor_specific_raw_value, 1+$offset_in_raw, 1)));
|
||||
$attribute_specific = substr($vendor_specific_raw_value, 2+$offset_in_raw, $vendor_length);
|
||||
$result[] = array($vendor_id, $vendor_type, $attribute_specific);
|
||||
$offset_in_raw += ($vendor_length);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function : AccessRequest
|
||||
*
|
||||
* Return TRUE if Access-Request is accepted, FALSE otherwise
|
||||
*/
|
||||
function AccessRequest($username = '', $password = '', $udp_timeout = 0, $state = NULL)
|
||||
{
|
||||
$this->ClearDataReceived();
|
||||
$this->ClearLastError();
|
||||
|
||||
$this->SetPacketCodeToSend(1); // Access-Request
|
||||
|
||||
if (0 < strlen($username))
|
||||
{
|
||||
$this->SetUsername($username);
|
||||
}
|
||||
|
||||
if (0 < strlen($password))
|
||||
{
|
||||
$this->SetPassword($password);
|
||||
}
|
||||
|
||||
if ($state!==NULL)
|
||||
{
|
||||
$this->SetAttribute(24, $state);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->SetAttribute(6, 1); // 1=Login
|
||||
}
|
||||
|
||||
if (intval($udp_timeout) > 0)
|
||||
{
|
||||
$this->SetUdpTimeout($udp_timeout);
|
||||
}
|
||||
|
||||
$attributes_content = '';
|
||||
for ($attributes_loop = 0; $attributes_loop < count($this->_attributes_to_send); $attributes_loop++)
|
||||
{
|
||||
$attributes_content .= $this->_attributes_to_send[$attributes_loop];
|
||||
}
|
||||
|
||||
$packet_length = 4; // Radius packet code + Identifier + Length high + Length low
|
||||
$packet_length += strlen($this->_request_authenticator); // Request-Authenticator
|
||||
$packet_length += strlen($attributes_content); // Attributes
|
||||
|
||||
$packet_data = chr($this->_radius_packet_to_send);
|
||||
$packet_data .= chr($this->GetNextIdentifier());
|
||||
$packet_data .= chr(intval($packet_length/256));
|
||||
$packet_data .= chr(intval($packet_length%256));
|
||||
$packet_data .= $this->_request_authenticator;
|
||||
$packet_data .= $attributes_content;
|
||||
|
||||
$_socket_to_server = socket_create(AF_INET, SOCK_DGRAM, 17); // UDP packet = 17
|
||||
|
||||
if ($_socket_to_server === FALSE)
|
||||
{
|
||||
$this->_last_error_code = socket_last_error();
|
||||
$this->_last_error_message = socket_strerror($this->_last_error_code);
|
||||
}
|
||||
elseif (FALSE === socket_connect($_socket_to_server, $this->_ip_radius_server, $this->_authentication_port))
|
||||
{
|
||||
$this->_last_error_code = socket_last_error();
|
||||
$this->_last_error_message = socket_strerror($this->_last_error_code);
|
||||
}
|
||||
elseif (FALSE === socket_write($_socket_to_server, $packet_data, $packet_length))
|
||||
{
|
||||
$this->_last_error_code = socket_last_error();
|
||||
$this->_last_error_message = socket_strerror($this->_last_error_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DebugInfo('<b>Packet type '.$this->_radius_packet_to_send.' ('.$this->GetRadiusPacketInfo($this->_radius_packet_to_send).')'.' sent</b>');
|
||||
if ($this->_debug_mode)
|
||||
{
|
||||
$readable_attributes = '';
|
||||
foreach($this->_attributes_to_send as $one_attribute_to_send)
|
||||
{
|
||||
$attribute_info = $this->GetAttributesInfo(ord(substr($one_attribute_to_send,0,1)));
|
||||
$this->DebugInfo('Attribute '.ord(substr($one_attribute_to_send,0,1)).' ('.$attribute_info[0].'), length '.(ord(substr($one_attribute_to_send,1,1))-2).', format '.$attribute_info[1].', value <em>'.$this->DecodeAttribute(substr($one_attribute_to_send,2), ord(substr($one_attribute_to_send,0,1))).'</em>');
|
||||
}
|
||||
}
|
||||
$read_socket_array = array($_socket_to_server);
|
||||
$write_socket_array = NULL;
|
||||
$except_socket_array = NULL;
|
||||
|
||||
$received_packet = chr(0);
|
||||
|
||||
if (!(FALSE === socket_select($read_socket_array, $write_socket_array, $except_socket_array, $this->_udp_timeout)))
|
||||
{
|
||||
if (in_array($_socket_to_server, $read_socket_array))
|
||||
{
|
||||
if (FALSE === ($received_packet = @socket_read($_socket_to_server, 1024))) // @ used, than no error is displayed if the connection is closed by the remote host
|
||||
{
|
||||
$received_packet = chr(0);
|
||||
$this->_last_error_code = socket_last_error();
|
||||
$this->_last_error_message = socket_strerror($this->_last_error_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
socket_close($_socket_to_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
socket_close($_socket_to_server);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_radius_packet_received = intval(ord(substr($received_packet, 0, 1)));
|
||||
|
||||
$this->DebugInfo('<b>Packet type '.$this->_radius_packet_received.' ('.$this->GetRadiusPacketInfo($this->_radius_packet_received).')'.' received</b>');
|
||||
|
||||
if ($this->_radius_packet_received > 0)
|
||||
{
|
||||
$this->_identifier_received = intval(ord(substr($received_packet, 1, 1)));
|
||||
$packet_length = (intval(ord(substr($received_packet, 2, 1))) * 256) + (intval(ord(substr($received_packet, 3, 1))));
|
||||
$this->_response_authenticator = substr($received_packet, 4, 16);
|
||||
$attributes_content = substr($received_packet, 20, ($packet_length - 4 - 16));
|
||||
while (strlen($attributes_content) > 2)
|
||||
{
|
||||
$attribute_type = intval(ord(substr($attributes_content,0,1)));
|
||||
$attribute_length = intval(ord(substr($attributes_content,1,1)));
|
||||
$attribute_raw_value = substr($attributes_content,2,$attribute_length-2);
|
||||
$attributes_content = substr($attributes_content, $attribute_length);
|
||||
|
||||
$attribute_value = $this->DecodeAttribute($attribute_raw_value, $attribute_type);
|
||||
|
||||
$attribute_info = $this->GetAttributesInfo($attribute_type);
|
||||
if (26 == $attribute_type)
|
||||
{
|
||||
$vendor_array = $this->DecodeVendorSpecificContent($attribute_value);
|
||||
foreach($vendor_array as $vendor_one)
|
||||
{
|
||||
$this->DebugInfo('Attribute '.$attribute_type.' ('.$attribute_info[0].'), length '.($attribute_length-2).', format '.$attribute_info[1].', Vendor-Id: '.$vendor_one[0].", Vendor-type: ".$vendor_one[1].", Attribute-specific: ".$vendor_one[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DebugInfo('Attribute '.$attribute_type.' ('.$attribute_info[0].'), length '.($attribute_length-2).', format '.$attribute_info[1].', value <em>'.$attribute_value.'</em>');
|
||||
}
|
||||
|
||||
$this->_attributes_received[] = array($attribute_type, $attribute_value);
|
||||
}
|
||||
}
|
||||
|
||||
return (2 == ($this->_radius_packet_received));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
+1226
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,626 @@
|
||||
NETWORK-SERVICES-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
OBJECT-TYPE, Counter32, Gauge32, MODULE-IDENTITY, mib-2
|
||||
FROM SNMPv2-SMI
|
||||
TimeStamp, TEXTUAL-CONVENTION
|
||||
FROM SNMPv2-TC
|
||||
MODULE-COMPLIANCE, OBJECT-GROUP
|
||||
FROM SNMPv2-CONF
|
||||
SnmpAdminString
|
||||
FROM SNMP-FRAMEWORK-MIB;
|
||||
|
||||
application MODULE-IDENTITY
|
||||
LAST-UPDATED "200003030000Z"
|
||||
ORGANIZATION "IETF Mail and Directory Management Working Group"
|
||||
|
||||
CONTACT-INFO
|
||||
" Ned Freed
|
||||
|
||||
Postal: Innosoft International, Inc.
|
||||
1050 Lakes Drive
|
||||
West Covina, CA 91790
|
||||
US
|
||||
|
||||
Tel: +1 626 919 3600
|
||||
Fax: +1 626 919 3614
|
||||
|
||||
E-Mail: [email protected]"
|
||||
DESCRIPTION
|
||||
"The MIB module describing network service applications"
|
||||
REVISION "200003030000Z"
|
||||
DESCRIPTION
|
||||
"This revision, published in RFC 2788, changes a number of
|
||||
DisplayStrings to SnmpAdminStrings. Note that this change
|
||||
is not strictly supported by SMIv2. However, the alternative
|
||||
of deprecating the old objects and defining new objects
|
||||
would have a more adverse impact on backward compatibility
|
||||
and interoperability, given the particular semantics of
|
||||
these objects. The defining reference for distinguished
|
||||
names has also been updated from RFC 1779 to RFC 2253."
|
||||
REVISION "199905120000Z"
|
||||
DESCRIPTION
|
||||
"This revision fixes a few small technical problems found
|
||||
in previous versions, mostly in regards to the conformance
|
||||
groups for different versions of this MIB. No changes have
|
||||
been made to the objects this MIB defines since RFC 2248."
|
||||
REVISION "199708170000Z"
|
||||
DESCRIPTION
|
||||
"This revision, published in RFC 2248, adds the
|
||||
applDescription and applURL objects, adds the quiescing
|
||||
state to the applOperStatus object and renames the MIB
|
||||
from the APPLICATION-MIB to the NETWORK-SERVICE-MIB."
|
||||
REVISION "199311280000Z"
|
||||
DESCRIPTION
|
||||
"The original version of this MIB was published in RFC 1565"
|
||||
::= {mib-2 27}
|
||||
|
||||
-- Textual conventions
|
||||
|
||||
-- DistinguishedName is used to refer to objects in the
|
||||
-- directory.
|
||||
|
||||
DistinguishedName ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "255a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A Distinguished Name represented in accordance with
|
||||
RFC 2253, presented in the UTF-8 charset defined in
|
||||
RFC 2279."
|
||||
SYNTAX OCTET STRING (SIZE (0..255))
|
||||
|
||||
-- Uniform Resource Locators are stored in URLStrings.
|
||||
|
||||
URLString ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "255a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A Uniform Resource Locator represented in accordance
|
||||
with RFCs 1738 and 2368, presented in the NVT ASCII
|
||||
charset defined in RFC 854."
|
||||
SYNTAX OCTET STRING (SIZE (0..255))
|
||||
|
||||
-- The basic applTable contains a list of the application
|
||||
-- entities.
|
||||
|
||||
applTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF ApplEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The table holding objects which apply to all different
|
||||
kinds of applications providing network services.
|
||||
Each network service application capable of being
|
||||
monitored should have a single entry in this table."
|
||||
::= {application 1}
|
||||
|
||||
applEntry OBJECT-TYPE
|
||||
SYNTAX ApplEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An entry associated with a single network service
|
||||
application."
|
||||
INDEX {applIndex}
|
||||
::= {applTable 1}
|
||||
|
||||
ApplEntry ::= SEQUENCE {
|
||||
applIndex
|
||||
INTEGER,
|
||||
applName
|
||||
SnmpAdminString,
|
||||
applDirectoryName
|
||||
|
||||
DistinguishedName,
|
||||
applVersion
|
||||
SnmpAdminString,
|
||||
applUptime
|
||||
TimeStamp,
|
||||
applOperStatus
|
||||
INTEGER,
|
||||
applLastChange
|
||||
TimeStamp,
|
||||
applInboundAssociations
|
||||
Gauge32,
|
||||
applOutboundAssociations
|
||||
Gauge32,
|
||||
applAccumulatedInboundAssociations
|
||||
Counter32,
|
||||
applAccumulatedOutboundAssociations
|
||||
Counter32,
|
||||
applLastInboundActivity
|
||||
TimeStamp,
|
||||
applLastOutboundActivity
|
||||
TimeStamp,
|
||||
applRejectedInboundAssociations
|
||||
Counter32,
|
||||
applFailedOutboundAssociations
|
||||
Counter32,
|
||||
applDescription
|
||||
SnmpAdminString,
|
||||
applURL
|
||||
URLString
|
||||
}
|
||||
|
||||
applIndex OBJECT-TYPE
|
||||
SYNTAX INTEGER (1..2147483647)
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An index to uniquely identify the network service
|
||||
application. This attribute is the index used for
|
||||
lexicographic ordering of the table."
|
||||
::= {applEntry 1}
|
||||
|
||||
applName OBJECT-TYPE
|
||||
SYNTAX SnmpAdminString
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The name the network service application chooses to be
|
||||
known by."
|
||||
::= {applEntry 2}
|
||||
|
||||
applDirectoryName OBJECT-TYPE
|
||||
SYNTAX DistinguishedName
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The Distinguished Name of the directory entry where
|
||||
static information about this application is stored.
|
||||
An empty string indicates that no information about
|
||||
the application is available in the directory."
|
||||
::= {applEntry 3}
|
||||
|
||||
applVersion OBJECT-TYPE
|
||||
SYNTAX SnmpAdminString
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The version of network service application software.
|
||||
This field is usually defined by the vendor of the
|
||||
network service application software."
|
||||
::= {applEntry 4}
|
||||
applUptime OBJECT-TYPE
|
||||
SYNTAX TimeStamp
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of sysUpTime at the time the network service
|
||||
application was last initialized. If the application was
|
||||
last initialized prior to the last initialization of the
|
||||
network management subsystem, then this object contains
|
||||
a zero value."
|
||||
::= {applEntry 5}
|
||||
|
||||
applOperStatus OBJECT-TYPE
|
||||
SYNTAX INTEGER {
|
||||
up(1),
|
||||
down(2),
|
||||
halted(3),
|
||||
congested(4),
|
||||
restarting(5),
|
||||
quiescing(6)
|
||||
}
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Indicates the operational status of the network service
|
||||
application. 'down' indicates that the network service is
|
||||
|
||||
not available. 'up' indicates that the network service
|
||||
is operational and available. 'halted' indicates that the
|
||||
service is operational but not available. 'congested'
|
||||
indicates that the service is operational but no additional
|
||||
inbound associations can be accommodated. 'restarting'
|
||||
indicates that the service is currently unavailable but is
|
||||
in the process of restarting and will be available soon.
|
||||
'quiescing' indicates that service is currently operational
|
||||
but is in the process of shutting down. Additional inbound
|
||||
associations may be rejected by applications in the
|
||||
'quiescing' state."
|
||||
::= {applEntry 6}
|
||||
|
||||
applLastChange OBJECT-TYPE
|
||||
SYNTAX TimeStamp
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of sysUpTime at the time the network service
|
||||
application entered its current operational state. If
|
||||
the current state was entered prior to the last
|
||||
initialization of the local network management subsystem,
|
||||
then this object contains a zero value."
|
||||
::= {applEntry 7}
|
||||
|
||||
applInboundAssociations OBJECT-TYPE
|
||||
SYNTAX Gauge32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The number of current associations to the network service
|
||||
application, where it is the responder. An inbound
|
||||
association occurs when another application successfully
|
||||
connects to this one."
|
||||
::= {applEntry 8}
|
||||
|
||||
applOutboundAssociations OBJECT-TYPE
|
||||
SYNTAX Gauge32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The number of current associations to the network service
|
||||
application, where it is the initiator. An outbound
|
||||
association occurs when this application successfully
|
||||
connects to another one."
|
||||
::= {applEntry 9}
|
||||
|
||||
applAccumulatedInboundAssociations OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The total number of associations to the application entity
|
||||
since application initialization, where it was the responder."
|
||||
::= {applEntry 10}
|
||||
|
||||
applAccumulatedOutboundAssociations OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The total number of associations to the application entity
|
||||
since application initialization, where it was the initiator."
|
||||
::= {applEntry 11}
|
||||
|
||||
applLastInboundActivity OBJECT-TYPE
|
||||
SYNTAX TimeStamp
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of sysUpTime at the time this application last
|
||||
had an inbound association. If the last association
|
||||
occurred prior to the last initialization of the network
|
||||
subsystem, then this object contains a zero value."
|
||||
::= {applEntry 12}
|
||||
|
||||
applLastOutboundActivity OBJECT-TYPE
|
||||
SYNTAX TimeStamp
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of sysUpTime at the time this application last
|
||||
had an outbound association. If the last association
|
||||
occurred prior to the last initialization of the network
|
||||
subsystem, then this object contains a zero value."
|
||||
::= {applEntry 13}
|
||||
|
||||
applRejectedInboundAssociations OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The total number of inbound associations the application
|
||||
entity has rejected, since application initialization.
|
||||
Rejected associations are not counted in the accumulated
|
||||
association totals. Note that this only counts
|
||||
|
||||
associations the application entity has rejected itself;
|
||||
it does not count rejections that occur at lower layers
|
||||
of the network. Thus, this counter may not reflect the
|
||||
true number of failed inbound associations."
|
||||
::= {applEntry 14}
|
||||
|
||||
applFailedOutboundAssociations OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The total number associations where the application entity
|
||||
is initiator and association establishment has failed,
|
||||
since application initialization. Failed associations are
|
||||
not counted in the accumulated association totals."
|
||||
::= {applEntry 15}
|
||||
|
||||
applDescription OBJECT-TYPE
|
||||
SYNTAX SnmpAdminString
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A text description of the application. This information
|
||||
is intended to identify and briefly describe the
|
||||
application in a status display."
|
||||
::= {applEntry 16}
|
||||
|
||||
applURL OBJECT-TYPE
|
||||
SYNTAX URLString
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A URL pointing to a description of the application.
|
||||
This information is intended to identify and describe
|
||||
the application in a status display."
|
||||
::= {applEntry 17}
|
||||
|
||||
-- The assocTable augments the information in the applTable
|
||||
-- with information about associations. Note that two levels
|
||||
-- of compliance are specified below, depending on whether
|
||||
-- association monitoring is mandated.
|
||||
|
||||
assocTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF AssocEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The table holding a set of all active application
|
||||
|
||||
associations."
|
||||
::= {application 2}
|
||||
|
||||
assocEntry OBJECT-TYPE
|
||||
SYNTAX AssocEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An entry associated with an association for a network
|
||||
service application."
|
||||
INDEX {applIndex, assocIndex}
|
||||
::= {assocTable 1}
|
||||
|
||||
AssocEntry ::= SEQUENCE {
|
||||
assocIndex
|
||||
INTEGER,
|
||||
assocRemoteApplication
|
||||
SnmpAdminString,
|
||||
assocApplicationProtocol
|
||||
OBJECT IDENTIFIER,
|
||||
assocApplicationType
|
||||
INTEGER,
|
||||
assocDuration
|
||||
TimeStamp
|
||||
}
|
||||
|
||||
assocIndex OBJECT-TYPE
|
||||
SYNTAX INTEGER (1..2147483647)
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An index to uniquely identify each association for a network
|
||||
service application. This attribute is the index that is
|
||||
used for lexicographic ordering of the table. Note that the
|
||||
table is also indexed by the applIndex."
|
||||
::= {assocEntry 1}
|
||||
|
||||
assocRemoteApplication OBJECT-TYPE
|
||||
SYNTAX SnmpAdminString
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The name of the system running remote network service
|
||||
application. For an IP-based application this should be
|
||||
either a domain name or IP address. For an OSI application
|
||||
it should be the string encoded distinguished name of the
|
||||
managed object. For X.400(1984) MTAs which do not have a
|
||||
Distinguished Name, the RFC 2156 syntax 'mta in
|
||||
|
||||
globalid' used in X400-Received: fields can be used. Note,
|
||||
however, that not all connections an MTA makes are
|
||||
necessarily to another MTA."
|
||||
::= {assocEntry 2}
|
||||
|
||||
assocApplicationProtocol OBJECT-TYPE
|
||||
SYNTAX OBJECT IDENTIFIER
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An identification of the protocol being used for the
|
||||
application. For an OSI Application, this will be the
|
||||
Application Context. For Internet applications, OID
|
||||
values of the form {applTCPProtoID port} or {applUDPProtoID
|
||||
port} are used for TCP-based and UDP-based protocols,
|
||||
respectively. In either case 'port' corresponds to the
|
||||
primary port number being used by the protocol. The
|
||||
usual IANA procedures may be used to register ports for
|
||||
new protocols."
|
||||
::= {assocEntry 3}
|
||||
|
||||
assocApplicationType OBJECT-TYPE
|
||||
SYNTAX INTEGER {
|
||||
uainitiator(1),
|
||||
uaresponder(2),
|
||||
peerinitiator(3),
|
||||
peerresponder(4)}
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This indicates whether the remote application is some type of
|
||||
client making use of this network service (e.g., a Mail User
|
||||
Agent) or a server acting as a peer. Also indicated is whether
|
||||
the remote end initiated an incoming connection to the network
|
||||
service or responded to an outgoing connection made by the
|
||||
local application. MTAs and messaging gateways are
|
||||
considered to be peers for the purposes of this variable."
|
||||
::= {assocEntry 4}
|
||||
|
||||
assocDuration OBJECT-TYPE
|
||||
SYNTAX TimeStamp
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of sysUpTime at the time this association was
|
||||
started. If this association started prior to the last
|
||||
initialization of the network subsystem, then this
|
||||
object contains a zero value."
|
||||
::= {assocEntry 5}
|
||||
|
||||
-- Conformance information
|
||||
|
||||
applConformance OBJECT IDENTIFIER ::= {application 3}
|
||||
|
||||
applGroups OBJECT IDENTIFIER ::= {applConformance 1}
|
||||
applCompliances OBJECT IDENTIFIER ::= {applConformance 2}
|
||||
|
||||
-- Compliance statements
|
||||
|
||||
applCompliance MODULE-COMPLIANCE
|
||||
STATUS obsolete
|
||||
DESCRIPTION
|
||||
"The compliance statement for RFC 1565 implementations
|
||||
which support the Network Services Monitoring MIB
|
||||
for basic monitoring of network service applications.
|
||||
This is the basic compliance statement for RFC 1565."
|
||||
MODULE
|
||||
MANDATORY-GROUPS {applRFC1565Group}
|
||||
::= {applCompliances 1}
|
||||
|
||||
assocCompliance MODULE-COMPLIANCE
|
||||
STATUS obsolete
|
||||
DESCRIPTION
|
||||
"The compliance statement for RFC 1565 implementations
|
||||
which support the Network Services Monitoring MIB
|
||||
for basic monitoring of network service applications
|
||||
and their associations."
|
||||
MODULE
|
||||
MANDATORY-GROUPS {applRFC1565Group, assocRFC1565Group}
|
||||
::= {applCompliances 2}
|
||||
|
||||
applRFC2248Compliance MODULE-COMPLIANCE
|
||||
STATUS deprecated
|
||||
DESCRIPTION
|
||||
"The compliance statement for RFC 2248 implementations
|
||||
which support the Network Services Monitoring MIB
|
||||
for basic monitoring of network service applications."
|
||||
MODULE
|
||||
MANDATORY-GROUPS {applRFC2248Group}
|
||||
::= {applCompliances 3}
|
||||
|
||||
assocRFC2248Compliance MODULE-COMPLIANCE
|
||||
STATUS deprecated
|
||||
DESCRIPTION
|
||||
"The compliance statement for RFC 2248 implementations
|
||||
|
||||
which support the Network Services Monitoring MIB for
|
||||
basic monitoring of network service applications and
|
||||
their associations."
|
||||
MODULE
|
||||
MANDATORY-GROUPS {applRFC2248Group, assocRFC2248Group}
|
||||
::= {applCompliances 4}
|
||||
|
||||
applRFC2788Compliance MODULE-COMPLIANCE
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The compliance statement for RFC 2788 implementations
|
||||
which support the Network Services Monitoring MIB
|
||||
for basic monitoring of network service applications."
|
||||
MODULE
|
||||
MANDATORY-GROUPS {applRFC2788Group}
|
||||
::= {applCompliances 5}
|
||||
|
||||
assocRFC2788Compliance MODULE-COMPLIANCE
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The compliance statement for RFC 2788 implementations
|
||||
which support the Network Services Monitoring MIB for
|
||||
basic monitoring of network service applications and
|
||||
their associations."
|
||||
MODULE
|
||||
MANDATORY-GROUPS {applRFC2788Group, assocRFC2788Group}
|
||||
::= {applCompliances 6}
|
||||
|
||||
-- Units of conformance
|
||||
|
||||
applRFC1565Group OBJECT-GROUP
|
||||
OBJECTS {
|
||||
applName, applVersion, applUptime, applOperStatus,
|
||||
applLastChange, applInboundAssociations,
|
||||
applOutboundAssociations, applAccumulatedInboundAssociations,
|
||||
applAccumulatedOutboundAssociations, applLastInboundActivity,
|
||||
applLastOutboundActivity, applRejectedInboundAssociations,
|
||||
applFailedOutboundAssociations}
|
||||
STATUS obsolete
|
||||
DESCRIPTION
|
||||
"A collection of objects providing basic monitoring of
|
||||
network service applications. This is the original set
|
||||
of such objects defined in RFC 1565."
|
||||
::= {applGroups 7}
|
||||
|
||||
assocRFC1565Group OBJECT-GROUP
|
||||
OBJECTS {
|
||||
|
||||
assocRemoteApplication, assocApplicationProtocol,
|
||||
assocApplicationType, assocDuration}
|
||||
STATUS obsolete
|
||||
DESCRIPTION
|
||||
"A collection of objects providing basic monitoring of
|
||||
network service applications' associations. This is the
|
||||
original set of such objects defined in RFC 1565."
|
||||
::= {applGroups 2}
|
||||
|
||||
applRFC2248Group OBJECT-GROUP
|
||||
OBJECTS {
|
||||
applName, applVersion, applUptime, applOperStatus,
|
||||
applLastChange, applInboundAssociations,
|
||||
applOutboundAssociations, applAccumulatedInboundAssociations,
|
||||
applAccumulatedOutboundAssociations, applLastInboundActivity,
|
||||
applLastOutboundActivity, applRejectedInboundAssociations,
|
||||
applFailedOutboundAssociations, applDescription, applURL}
|
||||
STATUS deprecated
|
||||
DESCRIPTION
|
||||
"A collection of objects providing basic monitoring of
|
||||
network service applications. This group was originally
|
||||
defined in RFC 2248; note that applDirectoryName is
|
||||
missing."
|
||||
::= {applGroups 3}
|
||||
|
||||
assocRFC2248Group OBJECT-GROUP
|
||||
OBJECTS {
|
||||
assocRemoteApplication, assocApplicationProtocol,
|
||||
assocApplicationType, assocDuration}
|
||||
STATUS deprecated
|
||||
DESCRIPTION
|
||||
"A collection of objects providing basic monitoring of
|
||||
network service applications' associations. This group
|
||||
was originally defined by RFC 2248."
|
||||
::= {applGroups 4}
|
||||
|
||||
applRFC2788Group OBJECT-GROUP
|
||||
OBJECTS {
|
||||
applName, applDirectoryName, applVersion, applUptime,
|
||||
applOperStatus, applLastChange, applInboundAssociations,
|
||||
applOutboundAssociations, applAccumulatedInboundAssociations,
|
||||
applAccumulatedOutboundAssociations, applLastInboundActivity,
|
||||
applLastOutboundActivity, applRejectedInboundAssociations,
|
||||
applFailedOutboundAssociations, applDescription, applURL}
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A collection of objects providing basic monitoring of
|
||||
network service applications. This is the appropriate
|
||||
|
||||
group for RFC 2788 -- it adds the applDirectoryName object
|
||||
missing in RFC 2248."
|
||||
::= {applGroups 5}
|
||||
|
||||
assocRFC2788Group OBJECT-GROUP
|
||||
OBJECTS {
|
||||
assocRemoteApplication, assocApplicationProtocol,
|
||||
assocApplicationType, assocDuration}
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A collection of objects providing basic monitoring of
|
||||
network service applications' associations. This is
|
||||
the appropriate group for RFC 2788."
|
||||
::= {applGroups 6}
|
||||
|
||||
-- OIDs of the form {applTCPProtoID port} are intended to be used
|
||||
-- for TCP-based protocols that don't have OIDs assigned by other
|
||||
-- means. {applUDPProtoID port} serves the same purpose for
|
||||
-- UDP-based protocols. In either case 'port' corresponds to
|
||||
-- the primary port number being used by the protocol. For example,
|
||||
-- assuming no other OID is assigned for SMTP, an OID of
|
||||
-- {applTCPProtoID 25} could be used, since SMTP is a TCP-based
|
||||
-- protocol that uses port 25 as its primary port.
|
||||
|
||||
applTCPProtoID OBJECT IDENTIFIER ::= {application 4}
|
||||
applUDPProtoID OBJECT IDENTIFIER ::= {application 5}
|
||||
|
||||
END
|
||||
@@ -0,0 +1 @@
|
||||
INSERT INTO widgets VALUES (NULL, 'External Images', 'generic-image', '5,4');
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE `users` ADD `dashboard` INT( 11 ) DEFAULT 0 NOT NULL;
|
||||
Reference in New Issue
Block a user