Commit Graph

614 Commits

Author SHA1 Message Date
Tony Murray
a06eaa4767 Fix eventlog filtering (#14136)
Was sending device_id = 0 for all devices when it should have been device_id = null
2022-07-25 09:01:22 -05:00
Zane C. Bowers-Hadley
0bbcde1227 add the ability for storing app data to prevent spamming of the event log via via component usage (#14087)
* initial work on add the ability to save/fetch app data

* update to use get_app_data for ZFS

* update the poller for the new app_data stuff

* ZFS now logs changes to pools

* add schema update for app_data stuff

* small formatting fix

* add a missing \

* now adds a column

* sql-schema is no longer used, so remove the file that was added here

* misc cleanups

* rename the method in database/migrations/2022_07_03_1947_add_app_data.php

* hopefully fix the migration bit

* add the column to misc/db_schema.yaml

* more misc small DB fixes

* update the test as the json column uses collat of utf8mb4_bin

* revert the last change and try manually setting it to what is expected

* remove a extra ;

* update suricata as well

* correct the instance -> instances in one location to prevent the old instance list from being stomped

* remove a extra ;

* update fail2ban to use it as well

* remove two unused functions as suricata and fail2ban no longer use components

* style cleanup

* postgres poller updated to use it

* update html side of the postgres bits

* chronyd now uses app data bits now as well

* portactivity now uses it as well

* style fix

* sort the returned arrays from app_data

* correct log message for port activity

* collocation change

* try re-ordering it

* add in the new data column to the tests

* remove a extra ,

* hmm... ->collate('utf8mb4_unicode_ci') is not usable as apparently collate does not exist

* change the column type from json to longtext

* mv chronyd stuff while I sort out the rest of the tests... damn thing is always buggy

* hmm... fix a missing line then likely move stuff back

* style fix

* add fillable

* add the expexcted data for fail2ban json

* escape a " I missed

* add data for portactivity

* add suricata app data

* add app data to zfs legacy test

* put the moved tests back into place and update zfs-v1 test

* add app data for chronyd test

* add app data for fail2ban legacy test

* update zfs v1 app data

* add some notes on application dev work

* add Developing/Application-Notes.md to mkdocs.yml

* add data column to it

* added various suggestions from bennet-esyoil

* convert from isset to sizeof

* type fix

* fully remove the old save app data function and move it into a helper function... the other still needs cleaned up prior to removal

* update docs

* get_app_data is fully removed now as well

* a few style fixes

* add $casts

* update chronyd test

* attempt to fix the data

* more doc cleanup and try changing the cast

* style fix

* revert the changes to the chronyd test

* apply a few of murrant's suggestions

* document working with ->data as json and non-josn

* remove two no-longer used in this PR exceptions

* ->data now operates transparently

* style fix

* update data tests

* fix json

* test fix

* update the app notes to reflect how app data now works

* app test fix

* app data fix for linux_lsi

* json fix

* minor doc cleanup

* remove duplicate querty and use json_decode instead

* style fix

* modelize the app poller

* use a anon func instead of foreach

* test update

* style cleanup

* style cleanup

* another test cleanup

* more test cleanup

* reverse the test changes and add in some more glue code

* revert one of the test changes

* another small test fix

* Make things use models
Left some array access, but those will still work just fine.

* missed chronyd and portactivity

* rename poll to avoid make it any confusion

* Remove extra save and fix timestamp

* save any changes made to app->data

* nope, that was not it

* What are magic methods and how do they work?

* fix two typos

* update linux_lsi test

* change quote type

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-07-22 16:01:55 -05:00
Tony Murray
30cb0a5fb3 Fix maintenance APIs not associating device or group (#14127) 2022-07-21 07:07:44 -05:00
Feras Al-Kassar
e5c91a0f83 Security fixes XSS in oxidized-cfg-check.inc.php and print-customoid.php (#14126)
Signed-off-by: AL-KASSAR <feras.al-kassar@sap.com>
2022-07-20 12:45:42 -05:00
00gh
f66ee182e3 ping_perf.inc.php: changed AVERAGE to MIN to reflect legend. (#14117)
The generated graphs shows wrong legend value for "Min".
It is displaying the calculated AVERAGE value instead of the
calculated MIN.

Changed AVARAGE into MIN.

Co-authored-by: 00gh <00gh>
2022-07-18 18:58:56 -05:00
Alban Browaeys
a6bc7490e2 Fix app docker (#14080)
* docker app: polling - RRD dataset and fields value mismatch

RRD dataset definitions and fields array keys passed to data_update
have to be in the same order. There is no match based on key before
building the rrdtool update command.

Fixes mem_perc ending as NaN because it ended with a value above 100
as it was given mem_limit bytes value.

* docker app - remove misleading divider

The mem_perc and cpu_usage are already in percent, no need to divide
them by a hundred. The values were then made into milli percent or micro
percent.
2022-07-15 09:12:20 -05:00
Bennet Gallein
a9d5c378f7 feat: minor visual changes to the apps-overview page (#14090)
* feat: minor visual changes to the apps-overview page

* fixup! feat: minor visual changes to the apps-overview page
2022-07-12 08:30:00 -05:00
David Girón
94d435eff1 Search device by MAC via URL (#14072)
* Search MAC by GET

* Add address from parsed vars

* Trim tabs and spaces when searching MAC
2022-07-09 04:51:07 -05:00
David Girón
46899d1643 Custom OID processing of numeric strings with filters (#13968)
* Custom OID processing of numeric strings with filters

* Fix syntax

* Refactor ajax customoid code
2022-06-10 16:24:50 -05:00
Kevin Wallace
1b1859051f Add additional OpenBSD PF graphs (#13963)
* Add additional OpenBSD PF graphs

Some of these were already present for PFSense (matches, badoffset,
fragmented, short, normalized, memdropped) and reuse existing graph
types; the others are are added as new types.

* collect-snmp-data.php: support IPv6 hosts

* Add SNMP data for new OpenBSD OIDs

* Stack all OpenBSD PF drops into a single graph/rrdfile

* Pull additional drops in to pf_drops

The MIB descriptions don't say "drop", but reading the OpenBSD source:

c471a73b65/sys/net/pfvar.h (L1196)

it's clear that badoff, frag, short, and norm are all drop reasons.
Pull them in into the stacked drop graph, too.

* ./scripts/save-test-data.php -o openbsd -v pf

* Include device_graphs in saved os module test data

* Revert "Include device_graphs in saved os module test data"

This reverts commit a85c902fe9.

* Update to use SnmpQuery

Co-authored-by: Kevin Wallace <kevinwallace@users.noreply.github.com>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-06-06 23:49:42 -05:00
Tony Murray
32f1ce494e Dashboard code cleanup (#13996)
* Dashboard Cleanup
Remove static widgets table, list of available widgets should not be in the database.
Remove legacy ajax scripts
Cleanup and reorganize controllers

* reorganize code to put all dashboard things into it's controller
better url scheme while supporting the original

* lint clean ups

* properly formatted language file

* style fixes

* update schema
2022-05-31 08:08:40 -05:00
Chris A. Evans
5a085f79e5 Feature: Add support to REST API for creating Maintenance Schedules for Device Groups (#13985)
* Add support to REST API for creating Maintenance Schedules for Device Groups

* Update documentation to include the maintenance_devicegroup API endpoint

* Fix quotes

* Fix whitespace

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-05-27 10:38:47 -05:00
sajiby3k
a7147a17e1 Submitting change to oxidized group api to include device purpose or device notes (#13976) 2022-05-14 12:13:44 -05:00
Zane C. Bowers-Hadley
3da935a3e6 variable fixes (#13956) 2022-04-29 07:41:23 -05:00
Zane C. Bowers-Hadley
cdf457fbc5 add Suricata monitoring (#13942)
* add poller

* add a generic alert graph

* add support for .total

* add the initial work on the suricata app page

* add applayer flow sources

* more rrd work and add more fields

* add a missing graph to the suricata page

* add suricata to the apps page

* all working now for suricata

* add some suricata alert examples

* all done with the php

* update the application docs for Suricata

* add another note about Suricata stats in the docs

* add the test file

* add the test JSON

* remove a unneeded newline from the appication docs

* correct the type uptime type

* packets graph should by packets/sec

* minor formatting cleanup

* one more minor formatting cleanup

* shot in the dark to see if something fixes the angry linter

* fix snmpsim file

* add metrics

* add values to the metrics

* add a missing comma to the json

* add a missing line to snmprec and cleanup json a bit

* a few more minor changes to see if this makes it happy... regened via scripts/json-app-tool.php

* see if this will make it happy

* add suricata to app discovery and hope that fixes it... take a shot in the dark as to why the linter errors strangely on two of the files

* fix json

* add a missing ] to the json

* rename two graphs so it does not trigger one alert and add a missing metric

* whoops, *_alertString is not a metric
2022-04-25 20:30:49 -05:00
Tony Murray
f024ce5405 Improve alert template saving (#13910)
Instead of checking if the result is empty to see if the template parses, just catch exceptions.
2022-04-14 18:29:29 +02:00
Tony Murray
0a84098211 Port Validation Page to Laravel (#13921)
* Revamp validate web page
 to load page then validate, instead of validate then load page

* style fixes

* lint cleanups

* fixes

* translations and a couple fixes

* style fixes

* move result serialization into the class.
2022-04-14 11:22:40 -05:00
ottorei
e495769f17 Add ISIS-details to alert details (#13920)
* Add ISIS-details to alert details

* Apply fixes from StyleCI

Co-authored-by: StyleCI Bot <bot@styleci.io>
2022-04-14 00:36:13 -05:00
Tony Murray
5d0670cdf6 Fix port mini graphs (#13911)
* Fix port mini graphs

* fix whitespace

* taller
2022-04-12 16:30:22 -05:00
Mark Westerterp
971404f416 Added "Ping Response" graph to "Ping Only" Device Overview page (#13886)
* Add Ping performance to Device Overview page

Only if device type is "Ping Only"

* Re-use $perf_url
2022-04-03 14:15:23 +01:00
Claude Brown
958556dc18 Ensure 'add_device' API returns indexed-array (as per documented behaviour) (#13887) 2022-04-03 14:03:03 +01:00
Lucas Dousse
427438a08f remove fixed size for vendor column (#13881)
* remove fix size for column mac adresse

* remove fix size for column mac adresse in port arp tab
2022-03-31 15:43:29 +02:00
Jellyfrog
4df7968d81 Fix SQL injection in get-host-dependencies (#13868)
Thanks to raf at TNP Consultants for reporting it
2022-03-23 21:39:24 -05:00
Tony Murray
8df92a5f2b API: device_add support display field (#13846)
* API: device_add support display field
remove legacy code path
update docs
A few improvements to the new code too

* some fixes, port_association_mode was not available

* hand version -> snmpver translation
2022-03-15 06:54:02 -05:00
Neil Lathwood
369617ffa1 Fixed displaying hostname in create bill when port is passed (#13830) 2022-03-14 23:38:59 +00:00
Gene Dela Rosa
85b19ce99e Add configuration support for IPMIv2 Kg key (#13845)
* Add support for IPMIv2 Kg Key in device settings

Some devices require that the Kg key be specified. An example would be a server of mine, a Cisco C220 M3. 

Otherwise, it would error out with `Error: Unable to establish IPMI v2 / RMCP+ session`. 

With verbose output enabled, the connection attempt would stop at `RAKP 4 message has invalid integrity check value`.

* Add Kg key support in Poller

* Sanitize Kg key from debug output

* Added Kg key support for discovery process

And it seems to work like a charm. New fields, such as fan tachometers, were added in automatically.

* Applying StyleCI changes
2022-03-13 22:51:55 +01:00
Tony Murray
1bfd411995 New device:add code (#13842)
* New device:add code
pre-requisite for updating other code paths
includes option to set display name
separate validation code from device creation

* remove duplicate community and v3 creds

* style fixes

* some lint fixes

* fix phpstan

* Exception cleanup
improved messages and translations

* port association mode to enum
well, pseudo enum

* defaults and cleanups

* fixed/improved validation messages

* fix tests

* fix stupid ide refactor mistake

* lint fixes
2022-03-12 16:14:32 -06:00
Tony Murray
6d3bf03074 Display Name in availability map (#13841)
* Display Name option in availability map widget

* fix availability map page and shortDisplayName
2022-03-12 16:14:09 -06:00
Josh Silvas
a9e111f3eb Adds API call to update port notes on devices. (#13834)
* Adds API call to update port notes on devices.

* Lint fixes.

* Fixes file permissions to proper values.
2022-03-10 22:29:08 +01:00
Charly Forot
48e68ec1dd Fix class error name (#13833)
Mistake on $class variable, value was 'er' instead of 'ber'.
This error prevented the ber graph located at Devices->Health->Overview
to correctly appear.
2022-03-09 00:06:19 +01:00
Neil Lathwood
703745d0ed Resolved XSS issue from alert rule list modal (#13805) 2022-02-22 08:28:31 -06:00
Joel Wilson
2e5b343731 Add usage hints for Display Name placeholder usage (#13801) 2022-02-20 12:59:53 -06:00
Mark Westerterp
1df78d9503 UI: Fix second menu bar in Apps screens (#13800)
* Fix bug introduced in 2016
Introduced when changing over from tables to divs.
Caused by commit: bda31d7152

* Apps: bring second menu bar in line with main menu
Scope limited to applications

* Style fixes
2022-02-18 09:19:36 -06:00
PipoCanaja
6ac13825ce Improved search results for port descriptions (#13787)
* restore pre Dec 6 2021 Description display

* restore full ifAlias

* patch from fbourqui to fix type display
2022-02-17 20:57:51 +00:00
PipoCanaja
f24bb42cb2 Hide community and make it XSS safer (#13783)
* sanitize message display

* sanitize message display

* safe display of community, and community hidden until focus occurs
2022-02-14 13:03:01 +00:00
Neil Lathwood
95970af78e Moved some pages to be within admin route (#13782)
* Moved plugin admin pages to be within admin route
* Wrap html transports page in admin check
* Moved Port group controller to be admin protected
* fixed tests
2022-02-14 08:40:30 +01:00
PipoCanaja
4c9d4eefd8 XSS fixes (#13780) 2022-02-13 20:54:58 +00:00
PipoCanaja
41ddce6377 XSS fix, cont. again (#13778)
* XSS in alert template creation

* XSS in alert rule name

* XSS in service name & desc

* style

* strip_tags in alert_notes

* strip_tags in create_alert_item

* strip_tags in addsrv page
2022-02-13 20:23:07 +01:00
Peca Nesovanovic
0029e9f161 [refactor] Eloquent for includes/html/pages/device/health.inc.php (#13777)
* [rewrite] includes/html/pages/device/health.inc.php
* translate sensor names
* ci
2022-02-13 19:20:47 +01:00
PipoCanaja
4f86915866 XSS fix, cont. (#13776)
https://huntr.dev/bounties/13951f51-deed-4a3d-8275-52306cc5a87d/
2022-02-13 19:07:37 +01:00
PipoCanaja
135717a9a0 security - XSS Fix 01
fixing https://huntr.dev/bounties/114ba055-a2f0-4db9-aafb-95df944ba177/ (#13775)
2022-02-13 11:00:56 +01:00
Santiago Z
7d2ade71f1 [WebUI] Show selected selection option on graphs page (#13765) 2022-02-11 11:06:41 +01:00
Jellyfrog
b9e55bc462 Upgrade to font awesome 5 (#13754)
* Upgrade to font awesome 5

* Update memory icon
2022-02-09 00:49:07 +01:00
ilGino
58c88a6db3 [WebUI] Removing colon symbol from multiple dialogs (#13742)
* [WebUI] Removing the colon symbol from dialogs

In order to make multiple pages more visually consistent with other pages in the system, removed the colon simbol ":" to the very right of each control description, where present.

Regards
GG

* Update new_alert_rule.inc.php

* Update alert_schedule.inc.php

* Update alert_template.inc.php
2022-02-03 15:51:51 +01:00
Santiago Z
b93a892feb [WebUI] Added the word Actions in the header of the oxidized-nodes table (#13741) 2022-02-02 02:07:35 +01:00
Tony Murray
29bd6789cb Stp module rewrite (#13570)
* STP module rewrite WIP

* Finish rewrite

* Ignore disabled and log root/topology changes

* Remove interfaces for now

* fix style

* Lint fixes

* Document ResolvesPortIds and hide map functions

* whitespace fixes

* Revert to stpInstances in case someone writes mstp support

* missed one

* phpstan fixes

* Handle table and oids separately

* forgot to register observer

* Test data and correct non-table handling in SnmpResponse->table()

* update test

* test data

* revert aos7 silly things

* minimal polling

* Update test data

* order ports_ntp and rename new field to port_index

* forgot the db_schema

* revert ciena-sds port things

* MSTP support, maybe

* Adding test data

* Filter bad lines instead of discarding the entire snmp response
and capture fixes and test data

* fresh data

* add os data

* update data, ignore unfound ports, obviously bad device implementation.

* fixes

* Ignore context files in os detection test

* Remove empty table data

* add ciena-sds vlan

* designatedCost column is too small

* Update stp webui

* Refactor code to interfaces, to allow vendor mibs

* update schema

* fix issues added by abstraction

* STP fixes

* Default to no context for vlan 1

* never store vlan 1

* Update test data

* remove eltex brokenness

* fix style

* fix stan

* Fix Rewrite MAC to Hex padding with floats

* fix sqlite migration
2022-01-30 16:28:18 -06:00
Tony Murray
b6a8b602b8 Oxidized update and Device remove (#13730)
* Oxidized + Device remove
Was just working on oxidized, but then to properly update nodes after delete, updated delete_device()

* revert dumb style changes

* baseline update and no DI there...

* Fix OS first load and device deletion missing tables
2022-01-29 21:09:05 -06:00
ilGino
d2d07b8c88 Place a more consistent Fontawesome icon for the Export to PDF (#13713)
In Alerts >> Alert History

1 - reword "Export to pdf" to "Export to PDF"
2 - replace the Fontawesome Heartbeat icon with the Fontawesome File to PDF icon.

Regards
GG
2022-01-26 22:43:22 +01:00
Jellyfrog
1debe5e166 Use built in method to render a string with Blade (#13688) 2022-01-26 07:10:06 -06:00
ilGino
20495d648c [WebUI] 2/2 Services - Removing the colon symbol to the right of a control label (#13705)
In order to make the Services Add or Edit pages while adding a Service more visually consistent with other pages in the system, removed the colon simbol ":" to the very right of each control description, where present.

Regards
GG
2022-01-24 22:20:14 +01:00