Commit Graph

200 Commits

Author SHA1 Message Date
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
Katheryn Satterlee
1a103c52c0
Remove required password reset flag when creating new API-only user (#4666)
* Remove required password reset flag when creating new API-only user

* Add test for 'fleetctl user create' command

* Set NewUserFuncInvoked to false in between tests

Co-authored-by: Lucas Rodriguez <lucas@fleetdm.com>
2022-04-12 10:57:57 -03:00
Zach Wasserman
d15957b431
Make Orbit update interval configurable (#5032)
* Make Orbit update interval configurable

- Also increase default interval from 10s to 15m

* Add update-interval configuration to fleetctl package (#5050)

Co-authored-by: Lucas Manuel Rodriguez <lucas@fleetdm.com>
2022-04-11 17:42:36 -03: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
Noah Talerman
674e2bd672
Tweak output for fleetctl login --help (#4776)
Switch position of 'set' and 'config'
2022-03-23 16:40:16 -04:00
Lucas Manuel Rodriguez
eeb73a42db
Fleetctl preview to clean up osquery socket before starting orbit (#4729)
* Fleetctl preview to clean up osquery socket before starting orbit

* Use os.Remove
2022-03-22 18:00:00 -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
Lucas Manuel Rodriguez
f4d3159cc9
Fleetctl to package .app bundles for osquery (and changes for orbit to support them) (#4393)
* 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

* Trigger workflow on PR

* Fixes to ease handling of artifact

* Fix, do not use target name as dir

* Remove workaround
2022-03-15 16:04:12 -03:00
Michal Nicpon
c14640ca84
add sso to login help (#4481) 2022-03-08 09:24:04 -07:00
Kelvin Oghenerhoro Omereshone
ee28866fea
fix: change fleet to uppercase to conform to style guide (#4346) 2022-02-24 17:58:12 +01:00
Michal Nicpon
4ce23c7d1b
Add team targets to pack spec (#4272)
* skip flaky tests
2022-02-21 09:18:58 -07:00
Lucas Manuel Rodriguez
c641e39ef4
Allow disabling auto updates in fleetctl package and orbit (#4296)
* Add disable-updates flag to fleetctl and orbit

* Fix ruleguard execution error on make lint-go

* Introduce dev-mode for ease of development of orbit

* Add changes file
2022-02-18 15:42:39 -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
Michal Nicpon
15fef92c6e
fix format uint (#4221) 2022-02-15 15:03:27 -07: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
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
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
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
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
Lucas Manuel Rodriguez
a8135aa928
Fix typo and lint checks (#4013) 2022-02-03 17:06:49 -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
9f70ffd5c6
Amend fleetctl package tests to not hardcode orbit version (#3898)
* Amend fleetctl package tests to not hardcode orbit version

* Readd Version, it is indeed used

* Fix bool logic

* Readd opt.Version usage
2022-01-31 10:41:11 -03:00
Tomas Touceda
bf8eaa8431
Apply whole yaml not just queries in preview (#3919)
* Apply whole yaml not just queries in preview

* Remove dev stuff
2022-01-28 16:28:07 -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
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
Zach Wasserman
d55108fcbf
Alias fleetctl sandbox to fleetctl preview (#3803)
Preparing for some work the product team is planning to rebrand preview
to sandbox.
2022-01-19 22:12:28 -08:00
Lucas Manuel Rodriguez
61b21df79e
Add flags to fleetctl preview to set custom orbit and osqueryd update channels (#3683)
* Add channel options for orbit update on fleetctl preview

* Add changes

* Also set channels on orbit execution in preview
2022-01-14 18:25:26 -03: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
Zach Wasserman
4a3de40a94
Add no-hosts option to fleetctl preview (#3544)
Intended mostly for testing, this is documented only in the Fleet
handbook.
2021-12-31 15:13:28 -08:00
Lucas Manuel Rodriguez
2f4ecb1b6b
fleetctl package command to check for PEM file (#3375)
#3374
2021-12-29 17:32:55 -08: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
Lucas Manuel Rodriguez
5dc93a8c7a
Fix TestPackage version (#3484) 2021-12-23 15:13:38 -03:00
Zach Wasserman
51b19b445f
Prepare for Orbit 0.0.5 release (#3478) 2021-12-22 16:02:26 -08:00
Lucas Manuel Rodriguez
4213ddb141
Rename missing policy platforms to platform (#3334) 2021-12-10 13:55:49 -03: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
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
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
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
Tomas Touceda
4cb0060070
Prettify and compare strings instead of structs in fleetctl get tests (#3047)
* Prettify and compare strings instead of structs in fleetctl get tests

* Prettify JSON testdata

* Simplify scanner for multi json
2021-11-22 12:20:09 -03:00
Martin Angers
69a4985cac
Use new error handling approach in other packages (#2954) 2021-11-22 09:13:26 -05:00