Commit Graph

99 Commits

Author SHA1 Message Date
Tony Murray
f296464dae
validate.php proper exit code (#16274)
some fixes around database & poller checks
2024-08-08 20:00:56 -05: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
Jellyfrog
670f964e98
Validate: use "database version" instead of "mysql version" (#14158)
* Validate: use "database version" instead of "mysql version"

* wip

* wip
2022-07-29 11:36:18 -05: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
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
Tony Murray
df5096e449
Install: Validate database before migrating (#12867)
* Validate database during install
Needed to remove usages of legacy functions in the validation

* Fix output, restore real versions
2021-05-13 07:18:54 -05:00
Tony Murray
a3635d0b73
remove unused openssl_ver (#12378) 2020-12-03 09:33:26 -06:00
Tony Murray
2b59ff5fda
Add system validation (#12337)
validate lnms link and completion
validate log rotation file is installed
2020-11-23 09:46:22 -06:00
Tony Murray
aded238299
Do not run validate.php as root (#12327) 2020-11-19 22:41:32 +01:00
Hans Erasmus
6c4596d1b9
Added new authalgo support for SNMPv3 (#11966)
* Added new authalgo support for SNMPv3

* Update 2020_07_27_00522_alter_authalgo_column.php

Fixed case

* Update addhost.inc.php

Fixed case

* Update snmp.inc.php

Fixed case

* Update db_schema.yaml

Fixed case

* Fixed SHA-* order to ascending

* Update 2020_07_27_00522_alter_authalgo_column.php

Fixed space

* Update db_schema.yaml

Fixed line to be of type string

* Update config_definitions.json

Fixed sorting

* Fixed test file case sensitivity

* Fixed rollback function

* SourceDoctor code for checks

* Fixed indentation issues on Travis test

* Update to re-trigger testing stuck on CLA step

* Added crypto-algo updates

* Incorporated suggestions from Jellyfrog

* Added documentation entry

* Fixed travis spacing error

* Fixed validations

* Delete snmpv3_version_compare.patch

Sorry, this one was not supposed to be there.

* Added poller evaluation

* Added poller comparison

* Fixed merge-conflicts

* Fixed typo in test unit

* code refinements
only can check on webui that it supports the algorithms, hopefully, the eventlog is enough to notify users of distributed pollers.

* style fixes and remove openssl setting

* fix device access

* fix missing migration column

Co-authored-by: Tony Murray <murraytony@gmail.com>
2020-10-29 13:02:26 -05: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
Tony Murray
5b27431f8b no need to warn if config.php is missing 2020-06-28 22:37:44 -05:00
Tony Murray
23c33f753f WIP validation cleanup missing config 2020-06-27 22:57:29 -05:00
Tony Murray
5f0388f0e3 Remove DB credentials from config.php
Better validation when config.php does not exist

Update docs and quote password

only populate legacy vars in config_to_json
drop .travis.yml config copy
remove credentials from config.php.default

Check for existance of .env instead of config.php in python scripts

legacy credential cleanup

tiny cleanups

consistent env for artisan server and artisan dusk
2020-06-27 07:47:08 -05:00
Tony Murray
d75d628a53
Validate autoload first (#11785)
* Validate autoload first

* missed
2020-06-06 23:49:03 -05:00
SourceDoctor
e170529692
Python3 Module Dependency Check (#11544)
* Python3 Modul Dependency Check

* code climate

* binary existance check

* move Python Modul Version Check

* .

* adding verbose argument

* args parser nicement

* enhance Validator for detailed approvements

* Update Python.php

* Update check_requirements.py

* python version to Version class
use Process

Co-authored-by: Tony Murray <murraytony@gmail.com>
2020-05-06 10:58:17 -05:00
Tony Murray
6576a6c807
fix validate using non-builtin functions too early (#11436)
* fix validate using non-builtin functions too early
2020-04-18 17:55:48 +02:00
Tony Murray
1c08c11a77
Remove Laravel helpers (#11428)
* Remove Laravel helpers

* Replace qualifier with import
2020-04-18 00:37:56 +02:00
Tony Murray
67f3d889b9
Only check depedencies once in validate.php (#11316)
* Only check depedencies once in validate.php

* Update librenms-service.py
2020-03-23 09:05:18 -05:00
Tony Murray
f3ba8947f7
Use Config helper (#10339)
remove usage of global variable
2019-06-23 00:29:12 -05:00
Tony Murray
c7c7b57de4
Always boot Laravel (#9842)
* Always boot Laravel
That way we can depend on it being available.
Saves us crashes if some code accidentally uses something that isn't booted and a lot of silly if/elses.

* ignore init php errors
2019-03-14 08:06:27 -05:00
Tony Murray
59d4dc5490
fix whitespace (#9703) 2019-01-19 12:04:49 -06:00
Tony Murray
b32a68dbfa
Fix validate error (#9700)
* Fix a couple install issues
validate failing too early caused an class not found error
return success in the db update output

* revert db-update changes, for separate PR
2019-01-19 09:27:00 -06:00
Paul Heinrichs
ebe2ecf524 Laravel migrations (#8868)
* Add migrations and seeds

* Fix spacing validation issues

* Fix linting

* Update tabs to spaces

* Update daily and install process

* Make build-base.php use the new migrations if empty or at dbschema 1000.
Seed 1000 into the database.
Temp fix for the route table index length (this table basically isn't used...)

* Fix typo in seed.
Hard code legacy schema checks to version 1000 (999 would have worked as is)

* Port association table no longer exists

* Make database validate again

* DB schema, remove as many DB::statement as possible

* update migrations
add librenms cli entry point (artisan)
update validate to check laravel migrations

* remove statements from users migration

* Fix up daily.sh and the 1000 migration

* Update migrations to current state
Take advantage of environment variables to set DB credentials.

* Fix style issues

* Update schema

* fix test db collation

* Fix migration table definition

* update db migrations

* Update migrations

* Update stats callback.  Just count the total migrations applied.

* Update 1000.sql.

* update migrations

* remove the graph type seeder, it is no longer needed

* update docs

* fix whitespace

* remove extra schema

* update tests

* fix sort

* add message

* dbSchema should actually be 1000

* add character set to db create

* Fix some artisan issues

* Update schema
2019-01-14 06:44:23 -06:00
Tony Murray
607a567090
Don't check file permissions on every request, handle failures (#9264)
* Don't check file permissions on every request, handle failures
Improve error page visually

* only print minimal mkdir

* invert file_exists check, whoops

* docblock

* revert accidental changes

* rename variable

* Change database errors to use the new layout

* Add support url to the default layout

* Replaced \n for && in fix for user perms

* fix web output
2018-10-18 21:08:46 -05:00
Tony Murray
06a7cb2412 Fix a couple of validation items (#9154)
- Ignore .pki/nssdb. This happens when /opt/librenms is set as the home directory of the librenms users, personally, I would suggest adding cd /opt/librenms in ./bashrc (or equivalent) instead.
- fix validate when db connection fails.

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-09-05 19:29:27 +01: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
Tony Murray
3c3fbd3731 feature: Show composer status in web validate. (#8181)
* Show composer status in web validate.
Don't duplicate in validate.php

* Create variable to check if a group has been completed.
No longer skips database checks.
Extract a base class.
Fix locate_binary and find_executable issues (mostly exposed by lack of db)

* Update Validator.php
2018-02-27 15:57:20 +00:00
Tony Murray
561846a44b fix: Fiedx issues with new config init (#8242)
* Fix non-config defaults

* update processConfig and remove file
2018-02-12 09:15:44 +00:00
Tony Murray
f43e23e15a
Restore vendor contents even if composer is not available (#8223)
* Restore vendor contents even if composer is not available
Leave the code in both places for safety.

* Instruct users to use the wrapper instead of straight up composer...
2018-02-07 20:45:18 -06:00
Tony Murray
6878df8c12
Prep for composer changes (#8075)
* Prep for composer changes

* Update composer.json, composer.lock and a small update to phpmailer and Yaml

* Prevent accidental `composer update` runs

* Add  --no-interaction to daily.sh
2018-01-22 08:16:37 -06: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
Neil Lathwood
529660b8c5 docs: Updated docs to include installing xml php modules + updated validate (#7349) 2017-09-15 19:29:54 -05:00
Tony Murray
dc110d2d97 fix: Do not issue non-master warning if on the release update channel (#7297) 2017-09-07 09:18:19 +01:00
Neil Lathwood
f2c69f35d0 refactor: Updated validate.php to only warn users the install is out of date if > 24 hours (#7208)
* refactor: Updated validate.php to only warn users the install is out of date if > 24 hours

* Fix 24hrs, not 48hrs
2017-08-24 06:28:59 +01:00
Tony Murray
1d777693e1 feature: New IP parsing classes. Removes usage of Pear Net_IPv4 and Net_IPv6. (#7106)
* Refactor remove use of pear Net_IPv4 and Net_IPv6

Caution, I added tests to test the functionality of the new functions, but I'm not 100% certain the replaced usages match 100%.  Please test.

Left usage in generate-iplist.php because I'm not sure the use of that script, so I didn't want to implement additional functionality to support it.

Add support for ipv6 fo ipInNetwork() function

Add phpdocs to functions
Remove accidental inclusion

Use binary operations instead of string for networKFromIp()
Tidy up binary operations in ipInNetwork()

tidy parsing cidr network

Change to a class based implementation.

Update phpdocs.
Fully catch exceptions for hex parsing.

Fix mistake.

support older phpunit versions

Fix php shifting to negative with php 5

* Fix graph authorization. Uncaught exception and checking an ipv4 against an ipv6 network == fail.

* Also remove colons from hex strings.

* Fix typo in bgp polling
Two passes of removing invalid characters from hex strings. (That way we don't mangle valid IPs)
2017-08-08 14:14:58 -05:00
Tony Murray
1e77d4b3ea refactor: validate.php improvements (#6973)
Always output header (may be missing mysql data)
Improve version display, now looks like '1.28-129-g74e6c3edf' <tag>-<commits since tag>-<shortag>
Add mysqli to the list of required extensions, check extensions before init
Add dbIsConnected() function, used to check if we have db in version_info()
Do not die on IPv4 and IPv6 so validate can print errors.
Move git checks so they are output together
fix rrdtool 1.7.0 reports version as 1.7.01.7.0
2017-07-17 19:02:28 +01:00
Tony Murray
74e6c3edf5 feature: ignore web server log files ownership in validate (#6943) 2017-07-03 22:17:07 +01:00
Neil Lathwood
573a4b0e62 Updated validate to detect lower case tables + added support for checking mariadb 10.2 timestamps (#6928)
* Updated validate to detect lower case tables + added support for checking mariadb 10.2 timestamps

* updated install docs
2017-07-03 15:46:45 -05:00
Tony Murray
ebdfbd00d8 fix: validate prefer capabilities over suid for fping (#6644)
* fix: validate prefer capabilities over suid for fping

* fix logic
2017-05-15 23:45:02 +01:00
Neil Lathwood
069020cb80 updated rrdtool ver check to wrap quotes around (#6393) 2017-04-11 07:04:25 +01:00
Neil Lathwood
5ce9b6b2e8 feature: Added rrdtool version check to compare installed version with defined version (#6381)
* feature: Added rrdtool version check to compare installed version with defined version

* update to check config is not > than installed ver
2017-04-10 08:11:56 -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
Tony Murray
907a601c1d Fix an issue with table creation (named indexes merged) (#6366) 2017-04-05 11:19:22 -05:00
Neil Lathwood
03deb6434a feature: Added ability to validate database schema (#6303)
* feature: Added ability to validate database schema

* small scrut fixes

* Check for extra tables and columns
Print 30 items of schema updates, easier to copy paste sql

* Now supports detections and suggested fix for:
tables: missing, extra
columns: missing, extra, incorrect
indexes: missing, extra, incorrect

* final changes + hook into travis
2017-04-05 09:00:28 +01:00
Tony Murray
a2115458af fix validate wrong comparison (#6242) 2017-03-22 22:13:40 +00:00
Tony Murray
5d5c3d8887 Check for devices before checking discovery and poller (#6217)
Use the pollers table to check poller last run
Don't rely on all poller entries being valid, we never remove entries from that table.
2017-03-22 08:14:03 +00:00
Neil Lathwood
dad2a5e9cc Updated bitly link in validate and updated docs to use pastebin service (#6179)
* replaced bitly link

* updated docs for adding new OS
2017-03-12 21:21:26 -05:00