Commit Graph

1424 Commits

Author SHA1 Message Date
Michal Nicpon
30a864c8d2
Sync CVE scores periodically (#5838) 2022-06-01 10:06:57 -06:00
Roberto Dip
eb8defdcbe
add premium, device authed endpoint to retrieve policies (#5967)
This adds a new device authenticated endpoint, `/api/_version_/fleet/device/{token}/policies` to retrieve the device policies.

An example request / response looks like:

```bash
curl  https://localhost:8080/api/latest/fleet/device/1804e808-171f-4dda-9bec-f695b2f2371a/policies
```

```json
{
  "policies": [
    {
      "id": 3,
      "name": "Antivirus healthy (Linux)",
      "query": "SELECT score FROM (SELECT case when COUNT(*) = 2 then 1 ELSE 0 END AS score FROM processes WHERE (name = 'clamd') OR (name = 'freshclam')) WHERE score == 1;",
      "description": "Checks that both ClamAV's daemon and its updater service (freshclam) are running.",
      "author_id": 1,
      "author_name": "Admin",
      "author_email": "admin@example.com",
      "team_id": null,
      "resolution": "Ensure ClamAV and Freshclam are installed and running.",
      "platform": "darwin,windows,linux",
      "created_at": "2022-05-23T20:53:36Z",
      "updated_at": "2022-05-23T20:53:36Z",
      "response": "fail"
    }
  ]
}
```

Related to [#5685](https://github.com/fleetdm/fleet/issues/5685), in another changeset I will be adding "client" endpoints so we can consume this endpoint from Fleet Desktop
2022-05-31 14:54:43 -03:00
Lucas Manuel Rodriguez
98be6cfc29
Improve Fleet Desktop "My Device" menu item UX at install time (#5915)
* Improve Fleet Desktop My Device link availability

* Use svc.clock and add test

* Revert change and add check for LastEnrolledAt on tests
2022-05-31 12:56:51 -03:00
Lucas Manuel Rodriguez
9080563b7d
Fix some go lint warnings (#5888)
* Fix go lint warnings

* Add test for SMTPConfigured update
2022-05-31 07:19:57 -03:00
Michal Nicpon
a652292d0f
Don't return orphaned software from the API (#5840) 2022-05-30 09:23:27 -06:00
Roberto Dip
fc7a045209
ensure previous host membership policies are deleted on enrollment (#5890)
Related to #5776, this ensures that when a host is re-enrolled on a different team we cleanup existing policy memberships in the same way we do when a host is assigned a team through the API.
2022-05-30 10:30:15 -03:00
gillespi314
baeff6e893
Add validation for pack scheduled query interval (#5918) 2022-05-26 16:54:21 -05:00
Michal Nicpon
6083b180a6
fix duplicate hosts in vuln webhook (#5843) 2022-05-25 11:40:12 -06:00
gillespi314
b4ffec10db
Remove skipLoadingExtras and includeCVEScores from GetHost and HostByIdentifier methods (#5874) 2022-05-25 11:30:03 -05:00
gillespi314
85c6ca0e5f
Improve precision in reporting of unseen hosts via host status webhook automations (#5889) 2022-05-25 10:54:56 -05:00
Martin Angers
56ce1649ee
Add issues and device_mapping output to CSV export (#5864) 2022-05-23 15:35:05 -04:00
gillespi314
bbc1891420
Add ability to see Google Chrome profiles on the Hosts page (#5839) 2022-05-23 14:27:30 -05:00
gillespi314
2db2c16511
Include MIA hosts under total count for Offline hosts (#5854) 2022-05-23 14:11:02 -05:00
Roberto Dip
36284fecf0
wrap errors even if an error message is not provided (#5828) 2022-05-23 09:32:17 -03:00
Desmi-Dizney
f648949ebe
Editor pass - Support per-task configuration for async host processing configuration (#5810)
* Editor pass - Support per-task configuration for async host processing configuration #

Editor pass for:
-  https://github.com/fleetdm/fleet/pull/5700

* Update Configuration.md

* Update config.go
2022-05-20 12:07:32 -05:00
Michal Nicpon
983f9e59b3
Include CVE scores when listing software (#5673) 2022-05-20 10:58:40 -06:00
Roberto Dip
3954648c28
automatically add host and viewer information to errors (#5807) 2022-05-20 11:09:50 -03:00
gillespi314
9c14495701
Fix error handling (#5823) 2022-05-19 18:29:33 -05:00
gillespi314
8e333509b1
Add license object to GET /fleet/device/{token} response (#5820) 2022-05-19 16:28:49 -05:00
gillespi314
4a4e832d3a
Increase minimum password length to 12 characters (#5712) 2022-05-18 12:03:00 -05:00
Roberto Dip
894fa22c71
implement a thin wrapper around stdlib errors (#5733)
This solves #5679 , and also implements #5515, #5509 and lays the ground for #5516

With the introduction of Wrap, Is and As in the standard library, we've now got built-in support for wrapping.

On top of that, a common pattern in the community is to define errors tailored to the context of each project while still conforming to the error and Unwrap interfaces (see Upspin, Chromium)

The output now includes stack traces and additional info
2022-05-18 11:47:55 -03:00
Martin Angers
e6b90ca8b9
Support per-task configuration for async host processing configuration (#5700) 2022-05-16 09:44:50 -04:00
Lucas Manuel Rodriguez
114b678e26
test: Add retry to the correct part that has sync enabled (#5688) 2022-05-11 10:11:51 -03:00
Martin Angers
f05d2be767
Produce hosts' CSV report based on requested columns (#5656) 2022-05-10 14:25:53 -04:00
gillespi314
d172128183
Add label information to host summary response (#5573) 2022-05-10 10:32:55 -05:00
Martin Angers
1fa7bb7a19
Support async saving of hosts' last seen time (#5640) 2022-05-10 11:29:17 -04:00
Martin Angers
421a0ec635
Fix some config mismatches in osquery logging (#5488) 2022-05-10 11:27:32 -04:00
Michal Nicpon
a005b7e7b7
fix schema dump (#5562) 2022-05-10 09:03:04 -06:00
Lucas Manuel Rodriguez
fda79a8770
Run network test serially to prevent timeouts on Github CI (#5557)
* Run network test serially to prevent timeouts on Github CI

* Revert lint changes

* Add simple file lock

* Revert test change

* Clarify error check
2022-05-10 11:52:33 -03:00
Roberto Dip
cba78bdcd1
don't clear errors automatically when reading them from Redis (#5623)
this change prevents errors from being automatically cleared once they are read. A new flag `-flush` is introduced to flush errors on read if necessary.
2022-05-10 11:44:43 -03:00
gillespi314
998471f716
Omit empty device mapping from host responses where optional device_mapping param is missing (#5541) 2022-05-05 13:13:53 -05:00
gillespi314
991c7ccadc
Add device_mapping to GET /hosts response (#5383) 2022-05-02 16:34:14 -05:00
gillespi314
1dabf52834
Add Zendesk external service integration for vulnerability automations (#5372) 2022-05-02 15:58:34 -05:00
Martin Angers
5c0031c8f1
Change jira ticket type from Bug to Task (#5426) 2022-05-02 08:56:42 -04:00
Roberto Dip
a4725518ac
filter out Google Chrome profiles without an associated email before ingesting (#5440)
To add support for #400, we're using the macadmins/osquery-extension to gather Google Chrome profiles from hosts.

Under the hood, the extension looks and parses a json file in which Chrome stores a bunch of data. Given that emails are not required to create Chrome profiles, some of the profiles stored in this file and returned by the query we're using contain empty emails.

The idea after this change is to prevent empty emails from being ingested in the first place instead of filtering them after the fact. I have also included a migration to clean the rows with empty email columns.

Fixes #4780
2022-05-02 09:55:40 -03:00
Roberto Dip
2c23cb5f24
fix mysql tests by with a regexp assertion of possible error messages (#5444)
this fixes #5377 by asserting that the error message starts with "tsl" or "x509" as either of the strings represent the same error depending on the mysql version.

we should refactor the code to avoid checking on the error messages and probably use different error types instead.
2022-04-29 09:31:58 -03:00
Martin Angers
0d0c17e0c6
Add osquery.min_software_last_opened_at_diff configuration option (#5394) 2022-04-27 09:47:09 -04:00
Lucas Manuel Rodriguez
407d8b527e
Remove unused Datastore.SaveHost and unused Modified fields (#5245) 2022-04-26 18:33:29 -03:00
Martin Angers
253baee657
Collect last_opened_at for macOS software, and return it in host details payload (#5376) 2022-04-26 14:16:59 -04:00
Michal Nicpon
a64982f96c
Remove use of JSON_ARRAYAGG (#5350)
Not supported in MySQL < 5.7.22
2022-04-25 14:43:08 -06:00
Lucas Manuel Rodriguez
45b9a382a6
fleetctl preview to use v1 setup path, to support previous versions of fleet (#5331) 2022-04-25 10:02:21 -03:00
Martin Angers
26cfa9e358
Migrate client setup api call used by fleetctl to use versionless path (#5266) 2022-04-20 16:30:43 -04:00
Martin Angers
b3fc0cd844
Unversion the /setup endpoint, version the websocket endpoint (#5104) 2022-04-20 15:57:26 -04:00
Michal Nicpon
9f981f9e49
fleetctl query improve error message (#5141) 2022-04-20 11:35:46 -06:00
Martin Angers
fd0cd153ce
Fix SSO paths to always use /v1/ instead of /latest/ (#5246) 2022-04-20 12:46:45 -04:00
Lucas Manuel Rodriguez
42f53b63b2
Remove recursion and return doRetryErr on getOrGenerateSoftwareIdDB (#5239)
* Remove recursion and return doRetryErr on getOrGenerateSoftwareIdDB

* Use GetContext and LIMIT 1
2022-04-20 11:02:35 -03:00
Lucas Manuel Rodriguez
29a902960e
Fix typos and amend PR template (#5227) 2022-04-19 18:09:55 -03:00
Lucas Manuel Rodriguez
f7048b711c
Fix race condition in tests when using global var loginRateLimit (#5197) 2022-04-19 10:35:53 -03:00
Juan Fernandez
2479d58262
Using '@' in target search causes 422 error response (#5148)
* Bug 4852:

When searching for Labels, breakdown query strings containing '@' in multiple search terms to
avoid issues with MySQL FTS.
2022-04-19 09:28:49 -04:00
gillespi314
70a61b86f1
Update os version aggregated stats for all teams (#5083) 2022-04-18 16:19:58 -05:00
Tomas Touceda
7e02bdfa29
hide jira api token from the config API (#5196)
* hide jira api token from the config API

* Update based on reviews and fix tests
2022-04-18 17:55:51 -03:00
Lucas Manuel Rodriguez
da171d3b8d
Merge pull request from GHSA-pr2g-j78h-84cr
* Fix access control issues with users

* Fix access control issues with packs

* Fix access control issues with software

* Changes suggested by Martin

* All users can access the global schedule

* Restrict access to activities

* Add explicit test for team admin escalation vuln

* All global users should be able to read all software

* Handbook editor pass - Security - GitHub Security (#5108)

* Update security.md

All edits are recorded by line:

395 replaced “open-source” with “open source”
411 replaced “open-source” with “open source”
439 added “the” before “comment”; replaced “repositories,” with “repositories”
445 deleted “being” before “located”
458 added “and” after “PR”
489 replaced “on” with “in”
493 replaced “open-source” with “open source”; Replaced “privileges,” with “privileges”

* Update security.md

line 479

* Update security.md

added (static analysis tools used to identify problems in code) to line 479

* Fix UI

* Fix UI

* revert api v1 to latest in documentation (#5149)

* revert api v1 to latest in documentation

* Update fleetctl doc page

Co-authored-by: Noah Talerman <noahtal@umich.edu>

* Add team admin team policy automation; fix e2e

* Update to company page of the handbook (#5164)

Updated "Why do we use a wireframe-first approach?" section of company.md

* removed extra data on smaller screens (#5154)

* Update for team automations; e2e

* Jira Integration: Cypress e2e tests only (#5055)

* Update company.md (#5170)

This is to update the formatting under "empathy" and to fix the spelling of "help text."
This was done as per @mikermcneil .
This is related to #https://github.com/fleetdm/fleet/pull/4941 and https://github.com/fleetdm/fleet/issues/4902

* fix update updated_at for aggregated_stats (#5112)

Update the updated_at column when using ON DUPLICATE UPDATE so that
the counts_updated_at is up to date

* basic sql formatting in code ie whitespace around operators

* Fix e2e test

* Fix tests in server/authz

Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com>
Co-authored-by: Desmi-Dizney <99777687+Desmi-Dizney@users.noreply.github.com>
Co-authored-by: Michal Nicpon <39177923+michalnicp@users.noreply.github.com>
Co-authored-by: Noah Talerman <noahtal@umich.edu>
Co-authored-by: Mike Thomas <78363703+mike-j-thomas@users.noreply.github.com>
Co-authored-by: Martavis Parker <47053705+martavis@users.noreply.github.com>
Co-authored-by: RachelElysia <71795832+RachelElysia@users.noreply.github.com>
2022-04-18 10:27:30 -07:00
Michal Nicpon
2dbf1d7975
fix update updated_at for aggregated_stats (#5112)
Update the updated_at column when using ON DUPLICATE UPDATE so that
the counts_updated_at is up to date

* basic sql formatting in code ie whitespace around operators
2022-04-15 14:09:47 -06:00
Zach Wasserman
f28d5ab5be
Skip Docker interfaces for host primary IP (#5119)
See #4754
2022-04-13 11:04:38 -07:00
Martin Angers
a4be69d9d1
Return the new recent_vulnerability_max_age config in the REST API config payload (#5107) 2022-04-13 12:05:57 -04:00
Martin Angers
f3926c4677
Introduce forced failures for the Jira client. (#5088) 2022-04-13 09:17:02 -04:00
Martin Angers
36702ede8d
Make recent vulnerabilities max age configurable. (#5081) 2022-04-12 14:48:15 -04:00
Martin Angers
ae85d9d069
Rename jira integration password to api_token, as that is what it is (#5068) 2022-04-12 10:56:05 -04:00
Martin Angers
7187f1adac
Queue jobs for Jira integration when enabled and new vulnerabilities are found. (#4975) 2022-04-11 16:42:16 -04:00
Martin Angers
5483adc26b
Detect the NOPERM error to mean redis cluster is disabled (#5058) 2022-04-11 16:17:30 -04:00
Ricky Grassmuck
eddc2e2bda
Replace uses of ansi quotes (") in SQL statements (#4726)
To ensure the product works properly when using MySQL with `ANSI_QUOTES` mode enabled,
replace all uses of `""` for values inside SQL statements with `''`

Co-authored-by: Ricky Grassmuck <r.grassmuck@cpanel.net>
2022-04-11 11:47:50 -07:00
Lucas Manuel Rodriguez
60b7425bef
Add http basic auth to /metrics (#4974)
* Add http basic auth to /metrics

* Fixes after testing applying of a --config sample.yml

* Add unit test
2022-04-07 09:40:53 -03:00
Tomas Touceda
f2aba83a73
Extend vulnerability age to 30 (#4901) 2022-04-06 11:42:02 -03:00
Martin Angers
193843a97d
Make a test request to Jira when saving AppConfig with an enabled jira integration (#4954) 2022-04-06 07:55:25 -04:00
Zach Wasserman
bc2137e132
Add optimization to Windows software query (#4952)
This optimizes the query in particular for Domain Controllers, where
there are a number of users with no local accounts and don't need to be
searched for software.

See #4261
2022-04-05 10:56:47 -07:00
Martin Angers
d890970844
Implement the Jira API call (#4938) 2022-04-05 12:58:34 -04:00
Martin Angers
f28dc10a51
Merge jira-integration branch to main (#4949) 2022-04-05 12:56:15 -04:00
Martin Angers
90b15071a4
Introduce API version 2022-04, deprecate use of /global in paths (#4731) 2022-04-05 11:35:53 -04:00
Lucas Manuel Rodriguez
57816592ba
Add read replica testing helpers and fix non-sso login bug (#4908)
not set on the INSERT.
- OUT: Only sets the ID on the passed session and returns it. (`CreatedAt`, `AccessedAt`, are not set.)

New version:

```go
func (ds *Datastore) NewSession(ctx context.Context, userID uint, sessionKey string) (*fleet.Session, error) {
	sqlStatement := `
		INSERT INTO sessions (
			user_id,
			` + "`key`" + `
		)
		VALUES(?,?)
	`
	result, err := ds.writer.ExecContext(ctx, sqlStatement, userID, sessionKey)
	if err != nil {
		return nil, ctxerr.Wrap(ctx, err, "inserting session")
	}

	id, _ := result.LastInsertId() // cannot fail with the mysql driver
	return ds.sessionByID(ctx, ds.writer, uint(id))
}
```

- IN: Define arguments that are truly used when creating a session.
- OUT: Load and return the fleet.Session struct with all values set (using the `ds.writer` to support read replicas correctly).

PS: The new `NewSession` version mimics what we already do with other entities, like policies (`Datastore.NewGlobalPolicy`).
2022-04-04 16:52:05 -07:00
Martin Angers
71f2690ada
Add Jira integrations config support (#4863) 2022-03-30 09:10:02 -04:00
Michal Nicpon
779623934c
Fix update invite email conflict (#4751) 2022-03-28 09:38:57 -06:00
Michal Nicpon
a6902cc083
Add os versions endpoint (#4749) 2022-03-28 09:15:45 -06:00
Michal Nicpon
6c2199f2b0
fix failing policies nil pointer dereference (#4802) 2022-03-24 15:56:56 -06:00
Martin Angers
c4946335ff
Add migration to cleanup host-related tables (#4778)
#4448
2022-03-23 15:22:10 -07:00
Lucas Manuel Rodriguez
378b1dd34f
Upgrade osquery-go (#4728)
* Upgrade and replace kolide/osquery-go with osquery/osquery-go

* Upgrade macadmins/osquery-extension to v0.0.7

* Upgrade kolide/launcher to latest

* go mod tidy
2022-03-23 12:15:37 -03:00
Lucas Manuel Rodriguez
8f9ed3ef7b
Fix Datastore.DeleteHosts (#4745) 2022-03-23 12:15:05 -03:00
Michal Nicpon
7b671ac2a3
Add team failing policies webhook (#4633)
* add config to teams
* update api docs
* update tests
2022-03-21 13:16:47 -06:00
Lucas Manuel Rodriguez
ecdfd627b6
Fleet Desktop MVP (#4530)
* WIP

* WIP2

* Fix orbit and fleetctl tests

* Amend macos-app default

* Add some fixes

* Use fleetctl updates roots command

* Add more fixes to Updater

* Fixes to app publishing and downloading

* Add more changes to support fleetctl cross generation

* Amend comment

* Add pkg generation to ease testing

* Make more fixes

* Add changes entry

* Add legacy targets (until our TUF system exposes the new app)

* Fix fleetctl preview

* Fix bool flag

* Fix orbit logic for disabled-updates and dev-mode

* Fix TestPreview

* Remove constant and fix zip-slip attack (codeql)

* Return unknown error

* Fix updater's checkExec

* Add support for executable signing in init_tuf.sh

* Try only signing orbit

* Fix init_tuf.sh targets, macos-app only for osqueryd

* Specify GOARCH to support M1s

* Add workflow to generate osqueryd.app.tar.gz

* Use 5.2.2 on init_tuf.sh

* Add unit test for tar.gz target

* Use artifacts instead of releases

* Remove copy paste residue

* Fleet Desktop Packaging WIP

* Ignore gosec warning

* Trigger on PR too

* Install Go in workflow

* Pass url parameter to desktop app

* Fix fleetctl package

* Final set of changes for v1 of Fleet Desktop

* Add changes

* PR fixes

* Fix CI build

* add larger menu bar icon

* Add transparency item

* Delete host_device_auth entry on host deletion

* Add SetTargetChannel

* Update white logo and add desktop to update runner

* Add fleet-desktop monitoring to orbit

* Define fleet-desktop app exec name

* Fix update runner creation

* Add API test before enabling the My device menu item

Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2022-03-21 14:53:53 -03:00
Benjamin Edwards
74bb559645
Add public ip to hosts & derive geolocation when rendering host (#4652)
* geoip wip
* return nil if ip is empty string or if ParseIP returns nil
* add ui component to render geolocation if available, address PR feedback
* render public ip if available
* add changes file, document geoip in deployment guide
* update rest-api docs
2022-03-21 12:29:52 -04:00
Zach Wasserman
efbc2b92bb
Fix race condition in updates test (#4661)
Copy the DefaultOptions in order to prevent a data race on the Targets
map. This race should only have effected testing.

Race detector output:

```
WARNING: DATA RACE
Read at 0x00c0000908d0 by goroutine 15:
  runtime.mapaccess1_faststr()
      /opt/hostedtoolcache/go/1.18.0/x64/src/runtime/map_faststr.go:13 +0x0
  github.com/fleetdm/fleet/v4/orbit/pkg/update.TestMakeRepoPath.func1()
      /home/runner/work/fleet/fleet/orbit/pkg/update/update_test.go:58 +0xb6
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1486 +0x47

Previous write at 0x00c0000908d0 by goroutine 12:
  runtime.mapassign_faststr()
      /opt/hostedtoolcache/go/1.18.0/x64/src/runtime/map_faststr.go:203 +0x0
  github.com/fleetdm/fleet/v4/orbit/pkg/update.TestMakeRepoPath.func1()
      /home/runner/work/fleet/fleet/orbit/pkg/update/update_test.go:62 +0x1cb
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1486 +0x47

Goroutine 15 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1486 +0x724
  github.com/fleetdm/fleet/v4/orbit/pkg/update.TestMakeRepoPath()
      /home/runner/work/fleet/fleet/orbit/pkg/update/update_test.go:53 +0x1a4
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1486 +0x47

Goroutine 12 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1486 +0x724
  github.com/fleetdm/fleet/v4/orbit/pkg/update.TestMakeRepoPath()
      /home/runner/work/fleet/fleet/orbit/pkg/update/update_test.go:53 +0x1a4
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.18.0/x64/src/testing/testing.go:1486
      +0x47
 ```
2022-03-18 09:30:45 -07:00
Martin Angers
b2845cd65f
Refactor authz skip for device auth, add org_logo_url for frontend (#4619) 2022-03-16 10:15:25 -04:00
Martin Angers
c0591dac5d
Ignore pagination params for the download csv endpoint (#4608) 2022-03-16 09:01:52 -04:00
Lucas Manuel Rodriguez
d2ba34c8fc
Add distributed discovery query support for detail queries, add orbit… (#4597)
* Add distributed discovery query support for detail queries, add orbit_info ingestion

* Amend changes file
2022-03-15 16:51:00 -03:00
Martin Angers
bb678b6b2e
Add support for downloading a list of hosts in CSV format (#4596) 2022-03-15 15:14:42 -04:00
Martin Angers
fc01947ae7
Allow global admin to change anyone's password. (#4582) 2022-03-15 08:11:53 -04:00
Roberto Dip
9dba07395b
Add missing error checking to test config setup (#4401)
* check for errors when setting test logs on new services

* fix tests that fail because a log file wasn't specified

* remove unnecessary nil check
2022-03-11 12:51:12 -03:00
Michele Preziuso
68330bd38f
Add support for Amazon Linux 2 (#4555) 2022-03-10 15:47:24 -07:00
Benjamin Edwards
f8cf6ea91c
make context type value header configurable (#4441)
* make context type value header configurable
* populate config
2022-03-09 17:22:29 -05:00
Martin Angers
a1c67547b3
Add new endpoints to retrieve device information by orbit identifier (#4531) 2022-03-09 16:13:56 -05:00
Martin Angers
c8bc026d6f
Migrate special-case endpoints to new pattern (#4511) 2022-03-08 11:27:38 -05:00
Tomas Touceda
dd62695791
Add host device auth table (#4494) 2022-03-08 09:05:53 -03:00
Michal Nicpon
1aa7b96837
change session duration to 5 days (#4480) 2022-03-07 15:37:54 -07:00
Martin Angers
c40fdd783e
Migrate host-authenticated endpoints to new pattern (#4403) 2022-03-07 13:10:55 -05:00
Benjamin Edwards
b053684712
append newline char to raw log bytes for nice NDJSON format (#4425)
* append newline char to raw log bytes for nice NDJSON format
* add changes file
2022-03-02 17:23:23 -05:00
Tomas Touceda
6cffd5438f
Only send test email when changing smtp values (#4394)
* Only send test email when changing smtp values

* Update comment
2022-02-28 18:28:51 -03:00
Martin Angers
4930ca2d0e
Support listing software hosts count filtered by team (#4388) 2022-02-28 13:55:14 -05:00
Tomas Touceda
c522c2eaa2
Add missing case for email change errors (#4390)
* Add missing case for email change errors

* Update tests
2022-02-28 13:17:10 -03:00
Tomas Touceda
1fdcb1bfc2
Error early if email already exists (#4363)
* Error early if email already exists

* Update changes/issue-4361-mail-change-should-error

Co-authored-by: Michal Nicpon <39177923+michalnicp@users.noreply.github.com>

* Fix test

* Lint fixes

* Fix another test

* Also check for invites

* Improve error checks

* Update comment

* Update tests

* Fix test

Co-authored-by: Michal Nicpon <39177923+michalnicp@users.noreply.github.com>
2022-02-28 09:34:44 -03:00
Frederico F. de Oliveira
9b02722e08
endpoint_sessions.go: add the redirect URL in the html body text (#4328)
This makes debug easier in case the browser get stuck on the redirect page.
2022-02-23 14:43:23 -08:00
Martin Angers
18e7c8e236
Implement cron cleanup job of policy membership when policy platform is updated (#4331) 2022-02-23 16:10:37 -05:00
Martin Angers
84ac0f05a9
Grant write to policies to global maintainer (#4321) 2022-02-22 16:57:36 -05:00
Martin Angers
ad5146c491
Allow updating the policy platform (part 1 of the ticket) (#4311) 2022-02-22 13:42:03 -05:00
Tomas Touceda
4034a7ab59
Make SearchHosts behave the same as the filtering in ListHosts (#4295) 2022-02-22 10:19:51 -03:00
Martin Angers
2ab1b9ec85
Remove expiration of API-only user tokens (#4314) 2022-02-22 08:12:03 -05:00
Michal Nicpon
4ce23c7d1b
Add team targets to pack spec (#4272)
* skip flaky tests
2022-02-21 09:18:58 -07:00
Tomas Touceda
6d582cffa0
Don't depend on last inserted id to get the id for the new software (#4298)
* Don't depend on last inserted id to get the id for the new software

* Correct typo
2022-02-18 16:30:24 -03:00
Tomas Touceda
8e68ec3b96
Insert one CVE per CPE when there are multiple matches (#4297)
* Insert one CVE per CPE when there are multiple matches

* Remove comment

* No need to do sqlx.In
2022-02-18 15:25:26 -03:00
gillespi314
089f49cc5d
Add new activity types for policy-related activities (#4043)
* Add new activities for policy create, delete, and modify, and apply policy spec
* Add PoliciesByID ds method; refactor delete svcs
2022-02-16 09:33:56 -06:00
Martin Angers
80079e4fd7
Fix race in mock datastore for recent_vulns test (#4230) 2022-02-16 09:23:27 -05:00
Martin Angers
e29797deb0
Migrate the last batch of authenticatedUser endpoints to the new pattern (#4210) 2022-02-15 15:22:19 -05:00
Tomas Touceda
a49f2a06ed
Allow removal of munki versions (#4189)
* Skip any versions that are empty in munki

* Return not found if munki is uninstalled

* Fix lint

* wip

* Add deleted at for host_munki_version
2022-02-15 16:29:14 -03:00
Michal Nicpon
0be26613b3
Cache team agent options (#4193)
* use raw literal for json
* wrap cache to clone all values
2022-02-15 12:07:51 -07:00
Michal Nicpon
9009857022
Add get team by name to fleetctl (#4202) 2022-02-15 11:48:09 -07:00
Martin Angers
290b5d90e5
Add team target filters to rego authorization checks for running queries (#4194) 2022-02-15 13:41:48 -05:00
Zachary Winnerman
c5c72ed713
Add apm for testing apm (#4053)
* Add apm for testing apm

* Testing opentracing

* testing

* Testing

* go fmt

* Add config switch for tracing.

* fixup

* Update cmd/fleet/serve.go

Co-authored-by: Tomas Touceda <chiiph@gmail.com>

* Add support for both elasticapm and opentelemetry

* Fix driver stuff and config options

* Fixup

* fixup

* Add changes file

* Add config for sql driver

* fixup

* Add doc to exported field

* testing

* fixup

* fixup

* Testing again

* fixup

* testing

* Undo

Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2022-02-15 12:42:22 -05:00
Lucas Manuel Rodriguez
be72dc356c
Add CentOS parsing+post-processing to reduce false positives in vulnerability processing (#4037)
* Add CentOS parsing and post-processing in fleet

* Add tests and amend SyncCPEDatabase

* Add test for centosPostProcessing

* Changes from PR comments

* Amend software test

* Fix sync test

* Add index to source and vendor

* Use os.MkdirTemp

* Rearrange migrations

* Regenerate test schema

* Add support for testing migrations (#4112)

* Add support for testing migrations

* Rename migration in tests

* Changes suggested in PR

* Go mod tidy
2022-02-14 15:13:44 -03:00
Zachary Winnerman
3babf53cf4
Fix OSVersion to work properly when distribution does not follow symver (#3968)
* Fix OSVersion to work properly when distribution does not follow symver

Certain distros such as ClearLinux or ArchLinux do not use symver or any
dotted versioning scheme for their releases. Archlinux uses the static
string "Rolling" and ClearLinux uses a single build number such as 35550
for their versions.

In Fleet console, this shows up as a string like "Archlinux 0.0.0.0"
which makes very little sense to the user. This change makes it so that
if OSQuery cannot generate a dotted version number, we should instead
use the build id as an opaque string.

* Add /changes

* Add tests for os_version

* fixup

* fixup
2022-02-14 12:55:23 -05:00
Michal Nicpon
075702113a
Print version warning when using fleetctl (#4139)
* Remove deprecated call in fleetctl
* Remove duplicate error returned by app.Run in tests
2022-02-14 09:43:34 -07:00
Lucas Manuel Rodriguez
9c25ea1641
Prepare LoadHostByNodeKey query once (#4128)
* Prepare LoadHostByNodeKey query once

* Use a protected map for storing statements

* Add proposed test
2022-02-14 12:13:38 -03:00
dayld
c32a225104
users table to cached_users to improve performance (#4170)
* users table to cached_users to improve performance

* add changes file

Co-authored-by: dayld <>
2022-02-14 09:48:17 -03:00
Zach Wasserman
1e843f3b89
Allow short IdP name in server validation (#4077)
A customer encountered an error when setting the value to "SSO" which
seems quite reasonable.
2022-02-13 19:35:59 -08:00
Noah Talerman
67827474c2
Prepare for Fleet 4.10.0 (#4161)
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2022-02-13 18:13:06 -08:00
Zach Wasserman
e20a9b4508
Add platform filters for MDM/Munki/Chrome queries (#4144)
* Add platform filters for MDM/Munki/Chrome queries

This should help quiet warnings that users/customers have reported when
these queries try to run on platforms without the macadmins extension
tables.

For #4123

* Improve documentation

* add changes file

* revert doc formatting

* Update tests

* Yet another test fix

Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2022-02-11 14:10:26 -03:00
Tomas Touceda
c45115a915
Properly handle path in CVE URL prefix (#4174) 2022-02-11 14:10:13 -03:00
Tomas Touceda
d167556514
Make sure we handle unenrolling properly (#4158)
* Make sure we handle unenrolling properly

* Update failing test

* Fix test
2022-02-11 08:27:15 -03:00
eashaw
9af92b23aa
Update links to documentation (#4163)
* update links to documentation

* revert .sailsrc change

* fix broken link
2022-02-10 19:26:18 -06:00
Martin Angers
cc1cf69a0f
Use a dedicated table to store hosts_count and fix pagination with vulns (#4104) 2022-02-09 10:16:50 -05:00
Tomas Touceda
11887f87f7
Add enable scheduled query stats to fleet config (#4066)
* Add enable scheduled query stats to fleet config as well

* Add documentation

* Revert "Allow disabling scheduled query stats via app config (#4049)"

This reverts commit f98fd4d331.

* Add changes file

* Update ref

* Add missing docs
2022-02-09 08:20:29 -03:00
Michal Nicpon
578a9780f2
apply queries spec endpoint missing authorization check (#4068)
* do authorization check when updating existing query
2022-02-08 09:47:48 -07:00
Martin Angers
73d4794c55
Ignore software_id = 0 when calculating hosts count (#4080) 2022-02-08 10:59:17 -05:00
Martin Angers
1686bcafb8
Fix requesting subsequent pages in list software (#4061) 2022-02-07 15:57:55 -05:00
Tomas Touceda
35eac78aed
Add CountsUpdatedAt for munki/mdm status (#4045)
* Add CountsUpdatedAt for munki/mdm status

* Update doc
2022-02-07 14:53:33 -03:00
Martin Angers
1751c7a548
Expand linux platform to all supported linux os in generate hosts stats (#4051) 2022-02-07 11:50:36 -05:00
Tomas Touceda
f98fd4d331
Allow disabling scheduled query stats via app config (#4049)
* Allow disabling scheduled query stats via app config

* Update tests

* Fix test

* Moar test fixes

* Remove redundant set

* Add documentation

* Fix typo in docs
2022-02-07 13:37:54 -03:00
Martin Angers
2cdd614253
Remove todos around queries/run authorization tests (#3992) 2022-02-07 09:00:48 -05:00
Tharun Rajendran
2084b7d310
feat(api): add endpoint to get team by id (#4018)
* feat(api): add endpoint to get team by id

* fix review feedbacks

* add integration test in enterprise suite
2022-02-04 14:33:22 -03:00
Lucas Manuel Rodriguez
a8135aa928
Fix typo and lint checks (#4013) 2022-02-03 17:06:49 -03:00
Tomas Touceda
656ef07df1
Move ApplyTeamSpec to ee (#4011)
* Move ApplyTeamSpec to ee

* Update test now that apply team specs is behind premium

* Check all auth first

* Change auth call for team creation
2022-02-03 16:24:03 -03:00
Tomas Touceda
cf529e70cf
Issue 3173 debug status processlist (#4009)
* Add innodb status and process list

* Make json output a bit prettier

* Add changes file

* fix lint issues
2022-02-03 14:56:22 -03:00
Lucas Manuel Rodriguez
ab8cc6e7bc
Split hosts in bucket of minutes for the jitter (#3767)
* Split hosts in bucket of minutes

* New approach on jitter

* Use minutes to define the amount of buckets

* Add logging to jitter hash creation

* Clean up code and remove unused jitter

* Fix test

* Add docs and address review comments

* Address review comments

* Fix typo in doc

Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2022-02-03 14:56:11 -03:00
Tomas Touceda
53ba8f07ea
Issue 3882 clean team packs (#4002)
* Cleanup team schedules when deleting teams

* Add changes file

* Improve code readability

* Reuse func instead of formatting twice
2022-02-03 14:55:48 -03:00
Tomas Touceda
b2d0a8c79f
Merge pull request from GHSA-ch68-7cf4-35vr
* Validate audience restrictions when validating SAML auth reqs

* EntityID is usually the audience

* Add coverage for failures on audience conditions
2022-02-02 15:50:09 -08:00
Martin Angers
6e2ba62744
Trigger webhooks for recently published vulnerabilities (#3941) 2022-02-02 16:34:37 -05:00
Tomas Touceda
b90e2e2e3d
Issue 3901 match target sw (#3982)
* Allow to search with target_sw with a period

* Remove tests for a different thign

* Add a test for programs as a source as well

* Use MATCH again and add proper tests
2022-02-02 17:17:41 -03:00
Martin Angers
6319812984
Fix column name when detecting order by (#3978) 2022-02-02 10:08:51 -05:00
Tomas Touceda
a63c549f07
Make software filter by counts faster (#3975)
* Make software filter by counts faster

* Sort only when it's for the agg table
2022-02-02 09:51:56 -03:00
Martin Angers
4ab7fdd6bb
Return a null timestamp when there are no software counts available (#3955) 2022-01-31 17:08:03 -05:00
Martin Angers
ecf6bd8907
Migrate more user-authenticated endpoints to new pattern (#3933) 2022-01-31 16:35:22 -05:00
Tomas Touceda
e956b0ba04
Add filter software by CVE and make osquery-perf also push vulnerable software (#3902)
* Add filter software by CVE and make osquery-perf also push vulnerable software

* Update based on review comments
2022-01-28 10:05:11 -03:00
Tomas Touceda
1667fdcf22
Add vulnerabilities webhook config (#3897)
* Add vulnerabilities webhook config

* Fix tests

* Update documentation

* Update docs
2022-01-27 10:48:46 -03:00
Tomas Touceda
ffabf803a3
Aggregate munki and mdm data (#3886)
* Aggregate munki and mdm data

* Update doc

* Use reader to read

* Reader to read

* Address review comments
2022-01-26 17:55:07 -03:00
Martin Angers
a6f3f02a85
Cleanup unused software after calculating the count of hosts (#3887) 2022-01-26 11:32:42 -05:00
Martin Angers
9a0f749641
Add hosts_count field to "list software" endpoint (#3873) 2022-01-26 09:47:56 -05:00
Martin Angers
39b34508a9
Try to fix flaky publisher-has-listener redis test (#3876) 2022-01-26 08:13:01 -05:00
Martin Angers
8b8cebb6fe
Migrate remaining user-authenticated endpoints (#3796) 2022-01-25 09:34:00 -05:00
Tomas Touceda
a18e09b613
Simplify fleetctl implementation and improve testing (#3830)
* Simplify fleetctl implementation and improve testing

* Add a few more

* Handle not founds better

* Fix tests

* Check that logout ds func is called
2022-01-24 16:40:51 -03:00
Tomas Touceda
f02bef6f2c
Add platform filter to host_summary (#3845)
* Add platform filter to host_summary

* Add documentation

* Actually forward the platform param down the chain

* Update mock

* Update mock
2022-01-24 14:49:21 -03:00
Lucas Manuel Rodriguez
81672ee50e
Add dev sql interceptor for logging of queries (#3815)
* Add dev sql interceptor for logging of queries

* Remove extra spaces and tabs from queries

* Make regex global
2022-01-21 14:28:21 -03:00
Tomas Touceda
9d572309ae
Add sentry (#3669)
* Add sentry

* Fix gosum

* More gosum fixes

* Add missing def for config

* Enrich sentry scope a bit

* Add changes file

* Add goroutine safe scope to errors

* Encapsulate sentry logic

* Add documentation for new flag

* Add sentry capturing to crons and other background tasks

* Only send to sentry when enabled
2022-01-20 16:41:02 -03:00
Zach Wasserman
4a70cd69fa
Shorten "simple" query API period to 25s (#3775)
This helps the period stay under the default request timeouts for most
load balancers.

Some default timeouts:
* AWS ALB - 60s
* Nginx - 60s
* GCP LB - 30s
2022-01-19 17:48:57 -08:00
Lucas Manuel Rodriguez
e5cb68cee9
Return 404 when listing policies for a team that does not exist (#3793)
* Return 404 when listing policies for a team that does not exist

* Set mock for auth test
2022-01-19 18:17:42 -03:00
Lucas Manuel Rodriguez
77c3a8a61e
Fix flaky TestPolicyWebhooks (#3777)
* Fix flaky TestPolicyWebhooks

* Run test redis cleanup before running tests
2022-01-19 16:17:00 -03:00
Lucas Manuel Rodriguez
47df5e83fe
Return 400 when trying to create packs, queries and policies with empty names (#3761)
* Return 400 when trying to create packs, queries and policies with empty names

* Amend sql query test
2022-01-19 16:07:58 -03:00
Martin Angers
afb3310937
Migrate team-related endpoints to new pattern (#3740) 2022-01-19 10:52:14 -05:00
Tomas Touceda
eee539cccc
Issue 3707 clean targets on delete (#3739)
* wip

* Delete targets when deleting teams, hosts, and labels

* Add changes file

* Fix error message

* Remove unused teamsTable

* Cleanup new pack

* Clean new packs at end of test
2022-01-19 10:28:08 -03:00
Zach Wasserman
a79d5fbfcc
Optimize users detail query (#3754)
@Smjert reported instances of Windows Domain Controllers having massive
resource utilization and being killed by the watchdog when running this
query. In his test environment, this new query performs much better.
2022-01-18 16:39:32 -08:00
Zach Wasserman
6232bfa1d6
Include browser extensions in software inventory (#3733)
Use appropriate JOINs against users table to include all results.

For #3557
2022-01-18 12:46:04 -08:00
Tomas Touceda
f85941e60c
Use time.after instead of time.tick to not leak (#3751) 2022-01-18 16:50:15 -03:00
Lucas Manuel Rodriguez
d4243d0a72
Team observers can browse global policies (#3737)
* Allow team observers to browse global policies

* Add integration core test for team observer

* Fix integration tests
2022-01-18 13:18:40 -03:00
Martin Angers
f19e676e62
Refactor async host processing to avoid redis SCAN keys (for policies) (#3657) 2022-01-18 09:56:43 -05:00
Tomas Touceda
b47cf3d2d4
Better jitter (#3716)
* Better jitter

* Fix lint

* Use milliseconds

* Make duration milliseconds

* Update based on Lucas' suggestion

* Add changes file

* Panic on error

* Fix compilation error
2022-01-18 11:29:57 -03:00
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
gillespi314
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
Lucas Manuel Rodriguez
c5375263b6
Change policy platforms name to platform singular (for consistency) (#3221)
* Change policy platforms name to platform singular

* Fix fleetctl tests
2021-12-06 13:56:28 -03:00
Martin Angers
b84ef79bf4
Add the fleetctl debug {errors,db-locks} sub-commands (#3168) 2021-12-06 09:26:01 -05:00
Lucas Manuel Rodriguez
b9a408704e
Add platforms field to policies (#3181)
* Add platforms field to policies

* Fix fleetctl tests

* PR review changes

* Add missing tests

* Add changes for ListPoliciesForHost
2021-12-03 15:33:33 -03:00
Tomas Touceda
142006cbdd
Issue 2099 enable vulnerability processing new installs (#3104)
* Enable vulnerability processing by default

* Add changes file

* Remove wrong env var

* Fix import

* Fix tests

* Update log line

* Remove unneeded import
2021-12-03 14:44:57 -03:00
Tomas Touceda
17bd4d5110
Remove policy membership history and only store the latest value (#3178)
* Remove policy membership history and only store the latest value

* Address review comments

* Correct error msg wrap
2021-12-03 13:10:11 -03:00
Tomas Touceda
5cff07f332
Issue 3184 drop event host expiry (#3185)
* Drop event host_expiry if it exists

* Add changes file
2021-12-03 12:34:58 -03:00
Tomas Touceda
a0404b6736
Add software count API (#3105)
* Add software count API

* Fix makefile

* Fine no mock generating at this point

* Actually, one last try

* Use go install instead

* Fix go sum/mod

* Improve documentation

* Try setting node to 14
2021-12-03 10:54:17 -03:00
Martin Angers
7464e72ba8
Move carves endpoints to new endpoint pattern (#3148) 2021-12-01 15:45:29 -05:00
Tomas Touceda
3a031e946d
Sort hostIDs before inserting seen time (#3162)
* Sort hostIDs before inserting seen time

* Fix status test

* Add comment
2021-12-01 16:20:54 -03:00
Lucas Manuel Rodriguez
e64a88d8b1
Add COALESCEs on all host_seen_times JOINs (#3147)
* Add COALESCEs on all host_seen_times JOINs

* Use tx instead of d.writer

* Add unit tests

* Fix compile test
2021-12-01 09:05:23 -03:00
Tomas Touceda
4ef9cfdf63
Increase grace period of status for hosts (#3151)
* Increase grace period of status for hosts

* Update tests

* Update more tests
2021-11-30 18:37:27 -03:00
Tomas Touceda
925d4df8f7
Add new disable_failing_policies query parameter to list hosts (#3123)
* Update documentation

* Update based on review comments

* Explain why the switch exists
2021-11-29 18:04:33 -03:00
Tomas Touceda
c82a8e8428
Sanitize OrderKey (#3128) 2021-11-29 18:03:19 -03:00
Tomas Touceda
036093874d
Add cursor pagination to list hosts (#3120)
* Add cursor pagination to list hosts

* Update docs

* Update based on review comments
2021-11-29 15:06:00 -03:00
Tomas Touceda
a36e029d95
App config caching per instance (#3071)
* Do caching of app config per instance instead of across all of them in redis

* Add changes file

* Simplify code based on review comment

* Use go-cache instead of creating our own

* Dont export consts

* Copy app config before returning it

* Fix lint

* Update go sum

* Update go sum
2021-11-29 12:51:57 -03:00
Martin Angers
5c113bd468
Refactor ListActivities to new endpoint pattern (#3115) 2021-11-29 08:12:22 -05:00
Lucas Manuel Rodriguez
c6fc91f2e4
Fix ListPoliciesForHost, missing filter by teams (#3106)
* Fix ListPoliciesForHost, missing filter by teams

* Amend existing tests
2021-11-24 18:17:44 -03:00
Martin Angers
c997f853e5
Make creation of http.Client uniform across the codebase (#3097) 2021-11-24 15:56:54 -05:00
Lucas Manuel Rodriguez
964f85b174
Amend policy creation and spec (for proprietary query), and add update APIs (#2890)
* Amend policy creation (proprietary query), add update APIs

* Fix Datastore.SavePolicy bug (and add tests)

* Add integration tests for new policy APIs

* Add author email

* Add activities

* Push breaking changes for return policy fields

* WIP

* Add integration test for host policies

* Make more improvements to policy representation

* Improve upgrade code (from PR review comments)

* PR changes

* Revert activities for policies

* Use *uint instead of uint for queryID, use fleet.PolicyPayload

* Filter out other schemas

* New policy flow (#2922)

* created new policy flow -- no API connection

* added api props

* fixed prop name

* lint fixes

* removed unused modal; fixed style

* name, desc icons; created global components

* lint fixes

* ignoring certain files and lines for prettier

* Update frontend/pages/policies/PolicyPage/PolicyPage.tsx

* Make policy names unique across deployment

* Amend upgrade script

* Fix migration for unique names

* Do not deduplicate but instead rename policies

Co-authored-by: Martavis Parker <47053705+martavis@users.noreply.github.com>
2021-11-24 14:16:42 -03:00
Tomas Touceda
c65f8507fe
Remove host counts from software (#3082)
* Remove host counts from software

* Actually remove the host count from the struct

* Fix get test
2021-11-23 15:50:51 -03:00
Martin Angers
67293aca95
Add tests to SSO/SAML implementation (#2997) 2021-11-23 08:25:43 -05:00
Tomas Touceda
4cd9dab577
Update shell in host users when they exist (#3072) 2021-11-23 10:23:12 -03:00
Lucas Manuel Rodriguez
028c2643f7
Fleet serve to exit if migrations are missing (default) (#2803)
* Add option to fleet to exit if migrations are missing

* Reverse serve exit migrations logic

* Fix typo
2021-11-22 14:47:24 -03:00
Lucas Manuel Rodriguez
0642bfdb1d
Add fleetctl debug migrations command to get missing migrations (#2967)
* Add fleetctl command to get missing migrations

* Fix copy paste and lint

* Detect migrations applied out of order

* Add extra bullet to changes

* Trigger creation of migration status tables

* Fix unit tests

* PR fixes

* PR comment fixes
2021-11-22 14:06:12 -03:00
gillespi314
886b30fc4a
Remove five-row limit for teams search (#3021) 2021-11-22 09:30:55 -06:00
Martin Angers
69a4985cac
Use new error handling approach in other packages (#2954) 2021-11-22 09:13:26 -05:00
Zach Wasserman
e04f210f51
Disable storage of errors (#3066)
This is a temporary mitigation for the issue described in #3065.

The intent is to merge this, cut a 4.6.1 release, and then come up with
a more comprehensive solution for 4.7.0.
2021-11-21 21:02:20 -08:00
Lucas Manuel Rodriguez
59e01fbe08
Make fleetctl apply -f fail with unknown kind: config fields (#3026)
* Make fleetctl apply fail with unknown fields

* Add unit test
2021-11-19 12:37:36 -03:00
Tomas Touceda
887e42650b
Further optimize host select with policies (#3013)
* Further optimize host select with policies

* Add missing row close

* Improve migration

* Skip migration if column already exists

* Add test for host with/without extras
2021-11-18 14:36:35 -03:00
Lucas Manuel Rodriguez
cb54d9a8dc
Fix duplicate schedules and platform matching on scheduled queries (#2977)
* Fix duplicate schedules and platform matching on scheduled queries

* scheduled_queries.platform can be NULL

* Add unit tests

* Add rhel host and check zero stats
2021-11-17 19:03:30 -03:00
Tomas Touceda
ddbfb7f621
Allow sort by more than one key (#2987)
* Allow sort by more than one key

* Add test for multi sort

* Expand documentation
2021-11-17 16:37:26 -03:00
gillespi314
bfdedd65e8
Allow API user to delete all team secrets (#2941) 2021-11-17 10:26:24 -06:00
Tomas Touceda
77a91a7ab7
Add new index to policy_memership_history (#2973)
* Add new index to policy_memership_history

* Fix typos
2021-11-17 11:42:24 -03:00
Zach Wasserman
e279dc1682
Implement fleetctl updates rotate (#2831)
Add support for updating keys used in the TUF update system.
2021-11-15 10:01:48 -08:00
Martin Angers
a4b0d9d4a1
Add team_id to host summary when filtered for a specific team (#2869) 2021-11-15 09:56:13 -05:00
Martin Angers
f8d118af34
Add tests for hosts dynamic where clause (#2882) 2021-11-15 09:55:27 -05:00
Martin Angers
45168bed1d
Remove deprecated app_configs table (#2884) 2021-11-15 09:34:51 -05:00
Martin Angers
3ae57a0242
Create errors with ctxerr, add the call to store them in redis (#2786) 2021-11-15 09:11:38 -05:00
Lucas Manuel Rodriguez
1f560c56a2
Return all scheduled queries and their stats on the host fetch API (#2855)
* Return all scheduled queries and their stats on the host fetch API (pack_stats)

* Use 'pack' instead of null and wrap errs with ctxerr
2021-11-12 08:18:25 -03:00
Tomas Touceda
a0730ca643
Add update invite API (#2837) 2021-11-11 17:33:06 -03:00
gillespi314
3e2dad8caa
Add login shell information to host users table (#2854) 2021-11-11 11:26:03 -06:00
gillespi314
229b91b530
Add endpoint for management of team enroll secrets (#2849) 2021-11-11 10:45:39 -06:00
Tomas Touceda
b802af6f44
Add host count to software API (#2879)
* Add host count to software API

* Update docs

* Update fleetctl tests to account for host counts

* Update docs to mention host_count special case

* Update func comment
2021-11-11 08:49:17 -03:00
Tomas Touceda
88b32d8c7f
List policies for hosts even if they don't have stats (#2865) 2021-11-11 08:40:32 -03:00
Tomas Touceda
b95bb52c89
Issue 2868 ignore admin reset password sso (#2877)
* Ignore admin forced password reset if sso is enabled

* Add tests for authenticatedUser

* If SSOEnabled is true, then set AdminForcedPasswordReset to false

* Update tests to cover new password reset and sso flow

* Add changes file
2021-11-10 19:30:15 -03:00
Martin Angers
b7ed3589a8
Fix where clause building with right hosts alias (#2875) 2021-11-10 12:24:19 -05:00
Tomas Touceda
058ee84419
Change quote so it doesn't display as weird chars in webhooks (#2861) 2021-11-09 18:58:22 -03:00
Martin Angers
b57b64ccb2
Add total and per platform counts to host summary endpoint (#2845) 2021-11-09 09:35:36 -05:00
Tomas Touceda
cc7a405f93
Enable software inventory for new installations (#2852) 2021-11-09 10:28:14 -03:00
Tomas Touceda
d0777ccfd3
Change message for text so webhook works on slack (#2838)
* Change message for text so webhook works on slack

* Update preview text for the webhook in the FE
2021-11-08 15:13:02 -03:00
Lucas Manuel Rodriguez
bb187a7885
Fix flaky TestSoftware/filters_by_team_and_paginates (#2835) 2021-11-08 13:07:42 -03:00
Tomas Touceda
7db6de7278
Serialize hosts writes per instance (#2753)
* Serialize hosts writes per instance

* Write hosts asynchronously

* Dont make the save in a goroutine

* Revert "Dont make the save in a goroutine"

This reverts commit 4a890c5271142755dec69a741582e7eca5c4c62c.

* Make all savehosts async

* Address review comments and make this approach configurable

* Address review comments

* Disable bulk seen time marking for a test

* Move host seen times to a new table

* Remove unused

* Add seen_time to list hosts

* Add some jitter to seen time flushing

* Remove unused

* Add timeout to deferred save host

* Add tests for serialSaveHost

* Update hosts in labels and policy executions in a serial way

* Address review comments and remove fk constraints in host software

* Make errCh buffered

* Add changes file

* Readd key
2021-11-08 11:42:37 -03:00
Martin Angers
1b5ec19cf5
Add author_email to payload of queries (Get/List) (#2798) 2021-11-08 09:06:56 -05:00
Tomas Touceda
586c2f9ead
Properly parse order direction (#2812) 2021-11-05 13:36:05 -03:00
Lucas Manuel Rodriguez
837bfed167
Try goqu as sql builder on listSoftwareDB (#2773)
* Try goqu as sql builder on listSoftwareDB

* Fix case insensitive search and add test
2021-11-04 15:21:39 -03:00
Lucas Manuel Rodriguez
21908f31cf
GET packs to always return disabled field (#2799) 2021-11-04 14:25:08 -03:00
Tomas Touceda
2902da76ca
Issue 2027 better error visibility (#2069) 2021-11-02 13:35:57 -04:00
Lucas Manuel Rodriguez
43d1a8c9a0
Fix races in go tests and run with -race on CI (#2712)
* Fix races in go tests and run with -race on CI

* Fix race in pubsub

* Increase timeout to 15m for go tests

* CI takes forever, try disabling race

* Remove timeout from go tests
2021-11-01 15:31:01 -03:00
Lucas Manuel Rodriguez
8642bb785e
Add MVP support for software inventory to osquery-perf for load testing (#2751)
* Add MVP support for software inventory to osquery-perf for load testing

* Fix test compile
2021-11-01 15:23:31 -03:00
Martin Angers
a8735d55bb
Implement async processing of hosts for label queries (#2288) 2021-11-01 14:13:16 -04:00
Tomas Touceda
fcb5d5b392
Make vulnerability processing less RAM hungry (#2739)
* Make preview work when run from scratch (no orbit running)

* Make vulnerability processing less RAM hungry

* Add changes file

* Only get the cpe list once

* Remove cache

* Try killing osquery as well as orbit and clear their db dir

Co-authored-by: Lucas Rodriguez <lucas@fleetdm.com>
2021-10-29 11:27:12 -03:00
Tomas Touceda
1aea7484d4
Forward policy resolution (#2733)
* Pass through the resoution for the policy

* Update tests
2021-10-28 10:10:03 -03:00
dsbaha
51e35e1ba0
Implementation of a Kafka REST Proxy logging plugin (#2534)
This PR implements the status/result logger functions necessary interface with a Kafka REST Proxy service.  

Specifically, this is compatible with the [Confluent KAFKA Rest Proxy Service ](https://docs.confluent.io/1.0/kafka-rest/docs/intro.html).
2021-10-27 21:51:17 -07:00
Zach Wasserman
fe23fcd3ee
Add documentation to package launcher (#2669) 2021-10-26 21:12:44 -07:00
Tomas Touceda
623a38aa9d
Live queries post merge fixes (#2684)
* Refactor based on PR review comments

* Use deadline instead of duration

* Address review comments

* Only set the timeout once
2021-10-26 16:12:07 -03:00
Tomas Touceda
79f2c7c391
Issue 1798 rest api for live queries (#2675)
* wip

* wip

* Make tests not flaky

* Add changes file

* Make logging and authz thread safe

* Move cancel defer below err check
2021-10-26 11:33:31 -03:00
Lucas Manuel Rodriguez
3136cc105e
Replace into software to update empty bundle_identifier entries (#2676) 2021-10-26 09:48:25 -03:00
Martin Angers
c0e0e461e6
Allow empty TLS CA for Redis TLS connections (#2668) 2021-10-25 14:47:53 -04:00
Lucas Manuel Rodriguez
fb1e78d039
Make /refetch run labels and policies for the host (#2651)
* Make /refetch run labels and policies for the host

* PR rework changes
2021-10-25 15:46:49 -03:00
Tomas Touceda
3369436741
Remove policies yaml for now and apply policies in preview (#2644) 2021-10-25 09:17:34 -03:00
RachelElysia
36babcc510
UI feature: Frontend of performance impact bubbles (#2589)
Includes backend fixes and test
Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-10-22 16:05:49 -04:00
Luke Heath
99673eb148
Fix broken links to docs (#2561) 2021-10-22 12:39:20 -05:00
Lucas Manuel Rodriguez
c84cbb1679
Fix SearchHosts to match for one-char and two-chars queries (#2590)
* Fix SearchHosts to match for one-char and two-chars queries

* Add issue number for future reference
2021-10-21 17:46:21 -03:00
Tomas Touceda
bcf6697741
Handle null resolution in host details (#2622)
* Handle null resolution in host details

* Add test for null resolution
2021-10-21 15:53:23 -03:00
Lucas Manuel Rodriguez
91ae5ba870
By default, force password reset on CreateUser (#2570)
* By default, force password reset on CreateUser

* Use ptr.Bool and add test

* Add changes file

* Simple fix for e2e tests

* Add API changes
2021-10-21 15:00:38 -03:00
Zach Wasserman
35523017c9
Make migrations compatible with GTID replication (#2615)
* Make migrations compatible with GTID replication

Fixes an issue some deployments encountered when migrations used a
statement that is unsupported in GTID replication mode (#2462).

Local dev MySQL now enforces this consistency, so it should be easier to
maintain compatibility going forward.

* Update docker-compose formatting

* if exists
2021-10-21 07:46:02 -03:00
Tomas Touceda
923d094471
Allow to skip loading CVEs in some cases (#2611) 2021-10-20 19:26:25 -03:00
Tomas Touceda
c2696c1261
Issue 1892 query perf everywhere (#2580)
* wip

* wip

* wip

* Add performance stats

* Add docs and other self review fixes

* lint

* Update based on review comments

* Add quick cleanup first and then reset to 1hr

* Reduce the load in the test
2021-10-20 18:35:38 -03:00
Tomas Touceda
cbe931c0e9
Add vulnerable filter for software and also wire up the query search (#2604)
* Add vulnerable filter for software and also wire up the query search

* Add documentation

* Update to use software list options
2021-10-20 18:01:20 -03:00
Tomas Touceda
86b1926d7c
Add missing join condition (#2586) 2021-10-20 13:24:51 -03:00
Tomas Touceda
c3f7577bd8
Add query description and resolution to the list of policies in hosts (#2584)
* Add query description and resolution to the list of policies in hosts

* Add docs

* Fix get host tests
2021-10-20 12:07:16 -03:00
Martin Angers
07cf136d03
Add TLS support to Redis connections (#2568) 2021-10-20 10:09:18 -04:00
Tomas Touceda
fe5660e006
Reimplement host expiration to not need mysql events (#2552)
* Reimplement host expiration to not need mysql events

* Update mocks
2021-10-19 17:47:37 -03:00
Martin Angers
a7420140ce
Use a redis cluster-friendly store for rate limit (#2577) 2021-10-19 16:24:13 -04:00
Martin Angers
b1bd3aee5b
Try to fix flaky redis standalone test on ci (#2553) 2021-10-18 11:08:36 -04:00
Tomas Touceda
b783b5721f
Add RoleAdmin to ValidTeamRoles for verification (#2551) 2021-10-18 11:38:47 -03:00
Martin Angers
057d4e8b2e
Add configuration and support for Redis to read from replicas (#2509) 2021-10-18 09:32:17 -04:00
Tomas Touceda
74960d74be
Update calls to new signature (#2536) 2021-10-15 10:48:44 -03:00
Tomas Touceda
89c6d18ed2
Issue 2293 reveal failing policies list host (#2528)
* Add host issues

* Update docs

* Remove comment

* Update tests
2021-10-15 07:34:30 -03:00
Tomas Touceda
d3a0d62902
Issue 2456 policies yaml (#2512)
* wip

* Add policy specs support

* Add documentation

* Make policy apply idempotent

* Fold in code

* Improve tests and simplify auth checks

* Lint and fix test
2021-10-15 07:34:11 -03:00
Tomas Touceda
bb1dc401a3
Load vulnerabilities alongisde the software (#2518)
* Load vulnerabilities alongisde the software

* Update docs
2021-10-14 13:51:41 -03:00
Zach Wasserman
4d6956b6cb
Remove usage of temporary table in migration (#2515)
Temporary tables were causing migration issues under some MySQL
configurations as discussed in #2462.
2021-10-13 16:25:08 -07:00
Tomas Touceda
0510075398
Issue 2134 add team admin role (#2499)
* wip

* Add team admin role and tests

* Revert change in invites

* Update permission doc

* Fix lint
2021-10-13 12:34:59 -03:00
Benjamin Edwards
16c5823692
add support for minio backend file carving (#2448)
* add support for minio backend file carving
* add changes file
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2021-10-12 15:32:06 -04:00
Tomas Touceda
28be73c410
Add missing software in list hosts response (#2492) 2021-10-12 15:59:01 -03:00
Tomas Touceda
782f276e0b
Issue 2050 add software filter list hosts (#2486)
* Add software_id filter to list hosts

* Add integration test for API endpoint

* Add doc

* Simplify sql query
2021-10-12 11:38:12 -03:00
RachelElysia
981028705e
Sentence Case: Throughout UI, tests, validators, docs (#2455) 2021-10-11 10:58:27 -04:00
Martin Angers
5e1f872ccb
Refactor ListHosts to new endpoint pattern (#2396) 2021-10-11 10:37:48 -04:00
Martin Angers
fce3e42abb
Refactor GetPack to new endpoint pattern (#2409) 2021-10-11 10:17:21 -04:00
Tomas Touceda
0fd569ebaf
Move migrations around and add missing column only if not available (#2461)
* Move migrations around and add missing column only if not available

* Add changes file

* Remove debug print

* Remove wrong import
2021-10-08 15:41:52 -03:00
Tomas Touceda
e08fcb949b
Fix logging of errors in kitlog (#2427)
* Fix logging of errors in kitlog

* Update error messages
2021-10-07 18:15:40 -03:00
Tomas Touceda
9b19e3ace6
Count can happen with only list permissions (#2441) 2021-10-07 14:25:04 -03:00
Martin Angers
3aef96e15c
Add test for fleetctl preview (#2388)
* Start a fleetctl preview test

* Add tests for fleetctl preview

* Fix setting of fleetctl auth token in test

* Add fleet instance vulnerabilities config to response of GetAppConfig

* Add checks that fleetctl preview enables vulnerability detection

* Adjust doc for get config API response

* Add the include-server-config flag to fleetctl get config

* Update test now that some of the PRs have been merged

Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-10-07 10:19:10 -03:00
Tomas Touceda
876aa0e366
Add host count API (#2356)
* Add host count API

* Add rest api docs

* Add host count for labels and address review comments

* Add regex for id
2021-10-07 08:25:35 -03:00
Tomas Touceda
9b809a2d35
Issue 1890 host details policy (#2410)
* wip

* Add policies to hosts
2021-10-07 08:11:10 -03:00
Tomas Touceda
f44c809d85
Check env var along with app config for software inv (#2406) 2021-10-06 14:17:33 -03:00
Tomas Touceda
1b611012df
Allow team maintainers to bulk delete hosts for teams they belong (#2399) 2021-10-06 12:58:01 -03:00
Tomas Touceda
1af3803cdb
Load all host values from the db to prevent overwriting columns with empty vals (#2394) 2021-10-06 09:27:53 -03:00
Tomas Touceda
02b2c64b89
Make software list not flaky, hopefully (#2387) 2021-10-05 18:26:02 -03:00
Tomas Touceda
70cf7aa0a0
Delete policies for hosts in teams before transferring them (#2383)
* Delete policies for hosts in teams before transferring them

* Add missing error check
2021-10-05 15:48:26 -03:00
Tomas Touceda
ddc6b300d4
Allow team maintainers to delete hosts from their teams (#2373) 2021-10-05 15:15:05 -03:00
Zach Wasserman
a2e9b539a1
Optimize policy_updated_at migration (#2362)
- Use `TRUNCATE TABLE` rather than `DELETE FROM` for improved performance.
- Move DDL statement after truncate to avoid issues with retries (due to
  column already being created).

#2360
2021-10-05 09:24:03 -07:00
Tomas Touceda
2df4389aa0
Ignore empty host users or software inventory (#2317)
* Ignore empty host users or software inventory

* Only store additional if it's not nil

* Update label/policy updated at when we record the executions and skip saving host

* Update changes file
2021-10-01 18:27:57 -03:00
Martavis Parker
b6659cfaaa
Refactored Manage Hosts (#2233)
* Add new feature: team policies

* Continue work on team policies

* Continue work on team policies

* Continue team policies

* Revert accidental deletion

* Rename variables

* code refactored; working on runtime errors

* updated front end docs

* Update URLs from team to teams, add tests for policy auth

* Fix test

* Continue work on team policies

* Add permission checks

* mange hosts functional and cleaned up; typing

* improved label logic

* added try catch to awaits

* lint fixes

* frontend unit tests don't work for functional components

* test fix

* revert

* Address errors related to refetch on window focus

* Add loading error check

* Fix typos in loading error checks

* Guard against invariant condition in useEffect

* Update links and routes for team policies

* lint fixes

* Update frontend/pages/hosts/ManageHostsPage/helpers.ts

Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com>

* Change inherited policies button, tooltip

* lint fixes

Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com>
Co-authored-by: Tomas Touceda <chiiph@gmail.com>
2021-09-30 12:32:06 -07:00
Tomas Touceda
36b4c0df5d
Allow team maintainers to read global policies and schedule (#2282)
* Allow team maintainers to read global policies and schedules

* Update docs
2021-09-29 14:07:10 -03:00
Tomas Touceda
d9f34b2c19
Issue 1840 bulk delete hosts (#2268)
* wp

* Add test by ids

* Add changes file

* Update docs and remove unneeded return values

* Address review comments

* Improve integration tests

* Use TearDownTest
2021-09-29 13:13:23 -03:00
Tomas Touceda
435178e93c
Add bundle identifier to software when available (#2220)
* Add bundle identifier to software when available

* Update docs

* Delete unneeded test
2021-09-28 18:13:34 -03:00
Tomas Touceda
e2caf46d6d
Issue 2133 team maintainer can edit delete queries (#2256)
* wip

* Team maintainers can edit and delete queries they authored

* Update documentation

* Fix test
2021-09-28 14:53:05 -03:00
Tomas Touceda
5695d2a9ae
Issue 2058 team maintainer add queries (#2255)
* Team maintainers can read and write team schedules

* Allow team maintainers to read and write team schedules
2021-09-28 13:34:43 -03:00
Tomas Touceda
685245c2bd
Cache app config in redis (#2205)
* Cache app config in redis

* Add changes files

* Replace string with constant

* Revert some test refactorign and duplicate a bit of test code

* Add test for AppConfig with redis failing

* Fix lint

* Use Doer so it works better in clusters

* Skip unmarshalling if we already did

* Allow to cache hosts if configured

* Omit the setting if empty

* Remove hashing, too much CPU

* Revert caching of host auth... needs a more thought through approach

* Remove config

* Remove old config

* Remove locker interface

* Fix test and address review comments
2021-09-28 10:01:53 -03:00
Tomas Touceda
2033d8208c
Add policy updated at (#2246)
* wip

* Add policy updated at interval and update the UI to use that

* Update rest api

* Fix tests
2021-09-27 16:27:38 -03:00
Tomas Touceda
5653f1e868
Update URLs from team to teams, add tests for policy auth (#2228)
* Update URLs from team to teams, add tests for policy auth

* Fix test

* Address review comments
2021-09-27 14:02:11 -03:00
Tomas Touceda
d81a6317a0
Return host count when modifying a label (#2221) 2021-09-24 15:56:55 -03:00
Tomas Touceda
8931163882
Don't check authViewer if there's no bearer token (#2200) 2021-09-23 12:44:04 -03:00
Tomas Touceda
6497e0ba2e
Improve performance of cascade host software migration (#2163) 2021-09-21 16:37:13 -03:00
Tomas Touceda
1f324339f8
Add jitter to intervals (#2158)
* Add max jitter percent config

* Fix jitter calc

* Remove comment

* Reduce test jitter to make tests less flaky

* Remove jitter entirely

* Document new config

* Fix doc link
2021-09-21 14:21:44 -03:00
Tomas Touceda
4650484960
Remove fk label membership (#2157)
* Remove fk from label membership

* Add changes file

* Fix tests

* No need to IGNORE anymore
2021-09-21 11:48:20 -03:00
Martin Angers
86dce785ae
Improve performance of the Go test suite (#2060)
Closes #1805
2021-09-20 14:09:38 -04:00
Lucas Manuel Rodriguez
c69937945a
Introduce entityName type for mysql entity table names (#2139)
* Introduce entity type to specify mysql table names for deleteEntit* functions

* Remove changes entry for issue (non-user facing changes)
2021-09-20 14:47:06 -03:00