Commit Graph

767 Commits

Author SHA1 Message Date
Tomas Touceda
15cf91dcc0
Add limit 1 to disk space queries (#2063) 2021-09-14 18:17:52 -03:00
Martin Angers
d956ca1bec
Use the context in the Datastore layer. (#2030) 2021-09-14 10:44:02 -04:00
Tomas Touceda
176037cad2
Implement fleetctl get software and the underlying API (#1999)
* Implement fleetctl get software and the underlying API

* Add documentation

* Simplify list software implementation

* Lint fixes

* Make team name unique

* Address review comments

* Fix lint

* Fix tests
2021-09-14 10:58:48 -03:00
Tomas Touceda
429af72b69
Issue 1963 vulnerabilities no sync (#1976)
* wip

* Add tests for skip sync

* Add changes file

* Fix lint
2021-09-14 10:58:35 -03:00
Martin Angers
4f4185372d
Add support for context in datastore/mysql layer (#1962)
This is just to pass down the context to the datastore layer, it doesn't
use it just yet - this will be in a follow-up PR.
2021-09-14 08:11:07 -04:00
Tomas Touceda
db83c40d45
Make app config json migration not be skipped by patch release (#2034)
* Make app config json migration not be skipped by patch release

* Update test schema
2021-09-13 14:41:50 -03:00
Benjamin Edwards
42014c02e3
Fix migration that isn't compatible with some mysql8 settings (#1992)
Fixes #1991

Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2021-09-13 10:20:31 -07:00
keepwn
b42d213689
Support close the websocket of LiveQueryResultsHandler (#1006)
* Support close `LiveQueryResultsHandler`

* Start adding test

* Make LiveQuery exit when the context is Done

* Fix lint and remove debug print

* Update server/service/client_live_query.go

Co-authored-by: Zach Wasserman <zach@fleetdm.com>

* Revert "Update server/service/client_live_query.go"

This reverts commit be67ca1512fe502503e821393c2b9e84f5e6e82e.

Co-authored-by: Tomas Touceda <chiiph@gmail.com>
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2021-09-10 16:26:39 -03:00
Tomas Touceda
13e5e6a6db
Debug log per host (#1978)
* Add extra debug logging for hosts

* Add changes file

* Ignore if appconfig is nil

* Use slice of uints instead of a string

* Debug response request for enabled hosts

* Add host-id to request/response

* Lint fixes

* Add missing AppConfigFuncs
2021-09-10 14:48:33 -03:00
Martin Angers
d267fb5168
Fix reading policy after creation for read replicas (#1983) 2021-09-09 16:23:35 -04:00
Tomas Touceda
b2efc9f51c
Make redis conn timeout and keep alive configurable (#1968)
* Make redis conn timeout and keep alive configurable

* Document new configs

* Correct config name
2021-09-08 17:55:12 -03:00
Martin Angers
a099854045
Add missing db transactions, read from primary when after a write (#1957) 2021-09-08 14:43:22 -04:00
Tomas Touceda
69e06476a7
Ignore nonexistent label query executions (#1953) 2021-09-07 15:51:49 -03:00
Martin Angers
0ac4fc4c1a
Update redisc and replace EachRedisNode implementation (#1949) 2021-09-07 13:25:36 -04:00
Tomas Touceda
7c34956d31
Add coverage to uncovered mysql code (#1855)
* Add coverage to uncovered mysql code

* Add deleted method and update mock

* Fix test
2021-09-07 13:48:04 -03:00
Tomas Touceda
a6acb1cd1a
Allow users to be readded if they were ever removed (#1945)
* Allow users to be readded if they were ever removed

* Address review comment

* lint
2021-09-07 13:33:40 -03:00
Tomas Touceda
99e9e846f4
Remove id column from host_users to allow for bulk insert (#1931)
* Remove id column from host_users to allow for bulk insert

* Update documentation
2021-09-07 11:02:35 -03:00
Tomas Touceda
d5a5f014ef
Add test to check that two hosts can store stats concurrently (#1929) 2021-09-07 10:39:17 -03:00
Tomas Touceda
cb687f6e2d
Increase timeout to check for smpt availability (#1942) 2021-09-06 14:29:52 -03:00
gillespi314
4a307f1274
Update email template image links (#1938)
* Update email image links; move pngs to fleetdm.com
2021-09-03 17:00:30 -05:00
Tomas Touceda
6d2ae02efd
Rename core->free and basic->premium (#1870)
* Rename core->free and basic->premium

* Fix lint js

* Comment out portion of test that seems to timeout

* Rename tier  to premium if basic is still loaded
2021-09-03 13:05:23 -03:00
Tomas Touceda
db2e04a7c3
Update new sched query stats if there's already some (#1918)
* Update new sched query stats if there's already some

* IGNORE if the sched query is not present

* Make tests less flaky
2021-09-02 17:39:08 -03:00
Tomas Touceda
681e7f18a0
Add default for agent options (#1917) 2021-09-02 15:59:48 -03:00
Tomas Touceda
15ce06263d
Dont fail config if agent opts is nil (#1898)
* Handle agentopts nil better

* Add changes file
2021-09-01 19:17:41 -03:00
Martin Angers
9a0871a2f1
Address issues related to Redis Cluster support (#1885)
Closes #1847 .
2021-09-01 16:32:57 -04:00
Martin Angers
3755a58070
Add support for MySQL read replicas (#1786)
Adds configuration options to use a read-only MySQL replica,
and uses it instead of the primary for reads.
2021-09-01 15:50:52 -04:00
Tomas Touceda
79b5330a43
Do host user inserts one by one to not lock the whole database (#1884) 2021-09-01 11:39:23 -03:00
Benjamin Edwards
047dc5ac62
fix get hosts command to properly output json/yaml (#1774)
* fix get hosts command to properly output json/yaml based on command line flag

* add changes file

* added tests for get hosts when specifiying host

* added additional hosts to be returned in test cases

* go fmt
2021-08-31 11:37:03 -04:00
Tomas Touceda
22267d8e0a
Group concat limit (#1860)
* wiup

* Decouple software select in two

* Add changes file

* Add missing error check
2021-08-30 16:07:24 -03:00
Tomas Touceda
2a17f9fe56
Remove hardcoded limits to the labels (#1857)
* Remove hardcoded limits to the labels

* Add changes file

* Remove test that doens't apply anymore
2021-08-30 14:56:15 -03:00
Tomas Touceda
8b908f6506
Issue 1599 offline webhook (#1777)
* wip

* Add tests and finish implementation

* Add proper default for periodicity, changes file, and documentation

* Fix tests and add defaults also to new installs

* EnableHostUsers should be true if undefined as well

* In some cases, periodicity can be zero because of the migrations

* Apply defaults when migrating appconfig

* Fix lint

* lint

* Address review comments
2021-08-27 11:15:36 -03:00
Tomas Touceda
2fd725c81b
Export fields so the select will work with the struct (#1819) 2021-08-26 11:56:05 -03:00
Tomas Touceda
d6d53acda5
Issue 1600 fleetctl license expiration (#1800)
* Show banner in fleet and fleetctl if license expired

* Ignore if license is nil or tier is core

* Address review comments
2021-08-26 10:28:53 -03:00
Zach Wasserman
5993018214
Fix live query timeout handling (#1759)
Correct cleanup of the connections was verified with the pprof goroutine
tool.

Fixes #1751
2021-08-25 15:28:04 -07:00
Tomas Touceda
1f5094d97e
Make adding routes a bit simpler (#1771)
* Make adding routes a bit simpler

* Remove unused handle

* Lint

* More lint
2021-08-25 10:08:14 -03:00
Tomas Touceda
5fb5995b83
Remove unneeded interfaces (#1779)
* Remove unneeded interfaces

* Remove unused code
2021-08-24 18:49:56 -03:00
Tomas Touceda
a8642493ad
Add global policies (#1750)
* Add global policies

* Update documentation and add extra parameter to config

* Fix failing tests

* Store historic policy records

* Address review comments

And also remove other inmem references I saw by chance

* Add documentation for get by id request

* Add parameter doc

* Move schema generation to a cmd instead of a test

Otherwise it messes up running all tests sometimes depending on how parallel it does

* Remove brain dump for another task

* Make migration tests a separate beast

* Make schema generation idempotent and move dbutils cmd to tools

* Allow all filters and add counts to Policy

* Add test for Policy
2021-08-24 17:24:52 -03:00
Martin Angers
e61cb7e0db
Configure golangci-lint for the whole repository
Add a relatively minimal set of linters that raise safe and 
mostly un-opinionated issues with the code. It runs 
automatically on CI via a github action.
2021-08-24 13:35:03 -04:00
Martin Angers
a3714d2ed9
Add fleetctl debug connection command (#1706)
Adds the `fleetctl debug connection` command to investigate
connection issues to the fleet server.

Closes #1579 .
2021-08-24 08:50:03 -04:00
Tomas Touceda
612fa05dd3
Log errors when osquery endpoints have issues (#1764) 2021-08-23 19:40:00 -03:00
Martin Angers
bfdc014cc1
Fix sql-related missing Close/Err calls (#1769) 2021-08-23 16:33:41 -04:00
Tomas Touceda
a1ceebf267
Make team schedule names more user friendly and hide them from host pack stats (#1737)
* Make team schedule names more user friendly and hide them from host pack stats

* Delete test for a different bug and add migration

* Update name template
2021-08-23 14:23:47 -03:00
Tomas Touceda
66d864cc84
Remove extra logIPs from host auth mw (#1762)
* Remove extra logIPs from host auth mw

* Fix test
2021-08-23 14:23:27 -03:00
Tomas Touceda
26a08096fb
Use GROUP_CONCAT instead of JSON_ARRAYAGG (#1752)
* Use GROUP_CONCAT instead of JSON_ARRAYAGG

* Update server/datastore/mysql/software.go

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2021-08-23 14:12:30 -03:00
Tomas Touceda
b7a65e920a
Remove orphan host_software and software before adding fk constriants (#1760) 2021-08-23 13:42:43 -03:00
Tomas Touceda
ad18728ac3
Issue 1601 disk space (#1735)
* wip

* Add tests

* Add migration

* Fix tests and set platform for windows correctly
2021-08-20 14:57:37 -03:00
Tomas Touceda
605970c441
Add cascade deletes for host software (#1739)
* Add cascade deletes for host software

* Add changes file

* The drop doesn't work on certain mysql

* Fix error message
2021-08-20 14:29:00 -03:00
Tomas Touceda
c6c63ab12a
Refactor app config (POC, for now) (#1685) 2021-08-20 12:27:41 -03:00
Tomas Touceda
33791dbee8
Remove fk in scheduled_query_stats table and clean up orphan rows for it (#1720)
* Remove fk in scheduled_query_stats table and clean up orphan rows for it

* Improve test and fix bug with the cleanup
2021-08-18 18:30:48 -03:00
Tomas Touceda
70f728fe84
Make vulnerability processing more configurable (#1718)
* Make vulnerability processing more configurable

* Simplify leader selection
2021-08-18 17:25:14 -03:00