Commit Graph
1103 Commits
Author SHA1 Message Date
Lucas Manuel Rodriguez 371c533bfc Improved Datastore usage of osquery hosts requests (#3601)
* WIP

* Amend tests

* Do not load aggregated stats for packs

* Add option to host lite

* Fix remaining TODOs

* Fix osquery_utils tests

* Fix SQL

* Fix SQL (bis)

* Restore AuthenticateHost to load once

* Code improvements and re-add deferred host save

* More fixes to the PR

* Wrap users table update on tx

* Add caching to ListPacksForHost and ListScheduledQueriesInPack

* Remove SaveHostSoftware (replaced by UpdateHostSoftware)

* Add unit tests for new functionality

* Add changes file

* Fix scheduled queries test
2022-01-17 22:52:09 -03:00
Martin Angers c335272de2 Fix failing policy sets for redis cluster mode (#3725) 2022-01-17 15:16:54 -05:00
Martin Angers 1f185a7a8b Refactor async host processing to avoid redis SCAN keys (for labels only) (#3639) 2022-01-17 14:53:59 -05:00
Zach Wasserman 72fc9dc524 Remove unused request-id in context (#3632)
This seems to be left over from the older authorization system in Fleet.
I couldn't find any other reference to the `request-id` in the code.
2022-01-13 14:12:56 -08:00
gillespi314 dc8eacc95c Add AvailableTeams to loginResponse and getUserResponse (#3585) 2022-01-13 13:57:44 -06:00
gillespi314 6952653e1b Fix usage stats to send missing numLabels field (#3606) 2022-01-13 11:11:13 -06:00
Tomas Touceda 4bed4757fb Remove cleanups and fk for host ids (#3607)
* Remove cleanups and fk for host ids

* Readd missing things to the schema

* Remove unused

* Add changes file and fix some error messages

* Fix test

* Use tx instead of plain writer

* Other fixes

* More not found test fixes

* Go back to getcontext
2022-01-12 14:07:51 -03:00
Tomas Touceda 312bd840a2 Detect not found errors for queries and policies (#3595)
* Detect not found errors for queries and policies

* Fix test
2022-01-12 10:04:16 -03:00
Lucas Manuel Rodriguez 49ceee59aa Add fixes for running tests with mysql:8 and add mysql to test-go job matrix (#3627)
* Add fixes for running tests with mysql:8

* Add getServer function

* Test github matrix

* Add changes file for the user facing fix

* Remove unused mysql8 docker-compose
2022-01-11 22:44:37 -03:00
Martin Angers f14f97156c Add read and write timeout options for redis (#3624) 2022-01-11 17:08:39 -05:00
Tomas Touceda c662cd2b53 Add policies yaml (#3464)
* Add policies yaml

* Add documentation and address review comments

* Amend documentation
2022-01-11 11:04:29 -03:00
Martin Angers 597144bfac Migrate most users endpoints to the new pattern (#3366) 2022-01-10 14:43:39 -05:00
Mike McNeil f20762b431 update copyright year in core product transactional email templates (#3549)
* update copyright year in core product transactional email templates

* Update password_reset.html

* Update change_email_confirmation.html

* Update smtp_setup.html
2022-01-01 12:41:32 -06:00
Zach Wasserman bda2ef0ca0 Fix regex matching email in host search (#3539)
Fixes #3528
2021-12-31 09:16:25 -08:00
gillespi314 fca1be4703 Modify /server/utils to handle all 2xx codes as POST success (#3534) 2021-12-30 16:00:10 -06:00
Lucas Manuel Rodriguez aaa5b7ec3c Allow hosts to check in even if Redis is down (#3506) 2021-12-29 17:06:23 -08:00
Lucas Manuel Rodriguez 30e922db07 Fix mdm direct query ingestion for non-mdm hosts (#3483)
* Fix mdm direct query ingestion for non-mdm hosts

* Amend TODO comment

* Add dummy test
2021-12-24 09:43:31 -03:00
Lucas Manuel Rodriguez 787944482b Global policies automation webhooks (#3378)
* Add webhook to app config

* Add redis failing policies set and webhook

* Add basic webhook test

* Store hostname in redis

* Global policy deletion to remove policy ID from set and config

* Also process new passing policies

* Fix unit test

* Sort hosts

* Add more tests

* Add ListSets to the failing policies interface

* Fix server URL and garbage collect on the triggering side

* Do not use Redis SCAN

* Fix Redis operation order

* Add API changes to doc

* Add comments

* Add more tests

* Fix tests

* Add tests for config update upon deletion of policies

* Run make dump-test-schema

* Ignore policies that failed to run

* Add proper unit tests to trigger logic

* Fix comments

* WIP

* Add tests to service_osquerty_test.go

* Use SSCAN for listing hosts instead of SMEMBERS

* Add failing policies to docs/01-Using-Fleet/configuration-files/README.md

* Remove skip

* Fix PR comments
2021-12-23 18:26:55 -03:00
Zach Wasserman fb10d50f73 Hide warnings for removed migrations (#3449)
For #3427
2021-12-23 17:07:17 -03:00
Tomas Touceda 7b46df569c Update return values to be null if the data is not available (#3490)
* Update return values to be null if the data is not available

* Return nil in the parent object if neither is available

* Improve readability of the code
2021-12-23 16:57:43 -03:00
Tomas Touceda 06a64cdd2c Use id instead of seen time/created_at to sort hosts (#3482)
* Use id instead of seen time/created_at to sort hosts

* Add test for ordering by id
2021-12-23 15:45:50 -03:00
Martin Angers 5cf911794f Fix metrics test by ensuring each path has a unique name (#3443) 2021-12-21 16:09:20 -05:00
Martin Angers 1e2059585a Add support for google chrome profiles (#3423) 2021-12-21 15:36:19 -05:00
Lucas Manuel Rodriguez 93f4577c7d Fix policy membership migration for MariaDB (#3418)
* Fix policy membership migration for MariaDB

* Use constraintsForTable to get the proper foreign key names
2021-12-21 14:39:46 -03:00
Tomas Touceda fe67b0486b Finish first draft of API versions (#3216)
* Finish first draft of API versions

* wip

* Finalize tests

* Revert change in handler

* Remove made up version

* Update versioning with aliases

* Add changes file

* Address review comments

* Revert overupdated routes

* Expand life time of deprecated APIs

* Fix test

* Comment out problematic part of test

* Revert bad path changes
2021-12-21 12:23:12 -03:00
Martin Angers a74e562893 Migrate labels endpoints to new pattern (#3354) 2021-12-21 09:53:15 -05:00
Tomas Touceda 39e71c6d77 Add mdm and munki (#3406)
* Draft for mdm and munki as direct ingest funcs

* Expose mdm/munki over API

* Add test for service and fix bug

* Update queries test

* Fix lint

* Address review comments
2021-12-21 09:37:58 -03:00
Martin Angers e988d16eb3 Update the prometheus go client library (#3140) 2021-12-20 09:20:58 -05:00
Lucas Manuel Rodriguez 5aeb418945 Exclude old data migration from the migrations check (#3373) 2021-12-16 10:52:42 -03:00
Martin Angers 6d1a55a107 Migrate scheduled queries endpoints to new pattern (#3260) 2021-12-15 10:23:08 -05:00
Martin Angers 73e1c801ee Migrate packs endpoints to new pattern (#3244) 2021-12-15 09:35:40 -05:00
Martin Angers af42a0850e Migrate global scheduled queries endpoints to new pattern (#3235) 2021-12-15 09:06:34 -05:00
Martin Angers 0cc57bd294 Mna 1782 migrate endpoints (#3226) 2021-12-14 16:34:11 -05:00
Martin Angers 4143a37056 Fix redis scan keys issue for live queries (#3107) 2021-12-14 16:30:26 -05:00
Zach Wasserman 33797ddfc1 Optimize requests on packs page (#3327)
Improves #3259
2021-12-13 21:50:24 -08:00
Lucas Manuel Rodriguez 25fd04ea18 Fix team packs rego policy rules (#3356) 2021-12-13 20:53:29 -08:00
Zach Wasserman ac3d8ddf02 Increase default login session length to 24 hours (#3340) 2021-12-13 20:42:30 -08:00
Zach Wasserman 3a5037f798 Update query for users listing (#3324)
- Filter undesired entries.
- LEFT JOIN to include users missing groups.

#2488
2021-12-11 16:25:08 -08:00
Lucas Manuel Rodriguez 4213ddb141 Rename missing policy platforms to platform (#3334) 2021-12-10 13:55:49 -03:00
Lucas Manuel Rodriguez 8bbc52bbff Fix policy rego bug with fleet policies (#3331)
* Fix policy rego bug with fleet policies

* Simplify rego policy fix
2021-12-10 11:47:41 -03:00
Tomas Touceda 66f4fc46c0 Only join big tables when absolutely needed (#3308)
* Only join big tables when absolutely needed

* Fix test

* Revert unintended change in test
2021-12-09 17:36:12 -03:00
Zach Wasserman 32571c0990 Add wrap for SMTP connection error (#3206) 2021-12-09 09:58:33 -08:00
Lucas Manuel Rodriguez d0765cb9ee Do not exit on serve/prepare if there are unknown migrations (#3262)
* Do not exit on serve/prepare if there are unknown migrations

* PR review changes
2021-12-08 19:50:00 -03:00
Tomas Touceda 8686c1520b Add index software (#3241)
* Add index to software over name/id

* Update schema

* Remove double semi colon
2021-12-07 16:36:13 -03:00
Lucas Manuel Rodriguez 8cea7f480a Add HostLinuxOSs (#3217)
* Add HostLinuxOSs

* Add test for PlatformFromHost

* Add sles, gentoo and kali on linux host OSs
2021-12-07 15:37:00 -03:00
Lucas Manuel Rodriguez edec1abc86 Remove platform and team from policy editing (#3233) 2021-12-07 13:01:00 -03:00
Lucas Manuel Rodriguez a47c605bdd Log request errors in non-debug mode (take 2) (#3215)
* Log request errors in non-debug mode

* Amend test for debug

* Add check for error log
2021-12-07 12:52:43 -03:00
Lucas Manuel Rodriguez 6b8a2cb61a Fix mysql8 compatibility with zero dates (#3231)
* Fix mysql8 compatibility with zero dates

* Amend date
2021-12-07 12:51:53 -03:00
Tomas Touceda dc9686024b Remove tx from SaveHost (#3232)
* Remove tx from SaveHost

Also change REPLACE for software for an insert.

* Remove bundle identifier from the get since it's not part of the key

* Revert unneeded change
2021-12-07 12:39:07 -03:00
gillespi314andeashaw 6ee6dba4a4 Update anonymous usage statistics to record Fleet feature adoption (#3056)
* Collect additional anonymous usage statistics

* Update fleetdm.com and docs for usage stats

* Fix lint-go errors

* Fix failing test

* update webhook inputs

* Update receive-usage-analytics.js

* fix failing test

* Update statistics_test.go

Co-authored-by: eashaw <eashaw@sailsjs.com>
2021-12-06 14:39:00 -06:00