* Refactor tests
Boot Laravel for all tests.
Config use private static property for storage instead of global
* Backup/restore modules
* disable snmpsim log
* Fixing DBTestCase
* Fix macros loading to the wrong place
* trap and other tests should check if db is available
* don't include snmp.inc.php if mock.snmp.inc.php is already included...
* fix migration
* if we don't reset the db, run migrations at least.
* set vars for migrate too
* Fix style
* ignore issues with undefined indexes in legacy code
* Changed snmptrap.php and handlers to allow for alerts.
* Moved RunRules() to Dispatcher.php
* Modified includes, passes pre-commit tests locally.
* Converted RunRules to OO, fixed formatting in files found by TravisCI
* rebase, covert alert subsy to oop
* Modified init.php to call new Alert subsystem
* fixed dependencies
* Resolved undefined functions
* Fixed PingCheck.php not triggering
* Changed runAlerts to __construct
* Fixes
Can't have Config inside empty()
incorrectly named function (my fault)
poller.php missing shebang
organize imports
* Device Groups rewrite
Updated web ui
Static or dynamic groups allowed
Alert rule query builder
Translation support
Permissions support
* cleanup, make relationship save, and validate it
* builder WIP
* rules builder and rules saving/loading
* Parse query builder to Laravel Fluent query
* Upgrade existing groups when editing.
Properly update only dynamic groups when polling.
* remove unused old code
Update API and other places to use Eloquent
* debug output in poller restored
* Fix up some things
creating static
improved validation
fix js error on creation
Fix static groups in polling
* hide pattern for static group
* Implement authorization
Use in the menu too
* update schema
* fix rollback
* Don't abort on invalid queries
* fixes to query builder
* add test data, looks like macros aren't handled (omitted them because groups don't use them generally)
* Add macro support for QueryBuilderFluentParser
* add test for macro that accepts value
* More space in forms
Retain rules when converted to static
no duplicate names allowed
* Better error feedback
Update related devices on save
* Add button icon
* format
* update docs
* fix tests
* Fix some QueryBuilderFluentParser issues with OR
updated/more test data
* Show device groups runtime
fix querybuilder.json format
* Store table joins in the rules to minimize polling time
Update group joins in daily.sh (and when they are saved)
* Update daily.php
* Add units to time
* Device Groups rewrite
Updated web ui
Static or dynamic groups allowed
Alert rule query builder
Translation support
Permissions support
* cleanup, make relationship save, and validate it
* builder WIP
* rules builder and rules saving/loading
* Parse query builder to Laravel Fluent query
* Upgrade existing groups when editing.
Properly update only dynamic groups when polling.
* remove unused old code
Update API and other places to use Eloquent
* debug output in poller restored
* Fix up some things
creating static
improved validation
fix js error on creation
Fix static groups in polling
* hide pattern for static group
* Implement authorization
Use in the menu too
* update schema
* fix rollback
* Don't abort on invalid queries
* fixes to query builder
* add test data, looks like macros aren't handled (omitted them because groups don't use them generally)
* Add macro support for QueryBuilderFluentParser
* add test for macro that accepts value
* More space in forms
Retain rules when converted to static
no duplicate names allowed
* Better error feedback
Update related devices on save
* Add button icon
* format
* update docs
* fix tests
* Remove legacy index php file
* fix routing page missing data
* WIP
* fix $navbar global usage
* remove global use of $locations
* ObjectCache again...
* move vars.inc.php to init.php for legacy ajax
* navbar is more local than I thought before. Fix it.
* Fix some sensors tables escaping
* restore custom menu functionality, but with blade
and docs
* cleanup
* tidy menu @if checks
* Fix up the rest of the global variables and remove print-menubar.php
* consolidate some counting in the menu
* filter out empty custom port descr types
* Fix up custom port groups
* Fix up apps menu
* Fix services menu when all are ok
* Limit cached data to the user it is for
* Fix style
* A few clean ups
* fix pseudowire bug
* Security fix: unauthorized access
Affects nginx users:
Moved php files outside of public html directory (Apache was protected by .htaccess)
Affects all users:
Some files did not check for authentication and could disclose some info.
Better checks before including files from user input
* git mv html/includes/ includes/html
git mv html/pages/ includes/html/
* Always boot Laravel
That way we can depend on it being available.
Saves us crashes if some code accidentally uses something that isn't booted and a lot of silly if/elses.
* ignore init php errors
* Keeps the dashboard sessions from expiring.
Route dashboard ajax calls through Laravel.
Boots minimal cookies and sessions.
Does not fix other pages for now, real fix is to fully port.
* Check Laravel auth for the legacy calls.
Display Laravel errors in the dashboard.
legacy auth checks are mostly extraneous now.
* Use Laravel for authentication
Support legacy auth methods
Always create DB entry for users (segregate by auth method)
Port api auth to Laravel
restrict poller errors to devices the user has access to
Run checks on every page load. But set a 5 minute (configurable) timer.
Only run some checks if the user is an admin
Move toastr down a few pixels so it isn't as annoying.
Fix menu not loaded on laravel pages when twofactor is enabled for the system, but disabled for the user.
Add two missing menu entries in the laravel menu
Rewrite 2FA code
Simplify some and verify code before applying
Get http-auth working
Handle legacy $_SESSION differently. Allows Auth::once(), etc to work.
* Fix tests and mysqli extension check
* remove duplicate Toastr messages
* Fix new items
* Rename 266.sql to 267.sql
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
Gut dbFacile
mres() now does nothing... could have some vulnerable queries, but most are ok
TODO
- [x] IRC client broke
- [x] Install broke
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
* Initial start on new templating support
* further updates
* more updates
* More working version
* Last fixes
* Small updates
* modified test to look for dbname.
* Schema update
* Added fix for not being able to disable Philips Hue transport
* Updated sql file
* Updated db_schema
* Set myclabs/deep-copy to be 1.7.x version in composer
* Fixes from murrant
* Forced nikic/php-parser to version 3.1.x in composer
* Updated composer to use custom fork of string-blade-compiler + fixed transport use
* Updated to always use correct template
* Merged legacy and blade templating engines
* Removed template type + fixed test-alert.php
* Added more template placeholders
* Added ability to reference data in templates as $alert->X
* Updated docs for templates
* Updated db_schema.yaml
* Added $alert->builder
* Clarify the use of $alert->builder
* Fixed the use of $alert->transport
* renamed schema file
* Added template validation
* Small update to fix travis issue
* Add Docs text to title bar
* Updated amqp to new of version
* Consistency in alert rule and template title bars
Use Log facility when Laravel is booted.
Update init.php so we can easily boot Laravel for CLI scripts. (and just Eloquent, but that may go away)
Move all debug setup into set_debug() function and use that across all scripts.
Log Laravel database queries.
Send debug output to librenms log file when enabling debug in the webui.
Allow for colorized Log CLI output. (currently will leave % tags in log file output)
** Needs testing and perhaps tweaking still.
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
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
* Add Laravel to LibreNMS.
* Try to set permissions during initial install and first composer update to Laravel.
* Fix composer.lock
Fix missing db config keys
* Start building v1 layout
Port ajax_setresolution, inject csrf into jquery ajax calls
Layout works, building menu
Partially done.
* Fix device group list
remove stupid count relationships
* Print messages for common boot errors.
Don't log to laravel.log file.
Log to error_log until booted, then librenms.log
* Fix up some issues with Config loading
Start of custom directives
* Custom blade directives: config, notconfig, admin
* Preflight checks
Only load config files once.
* Update the composer.lock for php 5.6
* Menu through routing
* Start of alert menu
* Better alert scopes
* reduce cruft in models
* Alerting menu more or less working :D
* Fix style
* Improved preflight
* Fix chicken-eggs!
* Remove examples
* Better alert_rule status queries
Debugbar
* fix app.env check
* User Menu
* Settings bar (dropped refresh)
Search JS
* Toastr messages
* Rename preflight
* Use hasAccess(User) on most models.
Add port counts
* Missed a Preflight -> Checks rename
* Fix some formatting
* Boot Eloquent outside of Laravel
Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel.
Move locate_binary() into Config class
* Config WIP
* Try to fix a lot of config loading issues.
* Improve menu for non-admins removing unneeded menus
url() for all in menu
* Only use eloquent if it exists
* Include APP_URL in initial .env settings
* Implement Legacy User Provider
* Helper class for using Eloquent outside of Laravel.
Allows access to DB style queries too and checking the connection status.
* Fix up tests
* Fix device groups query
* Checking Travis
* copy config.test.php earlier
* dbFacile check config before connecting
Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler.
Ignore missing config.php error.
* Fix config load with database is not migrated yet.
* Remove Config::load() from early boot.
* Use laravel config settings to init db (this prefers .env settings)
Fix bgp vars not set in menu
add _ide_helper.php to .gitignore
* Restrict dependencies to versions that support php 5.6
* Update ConfigTest
* Fix a couple of installation issues
* Add unique NODE_ID to .env
* Correct handling of title image
* Fix database config not loading. Thanks @laf
* Don't prepend /
* add class_exists checks for development service providers
* Fix config value casting
* Don't use functions that may not exist
* Update dbFacile.php
* d_echo may not be defined when Config used called.
* Add SELinux configuration steps
More detailed permissions check.
Check all and give complete corrective commands in one step.
* Ignore node_modules directory
* Re-add accidetal removal
* Refactor database and config init
Connect to the database without loading full config
Load config completely so post-processing is always done consistently.
Erase existing $config when loading, fixes issues in case we load the config twice.
If the database is not connected, don't try to load database settings. (Fixes some db errors on install)
Attempt to remove $config access/modification before init.php
Remove usage of db_name, that might not match the connected database.
Centralize db config loading, so we consistently apply db_test database settings.
Many of these changes are influenced by Laravel port.
* Some safety so we don't assign strings to numeric port field
Smooth out phpunit bootstrap
* Fix a couple of scrutinizer warnings.
* Show composer status in web validate.
Don't duplicate in validate.php
* Create variable to check if a group has been completed.
No longer skips database checks.
Extract a base class.
Fix locate_binary and find_executable issues (mostly exposed by lack of db)
* Update Validator.php
* Restore vendor contents even if composer is not available
Leave the code in both places for safety.
* Instruct users to use the wrapper instead of straight up composer...
* Prep for composer changes
* Update composer.json, composer.lock and a small update to phpmailer and Yaml
* Prevent accidental `composer update` runs
* Add --no-interaction to daily.sh
* refactor: AD Auth defer connection until it is needed
Nice error if php-ldap is missing instead of http 500.
* Add the same error when ldap is missing to other auth methods.
Not as graceful looking in the authorizers since they do not defer connection.
* Refactored authorizers to classes
* Merge changes for #7335
* ! fix php 5.3 incompatibility
* Update ADAuthorizationAuthorizer.php
* Fix get_user -> getUser
* Rename AuthorizerFactory to Auth, fix interface missing functions
* Add phpdocs to all interface methods and normalize the names a bit.
* Re-work auth_test.php AD bind tests to work properly with the new class.
Reflection is not the nicest tool, but I think it is appropriate here.
Handle exceptions more nicely in auth_test.php
* Restore AD getUseList fix
Not sure how it got removed
* fix auth_test.php style
* fix: devices detected as ibmtl
Guess at the sysObjectID, please report if you have devices that should be ibmtl and are no longer detected.
Add output of os in discovery.
* Always load all os for discovery. Should be cached most of the time.
This PR fixes the following error that showed up after upgrading to 1.31.
```
Array ( [0] => 1 [1] => Uncaught Error: Call to undefined function init_auth() in /srv/deployment/librenms/librenms-cache/revs/8c9da11850ecbf2a949b9317d1fce75301bfd13b/includes/init.php:152 Stack trace: #0 /srv/deployment/librenms/librenms-cache/revs/8c9da11850ecbf2a949b9317d1fce75301bfd13b/html/index.php(59): require() #1 {main} thrown [2] => /srv/deployment/librenms/librenms-cache/revs/8c9da11850ecbf2a949b9317d1fce75301bfd13b/includes/init.php [3] => 152 )
```
it's most likeley related to the fact that we use a symlink, and $config['install_dir'] is the symlink, and $install_dir is the real folder.
* 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)
Always output header (may be missing mysql data)
Improve version display, now looks like '1.28-129-g74e6c3edf' <tag>-<commits since tag>-<shortag>
Add mysqli to the list of required extensions, check extensions before init
Add dbIsConnected() function, used to check if we have db in version_info()
Do not die on IPv4 and IPv6 so validate can print errors.
Move git checks so they are output together
fix rrdtool 1.7.0 reports version as 1.7.01.7.0
* 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
* fix: page/graph load speed: part 1
Speed up load_all_os() by caching the full $config['os'] array
Function time goes from 1.13648s -> 0.00073s
The cache is updated during discovery, but only if it is >22hrs old.
Additionally, the cache is not used and a full yaml load is forced if the cache is >24hrs old.
The cache time is controlled by $config['os_def_cache_time'], I don't see any reason anyone would change that time.
* Delete Session.php
* Include the cache directory.
* Update database tests to prepare for more
Add test_db_name, test_db_user, test_db_pass to allow developers to have a dedicated testing database.
Extract DBTestCase to include common functionality for database based tests. Use transactions to isolate tests.
Enable STRICT_TRANS_TABLE, test for it's existence (only when we have a user that can set it)
Move the database cleanup to register_shutdown_function, this makes it happen every time at the end of tests.
If the was not empty, only truncate the tables (that aren't prepopulated) instead of drop the database.
Use our schema functions for schema tests.
Fix some missing array indexes so it doesn't clutter test output.
* Fix style
* 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
* Initial support for graphite
* Enable graphite include
* fixed typos.
* Fixed port naming to graphite metric names
* Added documentation for Graphite
* added documentation for graphite
* fixed style
* replace / with _ in interface names for graphite
* sets default graphite port
* adds rrd-name tags to the metric, otherwise metrics get lost
* add suggested storage schema for graphite
* add whitespace
* Updated to show some output
* bad english