Commit Graph

13 Commits

Author SHA1 Message Date
Tony Murray
607a567090
Don't check file permissions on every request, handle failures (#9264)
* Don't check file permissions on every request, handle failures
Improve error page visually

* only print minimal mkdir

* invert file_exists check, whoops

* docblock

* revert accidental changes

* rename variable

* Change database errors to use the new layout

* Add support url to the default layout

* Replaced \n for && in fix for user perms

* fix web output
2018-10-18 21:08:46 -05:00
VVelox
c3007b483a add json_app_get and convert fail2ban over to JSON (#8571)
* add json_app_get function

* add numeric testing and version support

* now use json_app_get

* remove some unneeded code

* update the docs for json_app_get some more

* make the format checker happy

* add in min version support and now take extend name instead of the partial OID

* hmm... don't make min version optional

* add Exception usage for this all make min version actually work

* minor formatting cleanup

* minor style cleanup

* update json_app_get with $throw_me setting

* Use exceptions to fully handle errors.
Always update the application.  Include error message for use in UI.
Move data to data key for easier parsing.
Add test data

* make a few changes to the lovely changes from @murrant

* style cleanup

* now attempt parsing it the old way if a error of -5 is returned

* add new exceptions and rework them all

* add new exceptions and min version 0 no longer bypasses the key checks

* redo the error codes a bit and improve the comment about it all

* fix a a bit of formatting

* added JsonAppException and make the other JsonApp stuff a sub of it

* note JsonAppException

* fix class creation

* JsonAppBlank now extends JsonApp

* doh! add <?php

* update the poller to properly use the new exceptions

* no longer check for error twice and make sure the data key is present

* cleanup processing of legacy scripts

* tweak this a bit

* white space fix

* fix the tests for fail2ban
2018-05-25 21:16:16 -05:00
Tony Murray
43b54fcf39 refactor: Handle database exceptions properly (#8720)
Display the errors to the user
Hide the query, unless APP_DEBUG=true in .env
Much easier to display output for other exceptions now, just need to add a render() function to them
2018-05-15 21:07:29 +01:00
Tony Murray
b2ce9b173b
save-test-data.php: Print a message when we encounter a bad module name (#8274)
* Print a message when we encounter a bad module name (likely a typo)

* Raise exception for invalid module name and handle it.
2018-02-25 20:03:18 -06:00
Tony Murray
11147d3bbf
Major Processors rewrite (#8066)
* Extract DiscoveryItem and move some things to better places.
Extract model class
Fix up model construction.  I have problem with construction...
Makeshift model working.  Switch constructor to factory.  discover() and create()
Support legacy discovery.
Remove uneeded custom pollers
Remove netonix custom detection as we try ucd on all os now.
Add a few yaml procs.  Fix a couple things.
More processor discovery conversions
Move Calix e7 to standard hrProcessorLoad, but it doesn't fully implement the HR-MIB, move things around to make it work.
Add a few yaml procs.  Fix a couple things. Correct some stupid mib stuff.
Move more, drop php 5.3
Add netscaler which uses string indexes.  Port fiberhome to yaml and use skip_values
More conversions.  BroadcomProcessorUsage Trait
Serveriron and Ironware share some mibs.  Create a common abstract os for them.
Add yaml support for mib specification in each data entry
Make legacy discover_processor() set 0 for hrDeviceIndex

Untangle Dell switch OS processors

Use use shared OS for groups if they don't have a specific group.
fix silly mib mistake

Make index optional

Move HR and UCD to Traits and out of Processor.

* forgot to update the fortiswitch index

* Make sgos and avaya-ers match the old index.

* fix comware test data

* fix merge errors

* fix dsm and remove pointless empty modules

* file not found exception is in the wrong place.

* Updated processor development docs
2018-02-05 07:39:13 -06:00
Tony Murray
2e73b75297 fix: Use memcached to lock daily processes on Distributed Pollers (#7735)
* fix: use memcached to lock daily processes on Distributed Pollers

* All the locks!
2017-11-24 09:37:52 +00:00
Tony Murray
503500f978 feature: AD now supports nested groups (resubmit #7175) (#7259)
* feature: AD support nested groups (resubmit #7175)
Don't let groups with periods in the name cause issues.

* Merge #7245 into this PR

* Capture Exceptions in get_userlevel()

* Throw generic error if auth_ad_debug is not enabled to prevent information leak.
2017-10-04 21:31:17 +01:00
Tony Murray
1d777693e1 feature: New IP parsing classes. Removes usage of Pear Net_IPv4 and Net_IPv6. (#7106)
* Refactor remove use of pear Net_IPv4 and Net_IPv6

Caution, I added tests to test the functionality of the new functions, but I'm not 100% certain the replaced usages match 100%.  Please test.

Left usage in generate-iplist.php because I'm not sure the use of that script, so I didn't want to implement additional functionality to support it.

Add support for ipv6 fo ipInNetwork() function

Add phpdocs to functions
Remove accidental inclusion

Use binary operations instead of string for networKFromIp()
Tidy up binary operations in ipInNetwork()

tidy parsing cidr network

Change to a class based implementation.

Update phpdocs.
Fully catch exceptions for hex parsing.

Fix mistake.

support older phpunit versions

Fix php shifting to negative with php 5

* Fix graph authorization. Uncaught exception and checking an ipv4 against an ipv6 network == fail.

* Also remove colons from hex strings.

* Fix typo in bgp polling
Two passes of removing invalid characters from hex strings. (That way we don't mangle valid IPs)
2017-08-08 14:14:58 -05:00
Tony Murray
683a10e723 fix: Improve authentication load time and security (#6615)
* fix: minimize session open time
page/graphs speedup part 2

Write close the session as soon as we no longer need to write to it. Prevents the session from blocking other requests.
Do not run through full authentication functions if the session is already authenticated.
Removes password from the session as well as some items to prevent session fixation from #4608.

WARNING: This will cause issues for ad/ldap users who do not have a bind user configured!

* Do no erase username when using cookie auth.
Properly close the session in ajax_setresolution.php

* write close the session as soon as possible in ajax_setresolution.php

* Remove session regeneration. It is not compatible with the current code and would require more changes.

* Totally refactor authentication.  Extract code to functions for re-use and improved readability

* Use exceptions for authentication and error logging
Tested: mysql, ad_auth with and without bind user

* fix a couple scrutinizer issues

* fix reauthenticate in radius
2017-05-15 22:18:23 -05:00
Tony Murray
b1a414e785 feature: support non-standard unix socket (#5724)
* Add support for custom MySQL unix-socket

* NULL must be lowercase!

* Naive edit of html/install.php

* fixup

* Refactor dbConnect
Use it everywhere

* $config needs to be global
Don't need to set $database_link

* small cleanups
2017-04-06 22:02:37 +01:00
Neil Lathwood
fad5aca1b7 feature: Allow customisation of rrd step/heartbeat when creating new rrd files (#5947)
* feature: Allow customisation of rrd step/heartbeat when creating new rrd files

* revert defaults

* added docs + webui config option

* Move RrdDefinition to an Object to make them easier to create and remove the possibility of typos.

* Fix style/lint issues and missing use statements

* 3 more missing use statements

* updated doc + moved schema file
2017-02-23 22:45:50 +00:00
Tony Murray
abc6a5b799 PSR-2 Final cleanup (#4247)
refactor: Final PSR2 cleanup
2016-08-28 23:32:55 +01:00
Tony Murray
b8e9b2d917 Implement an autoloader (#4140)
* Implement an autoloader

When cleaning up classes for psr2, things got a bit unwieldy, so I implemented a class autoloader.
I created a PSR-0 compliant LibreNMS directory and moved all classes there that made sense.
Implemented LibreNMS\ClassLoader which supports adding manual class mappings

This reduces the file includes needed and only loads classes when needed.

* Add teh autoloader to graph.php

* Add a small bit of docs
Fix incomplete class in includes/discovery/functions.inc.php
2016-08-21 14:07:14 +01:00