Commit Graph

671 Commits

Author SHA1 Message Date
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
Etienne Wan
9af97a0395
Add a global setting for Ctrl-F focus (improve #14947) (#15023)
* Add a global setting for Ctrl-F focus (improve #14947)

* Move this new global setting to user setting (improve #14947)

* Update preferences.blade.php

Cleaner wording, and Copy & Paste bled through.

* Fix indents and @endif position in menu.blade.php

---------

Co-authored-by: Justin Lentz <monkeybrains7@gmail.com>
2023-05-14 20:34:37 -05:00
eskyuu
ce0734ff5d
Added support for user timezones and user browser timezone by default (incomplete) (#13626)
* Added support for user timezones and user browser timezone byt default

* Formatting fixes

* Use the timezone for alert log display

also added validation for the timezone because it's being used in SQL.

* Formatting fixes

* Added return type

* Formatting"

* Update the latency graphs to use the user timezone

* Simplify the web routes config

* Update phpstan to ignore type error

* Fixed up the phpstan config

* Reverse phpstan change

* Re-apply phpstan override

* Remove the option to unset the session timezone

* Formatting fix

* Update outge and event logs to use session timezone

* Fix route for the timezone control

* Made the timezone more dynamic

* Fix a logic error that was stopping the timezone from being set automatically on login

* Prevent getPref from being called twice

* again prevent getPref double call

* getPref double call

* Fixed typo made during merge

* Fixed merge error in phpstan-baseline.neon

* Change spaces to tabs in phpstan-baseline.neon

* Update error count

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-05-09 10:24:48 -05:00
Tony Murray
5c25cece48
Convert the inventory page to Laravel (#15004)
* Convert the inventory page to Laravel
Fix several XSS issues (hopefully no new ones snuck in)
Small improvement to the SelectController to allow filtering by filterFields()

* style fixes

* Fix lint issues

* Fix part device filter
2023-04-28 07:51:41 -05:00
Tony Murray
8a630edb38
Fix language selector (#15003) 2023-04-25 23:10:37 -05:00
Jellyfrog
f271019f6c
Add a validation for checking if the scheduler is running (#14987) 2023-04-24 10:04:50 +02:00
Justin Lentz
53f66e0c2c
Allow device ignore to be set via API (#14985)
* Missing Fillables

* StyleCI

* Update Device.php
2023-04-21 15:38:58 -05:00
VoipTelCH
8733589f6a
Enabled disabling a device via api (#14983) 2023-04-19 09:50:42 -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
Tony Murray
52f5f10231
Fix some lint issues (#14962) 2023-04-15 09:02:41 -05:00
Tony Murray
e9c08e21a5
Fix more divide by zero issues (#14954)
* Fix more divide by zero issues
fixes: 14932

* Round to the nearest integer, then cast

* Fix up dhcpatriot
2023-04-11 13:44:45 -05:00
Kevin Zink
cde4d6a09f
Add link to hosts mgmt (ipmi) interface (#14905)
* Add link to hosts mgmt (ipmi) interface

* Fix Style

* Fix style

* Fix Lint

* Update DeviceController.php

Mgmt > IPMI
2023-04-10 18:58:50 -05:00
maticomba
6c7fda9833
Solves error in discovering services module (#14939)
* Solves error discovering services module

* Removing trailing spaces

* Allow in device group scopes to accept an array

* Fix and optimize queries a little

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-04-10 13:26:26 -05:00
Justin Lentz
df31be30c1
Cleanup enable bgp setting (#14931)
* remove logic in module

* remove enable_bgp logic

* remove enable_bgp logic

* remove enable_bgp logic

* remove enable_bgp logic

* remove enable_bgp definition

* remove enable_bgp logic

* Remove enable_bgp documentation

* StyleCI

* StyleCI

* StyleCI

* StyleCI

* StyleCI

* StyleCI

* StyleCI

* StyleCI

* StyleCI

* StyleCI
2023-04-06 21:01:21 -05:00
Skylark
473a7d360b
Allows GEO lookup with detailed internal Location information wrapped inside parentheses. (#14799)
* Ignore everyting inside () during GEO lookup

I location info is: "1100 Congress Ave, Austin, TX 78701 (3rd floor meeting room)" then the GEO locator will look up "1100 Congress Ave, Austin, TX 78701"

* update info

* small typo

* typo fix

* getting verify

* style fix

* commitment issues

* updating wiki

* tweaking the document format

* more tweaks

* Im starting to hate md

* cleanup
2023-03-18 22:07:52 -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
MANT5149
d86b9ce889
Update PingCheck.php to remove duplicate "Device status changed to ... from icmp check." event (#14785)
* Update PingCheck.php

Remove duplicate log entry per https://github.com/librenms/librenms/issues/14751

* Update PingCheck.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-01-21 07:17:43 -06:00
Skylark
02e78aab1d
Fix for RIPE NCC API Tools (#14757) 2022-12-24 22:36:26 +00:00
Tony Murray
1ab238a4d1
Fix port speed setting feedback (#14743) 2022-12-19 18:41:59 -06:00
Tony Murray
8ea3f5cd06
Offer opt in to usage and error reporting during install (#13906)
and on the about page
2022-12-15 19:52:22 -06:00
Tony Murray
88c86f2a19
Fix graph output base64 (#14701)
Mostly for people using unauth graphs instead of the api.
2022-12-15 15:58:56 -06:00
Tony Murray
1d3440b943
Unify time interval formatting (#14733)
* Unify time interval formatting
Use carbon for formatting, it supports locales.

* fix style

* remove baseline exceptions

* fixes found by lint
2022-12-15 15:52:53 -06:00
Gilles Depeyrot
ceb8a02a99
Search devices using display field as well (#14714) 2022-12-09 17:25:42 +01:00
Tony Murray
a6e1c11b0c
Remove ungrouped devices panel (#14664)
The panel destroyed the page performance on larger installs.
Now has a link to the devices list with new group=none filter.
2022-11-22 15:52:29 -06:00
Tony Murray
7635ace4fa
Split out lnms snmp convenience commands (#14603)
* Split out lnms snmp convenience commands

* Use SnmpQuery->valuesByIndex()

* Fix style
2022-11-19 22:10:25 -06:00
Tony Murray
b7b037bf4d
Fix Service Template XSS (#14659)
Reported via huntr.dev by @vautia
2022-11-19 21:51:35 -06:00
Tony Murray
00d5e2f477
Fix SNMP trap -> Eventlog XSS (#14657)
Reported via Huntr.dev by @stefan-schiller-sonarsource
2022-11-19 21:31:48 -06:00
Tony Murray
752bbc1531
Port search API search more than one fields (#14646)
* Fix port search columns

* Port search API search more than one fields
Fixup port APIs
Change validate_column_list api helper to throw a renderable exception on error and return the valid columns
DeviceCache::get() can handle a bigger range of input

* whitespace

* Refactor exceptions a bit

* change throws type to be more generic

* Lint fixes
2022-11-18 16:27:56 -06:00
Tony Murray
63988a4615
fix snmp_disable type (#14650) 2022-11-18 17:30:16 +01:00
pertruccio
c9d617823d
added disable_notify and location_id (#14619) 2022-11-16 08:12:37 -06:00
Jellyfrog
f411c1a6a7
Fix GeocodingHelper type-hinting (#14604)
* Fix GeocodingHelper type-hinting

* Update GeocodingHelper.php
2022-11-09 10:10:04 -06:00
geg347
96c7e7166e
Adding device's field in get_alert_rule and list-alert-rules API function (new) (#14481)
* Adding device's field in get_alert_rule and lis-alert-rules API function

* Converting SQL request for list/get_alert_rules to Eloquent (thanks a lot to Murrant)

* Manually added #14500 to pass pipeline

* Fixing StyleCI error + trying to fix PHPStan errors

* Trying to fix PHPStan errors (part 2)
2022-11-09 08:21:41 -06:00
Jellyfrog
71d740770b
Remove Log::event (#14526)
* Remove Log::event

Use the Eventlog class directly instead

* wip

* wip

* wip

* Apply fixes from StyleCI

* Update Eventlog.php
2022-11-09 09:47:19 +01:00
Tony Murray
0e9bb04071
API restore ability to update purpose and override_sysLocation (#14596)
fixes #14538
2022-11-08 18:22:37 +01:00
Tony Murray
0801af7a81
Consolidate and improve snmptranslate usage (#14567)
* Consolidate and improve snmptranslate usage

* Fix style

* lint fixes

* fix typo

* allow multiple mib directories

* Only add mib if it is not already set

* oid first, in case we have key length issues

* if there is a full oid, don't add other mibs

* debug in ci

* more debug in ci

* better debug in ci

* remove debug

* Use numeric index

* revert dlink change

* Don't add -On twice

* unit tests and hopefully better heuristics

* remove dump and add one more set of tests

* style fixes

* handle bad input in old functions

* shortcut whole snmp_translate function
2022-11-07 12:00:47 -06:00
Jellyfrog
009d69a48d
Use Collection instead of collect() (#14527)
* Use Collection instead of collect()

* wip
2022-11-05 10:04:36 +01:00
Tony Murray
0c365d08e3
SnmpQuery numeric accept a boolean (#14565) 2022-11-02 18:50:46 -05:00
Tony Murray
e938458cde
Fix BaseApi uninitialized (#14557) 2022-11-02 09:02:52 -05:00
Félix Bouynot
3a61955658
Fix Type error (#14555)
Fix production.ERROR: Typed property App\ApiClients\BaseApi::$client must not be accessed before initialization
cf. https://stackoverflow.com/a/59265626/3236342
2022-11-02 14:40:05 +01:00
Félix Bouynot
b59cf980ca
Type API methods and properties (#14476)
* Type properties

* Comment method

* Update base_uri child property

* Update BingApi.php

* Update GoogleMapsApi.php

* Update MapquestApi.php

* Update NominatimApi.php

* Update RipeApi.php

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Fix indent

* Fix escaping

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* StyleCI indent

* Update phpstan-baseline.neon

* Make possible for $client to be null

* Remove comments

* Remove comments

* Remove comments

* Update MapquestApi.php

* Update NominatimApi.php

* Remove comments

* Remove comments

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type $client

* Type method and properties

* Remove errors not matched anymore

* Fix type errors in graylogapi

* Mixed can't be ORed

* uri never null

* Update app/ApiClients/GraylogApi.php

* Fix getAdresses Type

* Collection changed its folder?

* Fix directory, there was just a backslash missing

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-11-02 01:06:15 +01:00
Tony Murray
4b65dc41d2
Graphing cleanup (#14492)
* WIP

* Fixes and cleanups

* Move parseAtTime to Time util class

* lint fixes, explicitly define variables

* Style fixes
2022-10-28 08:06:29 -05:00
Jellyfrog
44578b2935
Convert string references to ::class (#14508)
PHP 5.5.9 adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP.

Co-authored-by: Shift <shift@laravelshift.com>
2022-10-25 08:31:46 -05:00
Tony Murray
bfc9c5f846
Fix v2 plugins (#14506)
inverted check caused all v2 plugins to not be shown.
2022-10-24 21:48:13 -05:00
Tony Murray
62aa77c0a0
Fix AlertRule relationships (#14500) 2022-10-24 09:54:59 -05:00
rhinoau
6372041d39
Fix update_device hostname handling #14435 (#14448)
* Fix device_update hostname handling #14435

* Use Eloquent

* Update Device.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-10-22 15:45:47 -05:00
Tony Murray
4b97abe225
Add --forgot-key to key:rotate command (#14495)
Destroys all encrypted data
2022-10-22 11:45:58 +02:00
Tony Murray
da8befca06
Add instance id to error reports (#14444)
* Add instance id to error reports

Alternative to #14261

* lint fix
2022-10-19 18:45:27 -05:00
Tony Murray
7dd3a224fa
Block disabled user session auth (#14473)
Do not allow users that are disabled to be logged in via cookie.
Allow all auth methods to disable users
2022-10-17 12:39:15 -05:00
Tony Murray
722791d086
Fix XSS when deleting device and port groups (#14472) 2022-10-17 12:38:16 -05:00
Tony Murray
09a2977adb
Fix authentication mass assignment vulnerability (#14468)
Users were able to submit changes to fields they should not have access to change by bypassing the frontend validation.  Correct backend validation to prevent that.
2022-10-17 12:11:14 -05:00