Commit Graph

1386 Commits

Author SHA1 Message Date
Martin Angers
98bc2dc29a Fix conflicts 2024-03-05 08:11:28 -05:00
Victor Lyuboslavsky
05ff1ca52a
Adding backend support for running live queries with team_id=0 (No team) (#17258)
- API endpoint GET fleet/targets/count can target 'No team' with
team_id=0
- API endpoint POST fleet/queries/run (for async live queries) can
target 'No team' with team_id=0
#16350

API doc changes PR: https://github.com/fleetdm/fleet/pull/17267

# Checklist for submitter

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-04 16:08:10 -06:00
RachelElysia
316321e889
[released bug] Fleet Full stack: Allow teams filter when transferring hosts by filters (#17241) 2024-03-04 15:48:19 -05:00
Roberto Dip
e3712fb263
Don't run cleanup tasks or enqueue commands on SCEP renewals (#17303)
for #17232
2024-03-04 16:53:16 -03:00
Victor Lyuboslavsky
592a7450e3
Enabling setting host status webhook at the team level via REST API and fleetctl apply/gitops. (#17186)
Enabling setting host status webhook at the team level via REST API and
fleetctl apply/gitops.
#14916

Example payload:
```json
{
    "data": {
        "days_unseen": 3,
        "host_ids": [
            10724,
            10726,
            10738,
            10739,
            10740,
            10741,
            10742,
            10744,
            10745,
            10746,
            10747,
            10748,
            10749
        ],
        "team_id": 3,
        "total_hosts": 15,
        "unseen_hosts": 13
    },
    "text": "More than 86.67% of your hosts have not checked into Fleet for more than 3 days. You've been sent this message because the Host status webhook is enabled in your Fleet instance."
}
```

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-04 12:35:27 -06:00
Lucas Manuel Rodriguez
4acb713bf1
osquery-perf changes for Fleet downtime load test (#17310)
Including all the osquery-perf changes needed to perform #16423.
2024-03-04 15:10:10 -03:00
Jahziel Villasana-Espinoza
33a0324ebb
feat: adding, reading, and deleting flows for scripts updated to use new table (#17305)
> Related issues: #16842, #16843

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [x] Manual QA for all new/changed functionality
2024-03-04 11:00:08 -05:00
Jahziel Villasana-Espinoza
f3754e2674
fix: use correct copy in fleetctl error when applying profiles (#17318)
> Related issue: #16335, fixes issue QA found here:
https://github.com/fleetdm/fleet/issues/16335#issuecomment-1971560894

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-01 18:22:30 -05:00
Roberto Dip
730f8850ff
Add mdm wipe host feature (#17272)
relates to #9951

This adds the mdm host wipe feature to fleet. This includes:

1. adding wipe functionality in the fleet web UI
2. adding wipe functionality in the fleetctl CLI
3. adding API endpoints to wipe a host
4. Implementing wipe functionality on the fleet server.
2024-03-01 18:02:00 -03:00
Roberto Dip
152edb838b
fix flaky MDM test (#17307)
this one seems to be specially flaky and is blocking a couple of PRs
from being merged.
2024-03-01 17:54:42 -03:00
Victor Lyuboslavsky
4d7f947529
GET /hosts API endpoint can now populate policies with populate_policies=true query parameter. (#17270)
GET /hosts API endpoint can now populate policies with
populate_policies=true query parameter.
#16242

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-01 11:20:21 -06:00
Gabriel Hernandez
4fa50778ac merge main into feat-mdm-wipe-host 2024-03-01 17:08:41 +00:00
Sarah Gillespie
e0cb59d4cb
Surface MDM devices where DEP assignment failed (#16973) 2024-03-01 10:52:19 -06:00
Gabriel Hernandez
40892c9adb merge main into feat-mdm-wipe-host 2024-02-29 18:26:29 +00:00
Roberto Dip
0c08ec30f8
display disk encryption as 'verifying' while we check the key (#17259)
for #16593
2024-02-29 14:19:17 -03:00
Gabriel Hernandez
2efe53cc14
Add fleetctl cli wipe command (#17087)
relates to #10494

implement the fleetctl wipe commands

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2024-02-29 17:13:25 +00:00
Victor Lyuboslavsky
1a679d0882
Moving context.WithoutCancel outside defer. (#17260)
#17197

Fixing orphaned live queries when context is canceled

Co-authored-by: Lucas Rodriguez <lucas@fleetdm.com>
2024-02-29 13:39:27 -03:00
Gabriel Hernandez
4ee65ce184 Merge branch 'main' into feat-mdm-wipe-host 2024-02-29 11:22:31 +00:00
Jahziel Villasana-Espinoza
2d4a183789
feat: allow <Add> node in Windows MDM profiles (#17234)
> Related issue: #16335

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-02-28 15:05:13 -05:00
Martin Angers
1710e1c8ef
Remote Wipe: implement transition of "wiped" back to "unlocked" after re-enrollment (#17217) 2024-02-28 09:48:26 -05:00
Gabriel Hernandez
b692d7fa05 Merge branch 'main' into feat-mdm-wipe-host 2024-02-28 11:54:45 +00:00
Martin Angers
6c0e56ea73
Address multiple redis-related issues observed with live queries (#16855)
#16331 

Doc updates in a separate PR:
https://github.com/fleetdm/fleet/pull/17214

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality (smoke-tested locally
with osquery-perf simulating 100 hosts, ran a live query, a saved live
query, stopped naturally and stopped before the end, and again via
fleetctl)

---------

Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
Co-authored-by: Victor Lyuboslavsky <victor.lyuboslavsky@gmail.com>
2024-02-27 19:35:27 -06:00
Lucas Manuel Rodriguez
220e55269e
Fix orphaned live queries in Redis when client terminates connection (#17202)
#17197

The following endpoints have the issue:
```
curl -v -k -X POST -H "Authorization: Bearer $TEST_TOKEN" https://localhost:8080/api/latest/fleet/queries/758/run -d '{"host_ids": [15858]}'
# Hit Ctrl + C before the API returns.

curl -v -k -X GET -H "Authorization: Bearer $TEST_TOKEN" https://localhost:8080/api/latest/fleet/queries/run -d '{"query_ids": [758], "host_ids": [15858]}'
# Hit Ctrl + C before the API returns.

curl -k -X POST -H "Authorization: Bearer $TEST_TOKEN" https://localhost:8080/api/latest/fleet/hosts/15858/query -d '{"query": "SELECT * FROM osquery_info;"}'
# Hit Ctrl + C before the API returns.

curl -k -X POST -H "Authorization: Bearer $TEST_TOKEN" https://localhost:8080/api/latest/fleet/hosts/identifier/2A249326-34B7-4B1D-BEB5-9B3A23BC30E6/query -d '{"query": "SELECT * FROM os_version;"}'
# Hit Ctrl + C before the API returns.

redis-cli -h 127.0.0.1
127.0.0.1:6379> SMEMBERS livequery:active
# Will list the four live queries for 7 days... and Fleet will be in live query mode for such 7 days...
```

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-02-27 17:47:05 -03:00
Martin Angers
b95e723275
Fix handling of enable_disk_encryption: null in PATCH /config (#17212) 2024-02-27 15:43:31 -05:00
Victor Lyuboslavsky
02de6b5695
Adding full unicode/emoji support for team/policy names. (#17163)
#17027 
Added Unicode and emoji support for policy and team names.

I have the manual test steps in the issue:
https://github.com/fleetdm/fleet/issues/17027

# Checklist for submitter
- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-02-27 12:55:05 -06:00
Gabriel Hernandez
01af4b78cd Merge branch 'main' into feat-mdm-wipe-host 2024-02-27 14:23:43 +00:00
Martin Angers
e9dd418bb6
Fix case where the Remote Wipe causes the host's platform to become "unknown" and never reports "Wiped" (#17182) 2024-02-26 16:52:23 -05:00
Jahziel Villasana-Espinoza
941bfa6ca1
updates to how MDM solution names are calculated (#17112)
> Related issue: #16838

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-02-26 14:38:20 -05:00
Tim Lee
a0ca5dd1bf
Bugfix: Use CVE struct in Vuln Responses (#17140) 2024-02-26 11:29:59 -07:00
Martin Angers
a01241ec2e
Remote wipe: add API endpoint and activity (#17060) 2024-02-26 11:31:00 -05:00
Martin Angers
2dfb260850
Move nanodep dependency in monorepo (#16984) 2024-02-26 10:26:00 -05:00
Jahziel Villasana-Espinoza
2c93c21889
fix: show all Apple MDM profile errors in Fleet (#17070)
> Related issue: https://github.com/fleetdm/fleet/issues/16853

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-02-23 16:32:48 -03:00
Roberto Dip
92ffa2ca99
fix MDM SSO redirects (#17125)
In https://github.com/fleetdm/fleet/pull/16750 we introduced logic to
prevent POST requests to frontend endpoints.

The redirect for SSO was using `http.StatusTemporaryRedirect` as the
status code, which preserves the original request method (`POST` in this
case).

This changes the method to be `http.StatusSeeOther`, [per MDN][1]:

> This response code is often sent back as a result of PUT or POST. The
> method used to display this redirected page is always GET.

[1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-02-23 15:50:09 -03:00
Victor Lyuboslavsky
9e83339f3d
Merge branch 'main' into 15919-vulnerabilities-page 2024-02-22 16:27:15 -06:00
Victor Lyuboslavsky
f5f0797083
Fixing tests. (#17073)
Fixed failing tests after recent merge with main.
Also includes updated migration date.
2024-02-22 16:03:13 -06:00
Jacob Shandling
1cf7362968 Merge branch 'main' into 15919-vulnerabilities-page 2024-02-21 10:58:58 -08:00
Tim Lee
9ed0c193c8
Pluralize hosts_count (#16907)
#16906 

**IN DRAFT, WAITING ON https://github.com/fleetdm/fleet/pull/16897**

- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
Co-authored-by: Victor Lyuboslavsky <victor.lyuboslavsky@gmail.com>
2024-02-20 10:17:07 -06:00
Tim Lee
8cb6722df8
Return 0 count for team vulnerability (#16897)
#16891 

- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
Co-authored-by: Victor Lyuboslavsky <victor.lyuboslavsky@gmail.com>
2024-02-20 09:49:11 -06:00
Victor Lyuboslavsky
35ca4ee32b
Add team filter to software detail APIs (#16876)
#16787
2024-02-18 07:14:20 -06:00
Jahziel Villasana-Espinoza
05cfc3a364
Revert "fix: add observer and observer plus to lock/unlock permissions (#16886)" (#16924)
This reverts commit bd66898d38.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-02-16 10:52:14 -05:00
Sarah Gillespie
96bd31dc1f
Add validation to reject requests to enqueue scripts for plain osquery hosts (#16893) 2024-02-15 14:34:16 -06:00
Tim Lee
eb9a1df045
Host Vulnerability Filter (#16889) 2024-02-15 13:27:18 -07:00
Gabriel Hernandez
119d1df76f
add permission check to software titles/versions endpoints (#16561)
relates to #16052

This adds a team permission check the `GET software/titles/:id`
endpoint. If the user should not be able to get the software title if it
is not on a host that is on the same team as the user (e.g. software
title 1 is on host 1, which is on team 1. A user who is only on team 2
should get a 403 response)

The UI is also updated to show the access denied error page when the we
receive a 403 response for the software title

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Roberto Dip <dip.jesusr@gmail.com>
Co-authored-by: Roberto Dip <me@roperzh.com>
2024-02-15 17:22:27 -03:00
Jahziel Villasana-Espinoza
bd66898d38
fix: add observer and observer plus to lock/unlock permissions (#16886)
> Related issue: #16878

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Documented any permissions changes (docs/Using
Fleet/manage-access.md)
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-02-15 14:40:36 -03:00
Tim Lee
97cc6b844f 16475 vuln detail api (#16828) 2024-02-15 10:35:58 -07:00
Tim Lee
f1eeaf42f2 2 of 2: List Vulnerabilities API (#16695) 2024-02-15 10:35:43 -07:00
Victor Lyuboslavsky
e1aac9c776
Adding tests for new live query endpoints. (#16823)
# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [ ] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Documented any permissions changes (docs/Using
Fleet/manage-access.md)
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Manual QA for all new/changed functionality
  - For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
2024-02-14 09:43:21 -06:00
Lucas Manuel Rodriguez
a5a7df4527
Return 405 when receiving POST request on the route path (#16750)
#16182

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality
2024-02-14 12:40:43 -03:00
Victor Lyuboslavsky
967eddcb37
New live query API endpoint for custom query SQL. (#16810)
#16805 

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: Lucas Rodriguez <lucas@fleetdm.com>
2024-02-14 01:45:07 -03:00
Martin Angers
9082438580
Feature: Remote Lock for macOS, Windows and Linux (#16783)
Feature branch for the #9949  story.

---------

Co-authored-by: Jahziel Villasana-Espinoza <jahziel@fleetdm.com>
Co-authored-by: Roberto Dip <me@roperzh.com>
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
Co-authored-by: Sarah Gillespie <sarah@fleetdm.com>
2024-02-13 13:03:53 -05:00