Commit Graph

42 Commits

Author SHA1 Message Date
Olen
a8ca361acd Add missing setting of channels to join (#12160) 2020-09-29 23:12:09 -05:00
Olen
aada69cd64 IRC Add more logging and debug info (#12140)
* Add more logging and debug info

* Code cleanup

* Code cleanup take two
2020-09-23 13:38:42 +02:00
Olen
0f272e342e IRC: Don't set nick on each tick (#12139)
* Trying harder to regain nick

* Code cleanup

* remove extra nickchange
2020-09-22 19:29:54 +02:00
Jellyfrog
41729d72eb Apply fixes from StyleCI (#12142) 2020-09-22 14:48:51 +02:00
Olen
944d7c9ef9 List external commands in help. Allow reload of external commands (#12137) 2020-09-22 14:34:01 +02:00
Olen
4023baf899 Increase the read-buffer as 64 bytes can be a little small (#12136) 2020-09-22 14:32:08 +02:00
Olen
9abec91cfd Remove unused "irc_chan". Renamed to "irc_alert_chan" (#12135) 2020-09-22 14:31:39 +02:00
Olen
19aaf43605 Add some variables to the init of the class (#12134) 2020-09-22 14:30:54 +02:00
Jellyfrog
29f45ca352 Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
Jellyfrog
77c531527c Apply fixes from StyleCI (#12117)
* Apply fixes from StyleCI

* Disable style check
2020-09-21 14:54:51 +02:00
SourceDoctor
b89eb22cd5 Enumerate AlertState (#11665)
* Enumerate AlertState

* fix typo

* add missing use's

* .

* .
2020-05-23 21:14:36 -05:00
Jellyfrog
b361710148 Device group based access (#10568)
* Device group based access

* Use Permissions class to resolve permissions

Also give port access based on device access

* Convert more pages to use Permissions class

* shorten config setting name
use Eloquent relationships in several places
alphabetize config_definitions.json

* Change Models and Permissions

* Clean up ajax_search LIMIT sql

* Convert more pages to use Permissions class

Co-authored-by: Tony Murray <murraytony@gmail.com>
2019-12-30 12:11:26 +01:00
Tony Murray
699aa8a042 Consolidate configuration settings and implement dynamic webui settings (#9809)
* initial db/defaults dump

* numeric values

* Remove $config['time']

* Use config_definitions.json

* try setting definition as a complete array

* a little more

* fix format

* WIP converting dynamic setting pages

* rewriting the webui

* remove legacy and add translations

* finish email section

* improve navigation
update js a bit

* Import the remaining existing settings

* Update backend still some wip
migration

* fix config loading (db not overriding defaults)

* some cleanup

* more array collapsing

* update settings

* Settings search

* add purge settings to ui, order groups and sections

* collapse more arrays

* Auth definitions WIP

* remove needless slash escapes

* add warning to json

* moving settings from defaults.inc

* remove slow_statistics

* Move rrdtool settings to the poller section

* Use translations more consistently

* removing more settings from defaults.inc.php

* show setting name in tooltip

* allow help text to be shown on mobile

* disable settings that are set in config.php

* Implement undo and reset to default.

* Vue.js functional

* Vue.js WIP

* Implement tabs component

* accordion WIP

* lodash ver update

* two items

* Accordion somewhat working

* hash navigation

* Refine Accordion

* Fix up tab styling a bit

* Cleaner tab selected property
Hide html while loading

* spinner?

* Icon support
property for accordion to active

* WIP

* Tabs/Sections from ajax

* Setting Component skeletons

* Dynamic Component resolution

* Basic functionality

* toggle class

* Refactor components

* translate tabs and accordions

* simple array attempt

* improve readonly tooltip

* array styling

* array value editing

* organize snmp info

* Handle initial tab/section in url

* Use Laravel to parse tab/section, dump old

* Draggable array entries

* v-tooltip, for clickable (and touch) help tooltips
disable draggable

* Navigation WIP

* Navigation WIP

* groups computed

* filter settings

* fix event reference

* vue.js i18n initial

* missing description = just setting name

* en fallback

* tidy up the language support and js generation

* persist value to db

* fix issue with 0

* Delete settings from DB instead of setting them to default

* ldap-groups
fixup style

* Default dashboard selection

* fix array of options instead of object

* allow custom validation for settings

* translate options in SettingSelect

* SNMP v3 WIP

* fix setting arrays

* Split persist out of set

* Hook up events for SNMP v3 Auth
correct Config::persist behaviour with arrays

* dependent settings (primitive for now)
actually update the settings values in the LibrenmsSettings component

* more complex "when" behaviour

* remove un-needed seeder

* add poller_modules.cisco-qfp

* remove en.json (disable warning)

* don't set default for log_dir or log_file, otherwise it won't be processed correctly

* Fix module order
add some missing settings

* more config corrections

* correct graphs
correct loading values set to null (although it should have no difference)
remove project_name_version

* Add nfsen settings.  Docs are very confusing, so might have flubbed something
remove option for array definition of select option as numeric indexes messes it up

* Correct more upstream config differences

* Config cleanup after a bunch of merges.

* Fixes

* add version tags to js/css files
remove old js

* Print out full settings list read-only

* Add http_proxy setting
fix indents in config_definitions.json

* repeaters default is 0 (aka 20)

* cleanups

* rewrite the dynamic config docs

* add language docs

* Don't show snmp v3 auth add/remove if disabled by config.php
2019-10-16 21:22:05 +00:00
Tony Murray
63442e8b4a Refactor tests (#10625)
* 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
2019-10-13 13:40:38 +00:00
Tony Murray
f3ba8947f7 Use Config helper (#10339)
remove usage of global variable
2019-06-23 00:29:12 -05:00
Tony Murray
8ce81f2423 Update database schema display (#9708)
* Update database schema display

* handle missing migrations table
2019-01-22 06:47:07 -06:00
Tony Murray
daffa7e274 Eventlog updates (#9633)
* Eventlog updates
remove host from eventlog table, retain in api
allow most fields nullable

* updated schema

* revert auth for legacy log_event function
safer check in the model

* add function modifiers
2019-01-10 00:52:00 -06:00
Tony Murray
32a7c50189 Use Laravel authentication (#8702)
* 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
2018-09-11 07:51:35 -05:00
Tony Murray
a2e33efba8 Use PDO for MySQL queries (#8935)
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`
2018-08-17 21:29:20 +01:00
Tony Murray
d841625f12 refactor: Refactor database and config init (#8527)
* 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.
2018-04-11 16:15:13 +01:00
Arzhel Younsi
7eda8d9989 feature: Added a irc_alert_short option to only send the alert title (#8312)
* Add a irc_alert_short option to only send the alert title

* Add doc for 'irc_alert_short'
2018-03-02 17:52:47 +00:00
Tony Murray
cdf5b05934 Replace usages of array_combine() that match array_by_column() (#7863)
Also, fix up some usages where just array_column() will do.
2017-12-06 08:19:29 +00:00
mcq8
c9728a1f71 refactor: Refactored authorizers to classes (#7497)
* 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
2017-11-18 10:33:03 +00:00
Tony Murray
44cb59d54e refactor: Rewrite a bit of the irc bot (#7667)
also, use the appropriate dbFetchCell()
2017-11-07 20:30:59 +00:00
zapotah
fcbd3a0dff Fix ".status services" to show properly possible status codes (#7663)
* Fix ".status services" to show properly possible status codes

Nagios plugins return 0-3 as the status-code for a check. This adds "warning" and "unknown" to the output as well as hierarchical color for the total.

* Fix ".status services" to show properly possible status codes

Nagios plugins return 0-3 as the status-code for a check. This adds "warning" and "unknown" to the output as well as hierarchical color for the total.
2017-11-07 09:19:18 -06:00
zapotah
ad739252a2 fix: Fixed status services up/down inverse values for IRC Bot (#7657) 2017-11-06 22:11:36 +00:00
Tony Murray
51ba934e11 feature: Added web validation (#7474)
* refactor: convert validations to modules to prep for gui integration

* accidentally dropped, schema update

* fix accidental output to webui

* mention discovery-wrapper.py and re-arrange.

* refine some fix statements

* rename the Config validation group to Configuration.

* fix some scrutinizer issues
remove as many local functions from validator.php as possible
move extensions from pre-check
remove duplicate timezone check
looks like there is some db schema differences between mariadb 10.1 and 10.2, investigating

* mariadb version diff take2

* Check schema version first for database.
Remove stop to go back to command line for install docs.
Add helpful link when there is no devices added to /addhost

* fix incorrect validation for empty string defaults

* Fix style

* Add additional file permissions checks

* catch exception and fail for invalid timezone
Change visuals a bit.

* add php version warning

* fix space
2017-10-26 07:56:09 +01:00
Olen
3dd6628101 alerts: Updated Irc transport to use templates (#6758)
* Use templates also for irc-alerts

* Remove old code

* Make messages to admins (nicks) use the templates as well

* Added a "strip_tags" to remove html-tags from the irc-messages
2017-06-08 19:26:24 +01:00
Olen
4b15713f69 fix: a few issues with colors (take two) (#6787) 2017-06-06 06:42:49 -05:00
Olen
127c4b84bd feature: Added Irc ctcp support to IRCBot (#6766)
* Handle basic CTCP-support

* Add an option to toggle ctcp on and off in the config

* Fix whitespace-issue

* Fix null/NULL

* Updating docs, default config and fixing a few whitespace-issues

* Fixing the last whitespace-issues.  Now with "pre-commit.php" as a standard...
2017-06-05 22:45:18 +01:00
Olen
c8e3738fbb feature: Added support for nick conflicts + reload losing install_dir path (#6775)
* Generating random nick on conflict, and trying to regain our original nick when it gets available

* Also fixes a bug where $config['install_dir'] gets lost on .reload

* ...And adding a few QUIT-messages for brewity
2017-06-03 12:39:20 +01:00
Olen
43e135ee03 feature: Added Irc host authentication for irc-bot (#6757)
* Allow irc-users to be authenticated by hostmask i config.php

* Fix some whitespace and a small typo

* Refactored the code a bit. Checking if user is already authd before matching on hostmask

* Updating docs

* Add missing " to docs
2017-06-02 21:27:29 +01:00
Olen
d4bd4b8862 feature: Added some more coloring and make it easier to colorize messages for irc bot (#6759)
* Add some more coloring and make it easier to colorize messages

* Refactor "_color"-function

* Fix missing )

* Use _color() also in alerts

* Fix some standard-errors
2017-06-02 20:07:09 +01:00
Olen
7984696281 fix: ircbot - reformatted strikethrough for recovered alerts (#6756) 2017-05-31 09:05:06 -05:00
Tony Murray
b1a414e785 feature: support non-standard unix socket (#5724)
* 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
2017-04-06 22:02:37 +01:00
David Bell
5dd030f438 refactor: Added config option for database port (#5517) 2017-01-27 23:16:04 +00:00
Neil Lathwood
c3140218b3 fix: Fix irc bot user level (#4833) 2016-10-20 17:53:49 +00:00
Neil Lathwood
9e85f24b00 fix: Make irc bot to use authentication module for user info (#4372) 2016-09-12 11:24:22 -05:00
deutor
50a02a0fc5 refactor: IRC bot .version response (#4355)
* IRCbot more verbose .version response

* Using local_sha instead of git call

* Corrected substr starting position
2016-09-07 07:33:24 +01:00
deutor
7afbb6455f feature: IRCBot re-connection back-off (#4322) 2016-09-03 08:54:37 -05:00
Tony Murray
abc6a5b799 PSR-2 Final cleanup (#4247)
refactor: Final PSR2 cleanup
2016-08-28 23:32:55 +01:00
Tony Murray
aadd627863 Move IRCBot class to LibreNMS namespace. (#4246)
refactor: Moved IRCBot class to LibreNMS namespace #4246
2016-08-28 21:53:52 +01:00