Commit Graph

801 Commits

Author SHA1 Message Date
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
PipoCanaja
1fd915c8a3 Fix VRP duplicate BGP Peers (#14431)
* fix VRP not cleaning BGP peers properly

* fix missing field in BgpPeer model

* Update includes/discovery/bgp-peers/vrp.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-10-11 20:26:56 +02:00
Jellyfrog
071173ffb9 Remove tabs from yaml (#14437)
* Remove tabs from yaml

* Remove tabs from random files
2022-10-10 18:13:10 +02: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
PipoCanaja
daa8c757f6 Fix a few Db* to Eloquent requests (#14278)
* Eloquent for 2 requests

* Eloquent for 1 request

* a few in Dell

* Model

* and more with timos

* and more with timos

* and firebrick

* firebrick

* one query instead of many

* Should use collection get

* Update timos.inc.php

* Update dell-os10.inc.php

* avoid changing timos as it breaks something

* new try with timos

* deps for BGP

* revert deps for BGP

* style

* style

* deps for BGP, 2nd try

* typo

* revert aos7

* fix create

* firebricktests

* firebrick

* firebrick

* cipsec-fix

* cipsec

* timos fix 100th time :)

* ./scripts/save-test-data.php -m os,ports,processors,mempools,vrf,sensors,bgp-peers,mpls,ospf  -o timos -v 7705

* remove timos from this PR

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-10-02 16:04:08 +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
f60b6788d3 Cache version data (#14404)
* Cache version data
Calling cli commands can be expensive, cache the results.

* style fixes

* Fix pre-laravel usage

* fix lint
2022-09-28 23:23:32 -05:00
Tony Murray
e990dfcb35 Disable plugins that have errors (#14383)
* Disable plugins that have errors
Disable plugin if a hook throws an error and set a notification
Move notification code to class, so we can access it
Clear notification when plugin is attempted to be enabled again

* fix style and lint fixes

* another lint fix and handle if property is missing
2022-09-25 22:47:58 -05:00
Félix Bouynot
333ba7c2cd Fix oxidized web requests unclosed connections or responding fast enough (#14370)
* Fix oxidized web requests not closing connections or responding fast enough

* Update showconfig.inc.php

* Add method to get the text content of an oxidized page

* Use Oxidized getContent method instead of file_get_content

* Too much brackets with copy paste

* Fix carriage return errors because of copy paste

* Fix copy paste error again

* Fix indent

* PHPStan is waiting for a return even outside of the if loop

* Single quotes

* Variabilize timeout in baseapi

* Set Oxidized Api class timeout var to 90 because oxidized is slow and to be sure not to break half the installs here

* fix typo

* Variabilize timeout

* Variabilize timeout

* Variabilize timeout

* Variabilize timeout

* Variabilize timeout

* Spacing

* Remove timeout type because of this error

Unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in app/ApiClients/BaseApi.php on line 34

* Lint needs type finally

* Use contruct instead of setting variable

* Type hinting instead for php7.3

* Type hinting fix

* Set property value instead of calling parent constructor

* Typo

* Remove unneededconstructors

* Remove unneeded constructors

* Remove unneeded constructors

* Remove unneeded constructors

* Remove unneeded constructors

* Remove unneeded constructors

* Typing not casting

* Typing not casting

* Cannot type variables outside of a class

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
2022-09-24 14:24:11 -05:00
sembeek
4e1f958e16 Fix ping.php skipped results (#14368)
* Update PingCheck.php

* Update PingCheck.php

* Update phpstan-baseline.neon

* Update PingCheck.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-09-19 15:10:26 -05:00
Jellyfrog
27a19039dc Defer loading cli option defaults (#14363)
* Defer loading cli option defaults

Also allows passing args to functions

* Update DynamicInputOption.php
2022-09-19 16:03:55 +02:00
Jellyfrog
be4f39a2b4 Remove call to Config from artisan (#14362)
Defers the loading of Config a bit
2022-09-17 23:44:45 -05:00
Tony Murray
0805002086 Fix scheduled maintenance xss (#14360)
Fix for fields title, notes, and maybe recurring_day. Other fields can't store html.

https://huntr.dev/bounties/bcb6ee68-1452-4fdb-932a-f1031d10984f/
2022-09-16 11:59:48 -05:00
Tony Murray
67ad0726b0 Defer loading cli option values (#14354)
* Defer loading option values
Otherwise it causes a cli command to be run every single application boot.

* style and lint

* Just return whatever we have it isn't callable
2022-09-16 11:58:22 +02:00
Félix Bouynot
9cff8acb29 Match displayname source for graylog (#14339)
* Match displayname source for graylog

* Update GraylogApi.php

* Reorder addresses
2022-09-13 07:44:19 -05:00
Jellyfrog
a22be00c66 Ignore CommandNotFoundException from reporting (#14342)
Prevents user typos from bubbling up to error reports
2022-09-13 07:24:01 -05:00
Tony Murray
ad8580d694 Cleanup and optimize the availability widget (#14329)
* Cleanup and optimize the availability widget
Default sort is display name
Sort applies to services too (services always last)
May need to refresh the page to get new css

* style

* We don't need request (lint fix)

* Wrong service field name
2022-09-09 18:22:58 +02:00
Jellyfrog
152497a098 PHPStan: Enable more checks (#14318)
* PHPStan: Enable more checks

* Fixes

* Fixes

* Deprecation fixes
2022-09-09 07:08:06 -05:00
Marek Wobst
22f84ef3d8 Add additional sorting options for Availability Map (#14073)
* Fix IPv6 in service check host (#13939)

* Add hostName cleaning to Clean

* Apply RFC 5952 formatting to Clean::hostName output

* Use more liberal cleaning for hostnames

* Remove unwanted whitespace

* Apply Clean::hostName() to all relevant fields

* Fix docstring

* Use IP::isValid inline

* Update Clean.php

* Update services.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>

* Add sorting support for additional columns + dual column

Additional columns are Display Name (display) and System Name (sysName)

Dual column means that first is sorted after status, then within
each status group another sort is done (every columns from single column
sorting is possible).

* Change code for styleCI

* Expand availability map sorting menu

Also change sysName to System Name – there is no real reason for
that short form.

* Add german translation for avail. map sorting/display options

* Adjust sorting behaviour in Availability Map

The dropdown now presents two options:

- Display Text: Sort by the selected value of the dropdown 'Display Text'
- Status: Sort by status, then by selected value of dropdown 'Display Text'

As the field 'display' (The display name) may contain template functions
etc., sorting is not done by SQL means; instead custom sorting is done
within the controller.

* Apply fix for styleCI

* Apply fix for styleCI, part 2

* Update availability-map.blade.php

* Update availability-map.blade.php

* Update availability-map.blade.php

* Update de.json

* Update AvailabilityMapController.php

* Update AvailabilityMapController.php

* Update availability-map.blade.php

* Update de.json

Co-authored-by: Sander Steffann <sander@steffann.nl>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-09-07 20:02:00 -05:00
PipoCanaja
53bfb24ef9 Migrate xDSL code to module, and add support for VDSL2 MIB (#14207)
* use component to discover if xDSL polling is needed

use component to discover if xDSL polling is needed

* Components OK, Polling in correct files, no DB for VDSL

* GUI

GUI_suite

* per port as well

* rename

* interface listing

* draytek_snmpsim

* fix arraymerge

fix names and max value

* schema

schema

style

* remove one dbFetchRows

remove 2x dbFetchCell

style

style

remove Legacy dbFetchRow

tests

tests

eloquent

more eloquent

more eloquent

one more gone

* fix properties access

eloquent_insert_update

style

tests

tests

tests

tests

* tests

tests

tests

* adslLineCoding

* Models

* fix not nullable cols in DB from code

default values

typo

rename

typo

schema

fix

fix

vdsl fix now

typo

typo

fix size

fix size

* Power values for VDSL

Power values for VDSL

Power values for VDSL

DB

* cleanup

* Rrd::checkRrdExists

* always enable DSL discovery

style

* xdsl module

* cleanup and move to Module

cleanup and move to Module

cleanup and move to Module

cleanup and move to Module

* Fix display

* fix polling and tenth

* remove legacy poller

* Style and Cosmetics

Cosmetics

Cleanup

* Translations

Translations

* exists

exists

* add test support for xdsl

* remove last component call

unused

* translations

* remove non standard onclick event on xdsl line

* Update Discovery Support.md

Update Poller Support.md

toner_gone

* Notification for removal of lnms config:set enable_ports_adsl true

* enable on devices with potential DSL interfaces

* tests are working now

fix teldat tests

* os_schema

* teldat

* move to new module structure

* move to new module structure

* wrong dump function

* wrong dump function

* laravel_through_key hidden

* Update notifications.rss

* Update notifications.rss

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-09-07 19:29:17 -05:00
Tony Murray
dc050711ec 2fa not all routes have names (#14311) 2022-09-07 09:06:24 +02:00