Commit Graph

124 Commits

Author SHA1 Message Date
Jellyfrog
2b3575a5e9
Laravel 10.x Shift (#14995)
* Apply code style

* Remove explicit call to register policies

* Shift core files

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.

* Bump Laravel dependencies

* Add type hints for Laravel 10

* Shift cleanup

* wip

* wip

* sync translation

* Sync back config

* Public Path Binding

* QueryException

* monolog

* db::raw

* monolog

* db::raw

* fix larastan collections

* fix phpstan bug looping forever

* larastan errors

* larastan: fix column type

* styleci

* initialize array

* fixes

* fixes

---------

Co-authored-by: Shift <shift@laravelshift.com>
2023-05-24 22:21:54 +02:00
Tony Murray
04bb75f5f3
Alert transport cleanup, no_proxy support and other proxy cleanups (#14763)
* Add no_proxy and other proxy related settings
Set user agent on all http client requests
Unify http client usage

* Style fixes

* Remove useless use statements

* Correct variable, good job phpstan

* Add tests
fix https_proxy bug
add tcp:// to the config settings format

* style and lint fixes

* Remove guzzle from the direct dependencies

* Use built in Laravel testing functionality

* update baseline
2023-05-23 09:25:17 -05:00
Jellyfrog
0a351b49fd
Laravel 9.x Shift (#14504)
* Move `resources/lang` folder

* Shift registered middleware

* Remove `fruitcake/laravel-cors` dependency

* Streamline `$commands` property

* Upgrade to Flysystem 3.0

* Shift core files

* Convert `optional()` to nullsafe operator

* Remove unnecessary `$model` property

* Convert route options to fluent methods

Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods.

* Convert deprecated `$dates` property to `$casts`

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.

* Bump Laravel dependencies

* Use `<env>` tags for configuration

`<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI.

Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/

* Fix error provider

* Match new symfony syntax

* Match upstream syntax

* Fix route syntax

* generate composer.lock

* Sync back configs

* routes

* composer

* Fix more flare

* fix cors

* sync lang

* Apply fixes from StyleCI (#14517)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* bump larastan

* update packages

* wip

* Temporarily lower phpstan level

* Update phpstan.neon

* wip

* wip

* wip

* Apply fixes from StyleCI (#14592)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* test

* Update CiHelper.php

* Update test.yml

* Update CiHelper.php

* Update CiHelper.php

* Apply fixes from StyleCI (#14616)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* test?

* fix phpstan problems

* dont run snmpsim on github ci

* Fix whitespace

* More whitespace

* More whitespace ???

* I think the space broke it

* fix the reset of the whitespace

* hard code auth guard

---------

Co-authored-by: Shift <shift@laravelshift.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-04-17 06:51:35 -05:00
Jellyfrog
68e0b3df28
Apply fixes from StyleCI (#14899)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-03-13 22:32:22 +01:00
Josh Silvas
4107b37b9d
Adds Cisco DHCP Server SNMP MIB and Trap Handlers. (#14618)
* Adds API call to update port notes on devices.

* Adds Cisco IETF-DHCP Server MIB and Trap Handlers.

* Updates local permissions changed.

* Linting cleanup.

* Moves test to a single file. Updates the args to match the status.

* Fixes tests failing for Cisco DHCP server SNMP traps.
2022-11-18 00:15:42 -06:00
Jellyfrog
b31b992020
Rework socialite integration (#14367)
* Rework socialite integration

Prevents unnecessary work each boot

* Update SocialiteController.php

* Gen 2
2022-10-07 20:52:55 +02:00
Tony Murray
e4451714e2
version and git helper improvements (#14412)
* Fix up version and git helpers
Improve method names
Move all git calls into the git helper
Allow runtime and external cache of results where appropriate
Consolidate version headers for discovery, poller, and validate

* Style fixes

* improve consistency in git calls

* fix style

* don't send name inconsistently

* Improve database versions

* No need to cache Version it is not used more than once currently.
2022-10-02 00:41:56 -05:00
Tony Murray
5c76890373
Add @signedGraphTag() and @signedGraphUrl() blade directives (#14269)
* More secure external graph access
Add @signedGraphTag() and @signedGraphUrl() blade directives
Takes either an array of graph variables or a url to a graph
Uses a signed url that is accessible without user login, embeds signature in url to authenticate access
See Laravel Signed Url for more details.
Adds Laravel route to graphs (does not change links to use it yet)
@graphImage requires the other PR
Also APP_URL is required in .env

* missing files from rebase

* Fix url parsing with a get string

* allow width and height to be omitted

* Documentation

* Add to, otherwise it will always be now

* Doc note for to and from relative security

* fix vars.inc.php (Laravel has a dummy url here)
2022-09-03 12:48:43 -05:00
Jellyfrog
1dbab5ac7e
Error reporting (#14190)
* Error reporting

* Move code to ErrorReportingProvider
Enable reporting of error (and warning) messages.
report module exceptions

* Restore flare key
Not needed to set late anymore.  We set up filtering before it is initialized.

* Remove unnecessary and maybe double Flare report

* lint

* Cannot use typed properties yet, use phpdoc

* fix handleError return type

* Filter both exceptions and reports (so we don't miss any)
Consolidate the check if reporting should be enabled

* Cache reportingEnabled check for the runtime

* Split out middleware to improve readability
Logging of why reporting is disabled
Fix reportingEnabled cache

* Style

* Return some user data

* Change to class based middleware, it looks nicer

* Fix error page error id report, add url.

* also rewrite intended url

* remove link

* Move ignition to production and update flare-client

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-08-24 00:33:28 +02:00
Nash Kaminski
9bb6b19832
Support for SSL/TLS protected connections to MySQL databases (#14142)
* Allow configuration of the SSL/TLS operating mode when connecting to a mysql database

* Support SSL/TLS DB connections in the dispatcher service as well

* Apply black formatting standards to Python files

* Suppress pylint errors as redis module is not installed when linting

* More pylint fixes

* Correct typo in logging output

* Refactor SSL/TLS changes into DBConfig class instead of ServiceConfig

* Define DB config variables as class vars instead of instance vars

* Break circular import
2022-08-07 14:53:29 -05:00
Tony Murray
9f749ae778
Update Larastan (#14031)
* Update Larastan

* fix as many as I can

* update baseline for the remaining

* fix style

* Update Log::event phpdoc
2022-06-13 08:57:21 +02:00
Tony Murray
7a0d604cdd
Automatic fixes for validation failures (#13930)
* Automatic fixes for validations

* webui

* lint fixes

* Fix an install issue with ConfigSeeder requesting cli input in web page.

* Do not use c_echo in validate.php print_fail()
2022-06-10 16:25:33 -05:00
Tony Murray
014213680f
Move Config loading to a service provider (#13927)
* Move Config loading to a service provider
That way other service providers can depend on it
Move various random listener registrations into the EventServiceProvider
Various startup cleanup

* Config::persist Set live variable before persisting incase db update fail

* Disable strict mode for legacy code (init.php)

* Disable debug after os test data is gathered

* remove Eloquent::boot it is never used

* remove Eloquent::version

* lint fixes

* style fixes

* there is no c_echo here
2022-04-22 19:12:07 -05:00
Andy Norwood
5c53f2984f
Added Cisco Err-Disable interface event trap handler (#13855)
* Add Cisco Err Disable Mib

* Add new trap handler class

* Add ErrDisabled event handler

* Add ErrDisalbed event test

* remove unused line

* no ifindex message change

* Update unknown ifIndex message

* Add bad IfIndex test

* update description text

* style fixes

* change param to True for toString

* Add return type to test function

* style fix

* remove toString() and explode()

* remove unused line
2022-04-01 21:02:51 +01:00
Andy Norwood
061c2e94f4
Add APC upsOnBattery & powerRestored trap handler (#13836)
* Add new apc classes to snmptraps config

* Added new classsed

* Added onbattery handler

* Added Power Restored handler

* Add onbattery test

* Added powerRestored test

* style fixes

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2022-03-10 22:28:32 +01:00
Andy Norwood
f7ca687ceb
Add OspfTxRetransmit Trap Handler (#13824)
* OspfTxRetransmit class

* Message tidyup

* Initial test class

* add ospftxretransmit class

* add empty line

* chnage int to string in traptext

* new block to catch non lsupdates trap

* Add second test

* lint fail changes

* extra space removed
2022-03-10 21:29:23 +01:00
Andy Norwood
20e64d792c
Add APC SmartAvrReducing trap handlers (#13839)
* add new classes

* add AvrReducing handler

* Add AvrReducing Test

* add AvrReducingOff handler

* add AvrReducingOff Test
2022-03-10 21:13:09 +01:00
bonzo81
d07e3d6148
Cisco Mac address violation trap handler (#13811)
* Secure MAC Violation event

* Add Cisco Port Sec Mib

* Add CiscoMacViolation class

* removed $ifIndex and $port reference

* change ifDescr for ifName

* New test

* style fix
2022-02-26 20:39:03 +01:00
Jellyfrog
09929bd686
Implement OAuth and SAML2 support (#13764)
* Implement OAuth and SAML2 support via Socialite

* Add socialite docs

* fixes

* Additional information added

* wip

* 22.3.0 targeted version

* Allow mysql auth as long as there is a password saved

Co-authored-by: laf <gh+n@laf.io>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-02-20 22:05:51 +01:00
Jellyfrog
7c99599b2a
Set default DB_TEST_PORT (#13793) 2022-02-16 02:43:11 +01:00
Heath Barnhart
978cd75a32
SNMP Traps: Brocade login traps (#13770)
* initial push

* Some modifications for unit tests
2022-02-12 16:42:28 +01:00
Heath Barnhart
a71feb1636
SNMP Traps: APC Overload Traps (#13726)
* push apc trap handlers

* added unit test

* removed CR and fixed test

* switch cr for lf

* fixing ci complaints

* fixing another ci error

* fixed unit test

* annotating test
2022-02-08 11:37:11 +02:00
Jellyfrog
475a82bab6
Update dependencies (#13684)
* Update dependencies

  - Upgrading asm89/stack-cors (v2.0.3 => v2.1.1)
  - Upgrading barryvdh/laravel-debugbar (v3.6.3 => v3.6.5)
  - Upgrading barryvdh/laravel-ide-helper (v2.10.0 => v2.11.0)
  - Upgrading composer/ca-bundle (1.2.11 => 1.3.1)
  - Upgrading composer/composer (2.1.9 => 2.2.4)
  - Locking composer/pcre (1.0.0)
  - Upgrading composer/semver (3.2.5 => 3.2.7)
  - Upgrading composer/spdx-licenses (1.5.5 => 1.5.6)
  - Upgrading composer/xdebug-handler (2.0.2 => 2.0.4)
  - Upgrading doctrine/dbal (2.13.4 => 2.13.7)
  - Upgrading doctrine/inflector (2.0.3 => 2.0.4)
  - Upgrading doctrine/lexer (1.2.1 => 1.2.2)
  - Upgrading dragonmantank/cron-expression (v3.1.0 => v3.3.1)
  - Upgrading facade/ignition (2.15.0 => 2.17.4)
  - Upgrading fakerphp/faker (v1.16.0 => v1.17.0)
  - Upgrading fgrosse/phpasn1 (v2.3.0 => v2.4.0)
  - Upgrading filp/whoops (2.14.4 => 2.14.5)
  - Upgrading friendsofphp/php-cs-fixer (v2.19.2 => v2.19.3)
  - Upgrading fruitcake/laravel-cors (v2.0.4 => v2.0.5)
  - Upgrading graham-campbell/result-type (v1.0.3 => v1.0.4)
  - Upgrading guzzlehttp/guzzle (7.4.0 => 7.4.1)
  - Upgrading guzzlehttp/promises (1.5.0 => 1.5.1)
  - Upgrading laravel/dusk (v6.19.2 => v6.21.0)
  - Upgrading laravel/framework (v8.65.0 => v8.80.0)
  - Upgrading laravel/serializable-closure (v1.0.3 => v1.0.5)
  - Upgrading laravel/tinker (v2.6.2 => v2.7.0)
  - Upgrading laravel/ui (v3.3.0 => v3.4.1)
  - Upgrading league/commonmark (1.6.6 => 1.6.7)
  - Upgrading league/flysystem (1.1.5 => 1.1.9)
  - Upgrading league/mime-type-detection (1.8.0 => 1.9.0)
  - Upgrading maximebf/debugbar (v1.17.2 => v1.17.3)
  - Upgrading minishlink/web-push (v6.0.5 => v6.0.7)
  - Upgrading nesbot/carbon (2.53.1 => 2.55.2)
  - Upgrading nikic/php-parser (v4.13.0 => v4.13.2)
  - Upgrading nunomaduro/collision (v5.10.0 => v5.11.0)
  - Upgrading nunomaduro/larastan (1.0.0 => 1.0.2)
  - Upgrading nunomaduro/laravel-console-summary (v1.7.1 => v1.8.0)
  - Upgrading paragonie/constant_time_encoding (v2.4.0 => v2.5.0)
  - Upgrading php-amqplib/php-amqplib (v3.0.0 => v3.1.2)
  - Upgrading php-flasher/flasher (v0.9.4 => v0.9.6)
  - Upgrading php-flasher/flasher-laravel (v0.9.4 => v0.9.6)
  - Upgrading phpdocumentor/type-resolver (1.5.1 => 1.6.0)
  - Upgrading phpmailer/phpmailer (v6.5.1 => v6.5.3)
  - Upgrading phpoption/phpoption (1.8.0 => 1.8.1)
  - Upgrading phpseclib/phpseclib (3.0.10 => 3.0.12)
  - Upgrading phpspec/prophecy (1.14.0 => v1.15.0)
  - Upgrading phpstan/phpstan (1.0.1 => 1.4.2)
  - Upgrading phpunit/php-code-coverage (9.2.7 => 9.2.10)
  - Upgrading phpunit/php-file-iterator (3.0.5 => 3.0.6)
  - Upgrading phpunit/phpunit (9.5.10 => 9.5.11)
  - Upgrading predis/predis (v1.1.9 => v1.1.10)
  - Upgrading psy/psysh (v0.10.9 => v0.11.1)
  - Upgrading sebastian/exporter (4.0.3 => 4.0.4)
  - Upgrading seld/phar-utils (1.1.2 => 1.2.0)
  - Upgrading symfony/console (v5.3.7 => v5.4.2)
  - Upgrading symfony/css-selector (v5.3.4 => v5.4.2)
  - Upgrading symfony/debug (v4.4.31 => v4.4.36)
  - Upgrading symfony/error-handler (v5.4.0 => v5.4.2)
  - Upgrading symfony/filesystem (v5.3.4 => v5.4.0)
  - Upgrading symfony/finder (v5.3.7 => v5.4.2)
  - Upgrading symfony/http-foundation (v5.4.0 => v5.4.2)
  - Upgrading symfony/http-kernel (v5.4.0 => v5.4.2)
  - Upgrading symfony/mime (v5.4.0 => v5.4.2)
  - Upgrading symfony/options-resolver (v5.3.7 => v5.4.0)
  - Upgrading symfony/polyfill-ctype (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-iconv (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-intl-grapheme (v1.23.1 => v1.24.0)
  - Upgrading symfony/polyfill-intl-idn (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-intl-normalizer (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-mbstring (v1.23.1 => v1.24.0)
  - Upgrading symfony/polyfill-php72 (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-php73 (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-php80 (v1.23.1 => v1.24.0)
  - Upgrading symfony/polyfill-php81 (v1.23.0 => v1.24.0)
  - Upgrading symfony/process (v5.3.7 => v5.4.2)
  - Upgrading symfony/routing (v5.3.7 => v5.4.0)
  - Upgrading symfony/stopwatch (v5.3.4 => v5.4.0)
  - Upgrading symfony/string (v5.3.7 => v5.4.2)
  - Upgrading symfony/translation (v5.3.9 => v5.4.2)
  - Upgrading symfony/var-dumper (v5.4.0 => v5.4.2)
  - Upgrading symfony/yaml (v4.4.29 => v4.4.36)
  - Upgrading tecnickcom/tcpdf (6.4.2 => 6.4.4)
  - Upgrading tijsverkoyen/css-to-inline-styles (2.2.3 => 2.2.4)
  - Upgrading vlucas/phpdotenv (v5.3.1 => v5.4.1)

* Update debugbar facade path

* Update baseline
2022-01-23 19:43:48 +01:00
Tony Murray
b94f08cfdb
Remove color markers when logging to files (#13541)
* Remove color markers when logging to files

* Update lint

* safety checks

* back to simple formatters, but two of them

* more correct comment
2021-11-24 23:33:02 +01:00
Wheel
42fdbea126
Veeam SNMP traps fix and extend (#13549)
* Veeam fix and extend part 1

* Veeam SNMP traps

* StyleCI

* StyleCI

* Fix typo

* Lint

* Fix tests

* Fix tests :fingerscrossed:

* Think i get it now

* This is it?

* gotta be it

* Final

* Again
2021-11-24 18:20:56 +01:00
paulierco
53d3495b7e
Add Alcatel Omniswitch Traps Handlers (#13492)
* first

* style1

* lint

* add another trap

* add another trap

* change juniper to alcatel

* style

* style

* style
2021-11-20 09:10:19 -06:00
Tony Murray
c79b187d72
Poller rewrite (Try 2) (#13525)
* core WIP

* try to finish up

* trim space too
and a couple of cleanups

* update test data

* put escapes back

* another net-snmp difference

* correct copy paste error

* WIP

* Use new code YAY

* a tiny bit more

* Kind of working

* Handle manual modules correctly

* convert core to modern module

* Only save metrics if modules is not overridden

* correct module exists check

* database error handling

* debug handling

* restore bad changes

* Introduce Actions
 RunAlertRulesAction
 UpdateDeviceGroupsAction

* tweaks to output

* Fix some issues in outside code

* Style fixes

* fixes to module status checks

* typehints!

* Use logger only and DI

* OS module not named correctly

* Work on quiet output a bit more

* generically don't change output when disabling debug if the driver is already stack

* Fix missing $device variable for legacy os polling
Fix missing dbFacile functions when no legacy modules polled in RunAlertRulesAction

* restore legacy os module shim

* use the new poller code for tests

* PollingDevice event

* Fix some issues and enable/disable error reporting around legacy modules

* typehints

* fully update baseline

* Use Process for version commands so we don't leak debug output.

* don't detect rrdtool version in ci every time

* style fixes

* Warning fixes

* more fixes

* re-update baseline

* remove diff noise

* fix up alerts

* Catch exceptions in device ip lookup

* Revert accidental snmp.inc.php poller target change
(should have been ?: not ??)
2021-11-17 19:23:55 -06:00
Tony Murray
f8764ddcb5
Revert "Poller command rewrite (#13414)" (#13524)
This reverts commit 1752d1efd4.
2021-11-16 21:40:29 -06:00
Tony Murray
1752d1efd4
Poller command rewrite (#13414)
* core WIP

* try to finish up

* trim space too
and a couple of cleanups

* update test data

* put escapes back

* another net-snmp difference

* correct copy paste error

* WIP

* Use new code YAY

* a tiny bit more

* Kind of working

* Handle manual modules correctly

* convert core to modern module

* Only save metrics if modules is not overridden

* correct module exists check

* database error handling

* debug handling

* restore bad changes

* Introduce Actions
 RunAlertRulesAction
 UpdateDeviceGroupsAction

* tweaks to output

* Fix some issues in outside code

* Style fixes

* fixes to module status checks

* typehints!

* Use logger only and DI

* OS module not named correctly

* Work on quiet output a bit more

* generically don't change output when disabling debug if the driver is already stack

* Fix missing $device variable for legacy os polling
Fix missing dbFacile functions when no legacy modules polled in RunAlertRulesAction

* restore legacy os module shim

* use the new poller code for tests

* PollingDevice event

* Fix some issues and enable/disable error reporting around legacy modules

* typehints

* fully update baseline

* Use Process for version commands so we don't leak debug output.

* don't detect rrdtool version in ci every time

* style fixes

* Warning fixes

* more fixes

* re-update baseline

* remove diff noise

* fix up alerts
2021-11-16 16:59:46 -06:00
Tony Murray
bef021b158
Default session lifetime 24 days
32bit is the reason we can't have nice things.
2021-11-14 08:01:57 -06:00
Jellyfrog
d409643d68
Revert "Increase session lifetime to one month (#13505)" (#13515)
This reverts commit 8ccf72ffdd.
2021-11-14 14:15:45 +01:00
Tony Murray
8ccf72ffdd
Increase session lifetime to one month (#13505)
Because we know authenticate cookies, remember me is tied to the session lifetime now in addition to the cookie lifetime. Increase the lifetime to one month instead of two hours.
2021-11-12 09:32:58 -06:00
TheGreatDoc
63b174595f
SNMP Trap handler: UpsTrapOnBattery (#13482)
* SNMP Trap handler: upsTrapOnBattery

* Forgot to add the config

* Fixed handler name

* Fix test
2021-11-11 10:08:36 -06:00
Tony Murray
5900edbf16
PHP-Flasher for toast messages (#13401)
* PHP-Flasher for toast messages
Allows customized template
removes dependency on unmaintained package using dev stability
no solution for javascript toasts yet

Use DI in places it makes sense

allow html in flashes

Use "template.librenms" as a default notification style

merge toast containers
toastr needs to be second because it will find the containr made by flasher, but the inverse is not true

upgrade php-flasher to add custom options and persistent notifications

Add dark theme

* update composer.lock
2021-10-29 09:13:56 -05:00
Kevin Zink
98ed6bb9dc
New plugin system based on Laravel Package Development (#12998)
* use Blade view and Eloquent models for plugins

* move views

* fix style

* fix style

* revert mistake

* Update Plugin.php

delete test property "name"

* rename plugin function to settings

* last but not least - rename in Test.php

* Rename Test to Example

* fix typo

* fix style

* fix style

* fix style

* fix style - I hate tabs...

* Extract view calls

* fix method calls and style

* Move Models the the abstract class

* fix style

* Convert to traits

* Change the Example description

* Fix style

* Fix style

* Fix style

* Convert plugin function to Model static methods and delete .inc.php

* fix style

* fix style

* Use scope

* final methods blows up legacy code

* Config > \LibreNMS\Config

* convert the static string to a static method

* Correct placement in the page

* fix tabs

* fix style

* Rename from tait to hook

to make it easier to understand and be complient

* rename file

* Typo

* Started to change the docu

* change to a more usefully Device_Overview example

* and activate of course

* PluginManager

* fix .gitignore

* only php files in the root folder

* corrected .gitignore with all files :)

* Rename the Hooks and ExampleClass for better readability

* Fix style

* Fix style

* Exception handling (especially if DB is not present)

* Fix style and update schema

* fix indentation

* actually correct indent

* fix migration collation check include utf8mb4_bin

* stop phpstan whining

* A view lines documentation

* add typeHints

* Allow return null on handle

* lint

* fix return types

* fix logic of column collation check

* Fix MenuEntryHook

* switch to longtext instead of json type for now :D

* try phpstan on PHP 7.3

* set phpstan target version to 7.3

* all the typehints

* optional

* more

* Use namespace to prevent view collisions
disambiguate plugin and hook
no magic guessing of names in PluginManager, bad assumptions
remove unused plugins from the DB

* cleanup plugin menu

* cleanup on shutdown and ignore but log query error on cleanup

* instanceof must be called against an instance

* Allow multiple hooks per plugin

* Port plugin ui code to Laravel

* page instead of settings for v1 plugins

* actually working settings pages
a little url cleanup plugin/admin -> plugin/settings

* fix style

* Add page hook

* PHPstan

* Try to fix Illuminate\Http\RedirectResponse

* typehint

* Rewrite the doc

* Fix style

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-10-19 06:53:28 -05:00
Tony Murray
4e94c1e0a1
Rename NetSnmp to SnmpQuery (#13344)
* Rename NetSnmp to SnmpQuery
Always resolve a new instance.  It was not expected to be a singleton, set options persisted.
This means numeric() works properly now

* fix snmpfetch call and style

* Ability to set device from device array
2021-10-07 17:03:53 -05:00
Tony Murray
0b8b97bb68
Push Notifications (Mobile and PC) (#13277)
* Update manifest and add service worker
cleanup icons a bit

* Push notifications WIP

* navigate working

* cleanup

* acknowledge wired up

* Set VAPID keys on composer install

* Component to control notification permissions.

* Allow all user option to validate

* Enable on browser load if transport exists.

* Check for transport before showing user permissions
translations

* Documentation

* style fixes

* access via the attribute model

* fix alerting test

* update schema

* cleanup subscription on disable

* non-configurable db and table for webpush subscriptions (respect system connection)

* revert AlertTransport change
hopefully phpstan can figure it out

* phpstan fixes

* Support custom details display

* Match transport names to brand's preferred display

* less duplicate id errors

* Tests are done in Laravel code now so
remove legacy function usage... could be better, but ok

* Style fixes

* Style fixes 2

* Fix alert test

* Doc updates requires HTTPS and GMP

* unregister subscription when permission is set to denied

* cleanup after user deletion

* delete the right thing

* fix whitespace

* update install docs to include php-gmp

* suggest ext-gmp

* update javascript

* Update functions.php

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2021-10-06 07:29:47 -05:00
Tony Murray
d443d2b4b1
Use built in trusted proxy functionality (#13318)
* Use built in trusted proxy functionality
instead of fideloper/proxy

* my favorite style rule...

* hello braindead ide

* restore space
2021-10-03 14:13:20 -05:00
Jellyfrog
9ef94323f5
Update dependencies (#13310)
* Bump composer dependencies

  - Upgrading brick/math (0.9.2 => 0.9.3)
  - Upgrading composer/ca-bundle (1.2.10 => 1.2.11)
  - Upgrading composer/composer (2.1.3 => 2.1.8)
  - Upgrading composer/xdebug-handler (2.0.1 => 2.0.2)
  - Upgrading dapphp/radius (2.5.5 => 2.5.6)
  - Upgrading doctrine/annotations (1.13.1 => 1.13.2)
  - Upgrading doctrine/cache (2.0.3 => 2.1.1)
  - Upgrading doctrine/dbal (2.13.2 => 2.13.3)
  - Upgrading facade/flare-client-php (1.8.1 => 1.9.1)
  - Upgrading facade/ignition (2.11.0 => 2.14.0)
  - Upgrading fakerphp/faker (v1.15.0 => v1.16.0)
  - Upgrading filp/whoops (2.13.0 => 2.14.3)
  - Upgrading friendsofphp/php-cs-fixer (v2.19.0 => v2.19.2)
  - Upgrading graham-campbell/result-type (v1.0.1 => v1.0.2)
  - Upgrading laravel/dusk (v6.15.1 => v6.18.1)
  - Upgrading laravel/framework (v8.49.2 => v8.62.0)
  - Locking laravel/serializable-closure (v1.0.2)
  - Upgrading laravel/tinker (v2.6.1 => v2.6.2)
  - Upgrading league/commonmark (1.6.5 => 1.6.6)
  - Upgrading league/flysystem (1.1.4 => 1.1.5)
  - Upgrading league/mime-type-detection (1.7.0 => 1.8.0)
  - Upgrading maximebf/debugbar (v1.16.5 => v1.17.1)
  - Upgrading mockery/mockery (1.4.3 => 1.4.4)
  - Upgrading monolog/monolog (2.3.0 => 2.3.4)
  - Upgrading nesbot/carbon (2.50.0 => 2.53.1)
  - Upgrading nikic/php-parser (v4.11.0 => v4.13.0)
  - Upgrading nunomaduro/collision (v5.5.0 => v5.10.0)
  - Upgrading phar-io/manifest (2.0.1 => 2.0.3)
  - Upgrading php-parallel-lint/php-parallel-lint (v1.3.0 => v1.3.1)
  - Upgrading phpdocumentor/type-resolver (1.4.0 => 1.5.0)
  - Upgrading phpmailer/phpmailer (v6.5.0 => v6.5.1)
  - Upgrading phpoption/phpoption (1.7.5 => 1.8.0)
  - Upgrading phpseclib/phpseclib (3.0.9 => 3.0.10)
  - Upgrading phpspec/prophecy (1.13.0 => 1.14.0)
  - Upgrading phpstan/phpstan (0.12.92 => 0.12.99)
  - Upgrading phpunit/php-code-coverage (9.2.6 => 9.2.7)
  - Upgrading phpunit/phpunit (9.5.6 => 9.5.10)
  - Upgrading predis/predis (v1.1.7 => v1.1.8)
  - Upgrading ramsey/collection (1.1.3 => 1.2.1)
  - Upgrading ramsey/uuid (4.1.1 => 4.2.3)
  - Upgrading seld/phar-utils (1.1.1 => 1.1.2)
  - Upgrading symfony/console (v5.3.2 => v5.3.7)
  - Upgrading symfony/css-selector (v5.3.0 => v5.3.4)
  - Upgrading symfony/debug (v4.4.25 => v4.4.31)
  - Upgrading symfony/error-handler (v5.3.3 => v5.3.7)
  - Upgrading symfony/event-dispatcher (v5.3.0 => v5.3.7)
  - Upgrading symfony/filesystem (v5.3.3 => v5.3.4)
  - Upgrading symfony/finder (v5.3.0 => v5.3.7)
  - Upgrading symfony/http-foundation (v5.3.3 => v5.3.7)
  - Upgrading symfony/http-kernel (v5.3.3 => v5.3.9)
  - Upgrading symfony/mime (v5.3.2 => v5.3.8)
  - Upgrading symfony/options-resolver (v5.3.0 => v5.3.7)
  - Upgrading symfony/polyfill-intl-grapheme (v1.23.0 => v1.23.1)
  - Upgrading symfony/polyfill-mbstring (v1.23.0 => v1.23.1)
  - Upgrading symfony/polyfill-php80 (v1.23.0 => v1.23.1)
  - Locking symfony/polyfill-php81 (v1.23.0)
  - Upgrading symfony/process (v5.3.2 => v5.3.7)
  - Upgrading symfony/routing (v5.3.0 => v5.3.7)
  - Upgrading symfony/stopwatch (v5.3.0 => v5.3.4)
  - Upgrading symfony/string (v5.3.3 => v5.3.7)
  - Upgrading symfony/translation (v5.3.3 => v5.3.9)
  - Upgrading symfony/var-dumper (v5.3.3 => v5.3.8)
  - Upgrading symfony/yaml (v4.4.26 => v4.4.29)
  - Upgrading tecnickcom/tcpdf (6.4.1 => 6.4.2)
  - Upgrading theseer/tokenizer (1.2.0 => 1.2.1)

* Update npm dependecies

* Update phpstan ignores after laravel upgrades

* Merge laravel/laravel repo changes
2021-10-02 18:04:59 -05:00
Tony Murray
a828bb00c3
lnms snmp:fetch command and new SNMP code (#13303)
* SNMP WIP

* cleanup, more types

* Include my snmp:fetch command

* Fix Facade name conflict

* Command WIP
remove mib

* Ignore exit code
cleanups

* Doc blocks and style fixes

* forgot to use parseOid

* Hopefully final fixes

* missed on (:

* small changes
deviates from existing code, hopefully doesn't re-add too many corner cases.

* add some simple tests, will make it easier to add more in the future when we find corner cases.

* test numeric

* API refinements, try to avoid setting textual net-snmp options directly

* change numeric to a toggle makes for nicer usage

* make ci happy

* Some errors happen only in stderr, pass that to SnmpResponse for parsing.
Add error message access

* More consistent naming
2021-10-01 18:58:12 -05:00
Kevin Zink
f796396e0b
HP Fault Traps (#13254)
* HP Fault Trap

* Add typehints

* Fix style

* Fix style

* Try to fix wrong test

* Next try
2021-09-21 16:20:49 -05:00
Tony Murray
8a883140cb
Infer character encoding for ifAlias and sysLocation (#13248)
* Infer character encoding for ifAlias and sysLocation
Tries to convert character encoding for non-UTF-8 encoded strings.
This will only work for snmp strings that are type-hinted, not ones forced to ASCII with -Oa or similar
Only works for your default charset or Windows-1251 or LATIN1.
You can set your character encoding in .env with CHARSET

Please save us all and just use UTF-8

* style fixes

* less Yoda

* ensure return type

* fall back to passed string

* don't convert strings with any unprintable characters (such as line return)

* Update LibreNMS/Util/StringHelpers.php

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>

* Fix CP850

* fix space

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2021-09-21 08:47:44 -05:00
Kevin Zink
59859c2ea3
Veeam backup SNMP Traps (#13170)
* SNMP Trap Veeam backupjob status

* Add  onVmBackupJobCompleted

* add mib

* fix style

* fix style

* Split backupjob and vm backup

* Add Traptest

* Fix style

* Fit style

* typehint on tests

* Fix handling empty string

* Fix wrong check

* Fix styl

* Fix style

* Update VeeamBackupJobCompleted.php

* Update VeeamVmBackupJobCompleted.php

* Update VeeamTrapTest.php

* Update VeeamTrapTest.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-09-19 08:21:31 -05:00
djamp42
a7cb75ba2d
Support multiple db servers (#12963)
* add multiple db servers

* formating fixes

* add documentation, mysql_cluster

* add laravel db sticky

* fix formating

* fix space

* updated docs

* Fix whitespace

Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-07-14 10:24:18 -05:00
Tony Murray
76910e4180
Debug and collect-snmp-data.php fixes (#12837)
Fix output so it can be captured and typo in collect-snmp-data.php
2021-05-05 10:27:10 -05:00
Tony Murray
aa83e6aa1a
Tripplite snmp trap handling (#12832)
* Tripplite snmp trap handling

* remove extra import
2021-05-05 12:39:14 +02:00
Tony Murray
61c89794e4
Remove debug globals (#12811)
* Remove $debug global
and $vdebug global
makes these variables more accessible and protects from collisions.

* the on boot set sends application as the first parameter, just handle that

* Relocate other debug related functions

* Log debug to stdout

* Wrong output

* remove stupid constants

* Fix lint and style issues
2021-04-29 22:42:18 -05:00
Tony Murray
1c379dcd05
Remove legacy function calls (#12651)
* massive inlines

* fix style and wtf

* remove rrdtool.inc.php include

* fix CommonFunctions namespace issues

* looking for missing class space, fix undefined class issues

* style fixes
2021-03-29 00:25:30 +02:00
Jellyfrog
f06e81b357
Switch to utf8mb4 (#12580)
* Switch to utf8mb4

This allows emojis to function correctly

* Update URLs
2021-03-28 16:23:08 +02:00
Tony Murray
f5a0959181
Revert "Switch to utf8mb4 (#12501)" (#12578)
This reverts commit 8e2e67d0ee.
2021-03-01 14:59:06 -06:00