1
0
mirror of https://github.com/librenms/librenms-agent.git synced 2024-05-09 09:54:52 +00:00

Fix memcached security vulnerability (#428)

Add snmp extend script
This commit is contained in:
Tony Murray
2022-10-16 11:15:25 -05:00
committed by GitHub
parent f9fea2e06c
commit e6fa86dc82
2 changed files with 23 additions and 2 deletions

View File

@@ -7,7 +7,6 @@ $stats = $m->getStats();
if(is_array($stats))
{
echo("<<<app-memcached>>>\n");
echo(serialize($m->getStats()));
echo(json_encode($m->getStats()));
echo("\n");
}
?>

22
snmp/memcached Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/php
<?php
if (! class_exists('Memcached')) {
echo json_encode(array(
'data' => false,
'error' => 99,
'errorString' => 'php-memcached extension is not available, it must be installed and enabled.',
'version' => '1.1'
));
exit;
}
$m = new Memcached();
$m->addServer('localhost', 11211);
echo json_encode(array(
'data' => $m->getStats(),
'error' => $m->getLastErrorCode(),
'errorString' => $m->getLastErrorMessage(),
'version' => '1.1',
));