Commit Graph

1645 Commits

Author SHA1 Message Date
Marcos Oviedo
22bb16bf2e
Pushing initial support for MS-MDE2 Discovery message (#12387)
This PR requires the Windows MDM configuration changes - This will be
updated next week

- [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] Documented any API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)
- [x] Documented any permissions changes
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality
  - For Orbit and Fleet Desktop changes:
2023-06-22 17:31:17 -03:00
Juan Fernandez
0c172c85c3
SSO Metadata URL can only be https/http (#12388)
When setting up SSO, validate that the Metadata URL has the proper scheme.
2023-06-22 08:17:37 -04:00
Juan Fernandez
d70ae633c0
Return proper status code if SMTP conf is invalid (#12389)
When setting up SMTP return the proper status code if config is invalid.
2023-06-21 14:40:26 -04:00
Juan Fernandez
d08cc18111
Don't analyze non-windows OS using the MSRC scanner (#12421)
Don't analyze non-windows OS using the MSRC scanner
2023-06-21 14:19:55 -04:00
gillespi314
8cc7d38300
Mark "verifying" or "verified" MDM profiles as "failed" if osquery cannot confirm they are installed (#12414) 2023-06-21 13:00:49 -05:00
Martin Angers
1c249b60da
Add support to configure and enable Windows MDM, notify elegible hosts (#12340) 2023-06-20 14:06:45 -04:00
Martin Angers
96aec85a0a
Add mechanism to force read from primary DB, use it for puppet matching (#12396) 2023-06-19 13:55:15 -04:00
Juan Fernandez
55d56ba2db
If the fleet/forgot_password endpoint is rate limited, it should return the proper status code (#12323)
Return proper HTTP status code if endpoint is rate limited.
2023-06-15 15:41:04 -04:00
Juan Fernandez
7226b7f087
Warnings in fleetctl should use Stderr not Stdout (#12316)
Fixed issue were the expired license banner was being sent to Stdout instead of Stderr
2023-06-15 13:13:41 -04:00
Juan Fernandez
e7ded8d0c8
When authorizing users on the PolicySpec endpoint, return proper status code if team not found (#12335)
Return proper status code on policy spec endpoint if team not found.
2023-06-15 12:46:54 -04:00
gillespi314
87fe00db71
Create new Fleet osquery extension table to read escrowed FileVault key (#12198) 2023-06-15 10:23:59 -05:00
Lucas Manuel Rodriguez
517acdad72
Add guide to configure process_file_events on CentOS 7 (#12322)
#11890

---------

Co-authored-by: Rachael Shaw <r@rachael.wtf>
2023-06-14 18:23:47 -03:00
Martin Angers
09d2ccd009
Add Windows MDM feature flag environment variable (#12306) 2023-06-14 08:44:42 -04:00
Martin Angers
68fa60c54d
Add a transferred_hosts activity when hosts are transferred to a new team (#12287) 2023-06-14 08:15:05 -04:00
Juan Fernandez
98d9f1b068
If user is a global/team observer/observer+, 'teams' endpoints should not include secrets (#12216)
Fixed auth. issue with Obs/Obs+
2023-06-08 17:30:34 -04:00
Roberto Dip
1ad80fa251
bugfixes + adjustments for the puppet module (#12221)
A few minor things going on:

1. Adjusted the Puppet module to send the profiles base64 encoded
2. Enabled FileVault by default on teams created using the `/match`
endpoint.
3. Remove profiles when a team is removed. We can't do a foreign key
because the global team.id is NULL. I also included a migration to
cleanup orphaned profiles.
2023-06-08 18:05:44 -03:00
Roberto Dip
ba68082543
return a 4xx error if a SSO session is not found (#12211)
for #12113
2023-06-07 21:12:44 -03:00
Martin Angers
de42164c53
Ignore fleet profiles when matching a set of custom profiles to a team (#12209) 2023-06-07 15:43:27 -04:00
Lucas Manuel Rodriguez
2a532ede94
Do not return empty SSO and SMTP settings for non-global-admins (#12180)
#11266

PS: I first attempted a serialization trick by introducing a new
`appConfigResponse` and implementing `json.Marshal` to exclude these
fields but it was too hacky and hard to maintain moving forward, so I'm
bitting the bullet now. Happy to hear other ideas.

- [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 API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)~
- ~[ ] Documented any permissions changes~
- ~[ ] 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.~
- [X] Added/updated tests
- [X] 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)).~
2023-06-07 16:06:36 -03:00
Martin Angers
68ddaafac0
Fix bug preventing gitops role from fleetctl applying macos setup assistant (and bootstrap package) (#12193) 2023-06-07 13:29:36 -04:00
Roberto Dip
6617938393
ensure we send post-enrollment commands if a DEP device is enrolling (#12159)
for #11257, h/t to @mna for the idea of resetting `token_update_tally`.

this is to cover scenarios where a host might be re-enrolling (eg: the
device has been wiped) but we don't know about it.

since `TokenUpdate` might be called multiple times during the lifecycle
of an MDM enrollment, we add a check on the value of
`nano_enrollments.token_update_tally`. For the scenarios described
above, the tally is still `> 0` even thought the host is enrolling for
the first time.

to mitigate this, we reset its value to 0 when we receive an
`Authenticate` message (which only happens only per enrollment)

I set the value to `0` because it's incremented to `current_value+1` by
nanomdm before calling our handler.
2023-06-06 20:18:14 -03:00
Juan Fernandez
801f38b80b
Renamed 'ChromeOS' label to 'chrome' (#12156)
Renamed 'ChromeOS' label to 'chrome'
2023-06-06 15:25:23 -04:00
Martin Angers
f27fcddd55
Prevent clearing macos updates settings when applying/modifying a team without those settings (#12160) 2023-06-06 14:31:33 -04:00
Roberto Dip
3127c9fffd
handle "modified" and "deleted" operation types in DEP sync (#12150)
for #10605, this modifies the cron used to ping the list/sync devices
API from ABM to account for the "deleted" and "modified" operation
types.

We know that:

1. Sometimes, Apple sends a "modified" operation type when a device's
MDM server is reassigned in ABM, up until now, we were ignoring these
devices.
2. Devices that are no longer assigned to Fleet in ABM can't be
migrated.
2023-06-06 15:04:59 -03:00
Juan Fernandez
1eb8bb800e
Bug: spec/labels endpoint should include the id (#12135)
spec/labels endpoint should include the ID prop
2023-06-06 09:11:03 -04:00
Martin Angers
9f064acd2e
Match pre-assigned profiles to a team (or create one) and assign host to team (#12127) 2023-06-05 15:08:21 -04:00
gillespi314
372c77ff23
Add backend for verified MDM profiles (#12078) 2023-06-05 12:05:28 -05:00
Martin Angers
48774876ea
Move post-DEP-enrollment processing to a worker job (#12017) 2023-06-05 11:58:23 -04:00
Roberto Dip
3fa809e167
strip query strings from MDM server_url during ingestion (#12107)
for #12106
2023-06-05 12:53:36 -03:00
Lucas Manuel Rodriguez
2d21b2be29
Provide more feedback to the user when there's a Redis connection issue when running live queries (#11947)
This could help future users to detect this issue: #10957
It also adds an error log in Fleet that prints the actual error.

The error is displayed if I kill Redis during a live session or if I set
`client-output-buffer-limit` to something real low like `CONFIG SET
"client-output-buffer-limit" "pubsub 100kb 50kb 60"`:
![Screenshot 2023-05-25 at 09 08
08](https://github.com/fleetdm/fleet/assets/2073526/f021a77a-3a22-4b48-8073-bae9c6e21a11)

- [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 API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)~
- ~[ ] Documented any permissions changes~
- ~[ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)~
- [X] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- ~[ ] Added/updated tests~
- [X] 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)).~
2023-06-01 16:11:55 -03:00
Sharon Katz
ae1f6f4396
step 1 double the freq from once a week to once every 3days (#11769)
Increase the statistics report frequency from once a week to once in 3
days.
The idea is to double it in slow steps to make sure the Heroku can
withstand it.

Goal is to get to once every few hours.
2023-06-01 09:40:42 -04:00
Roberto Dip
46ee3af436
fix issues with MDM migration modal (#12059)
For issues #12003 and #12051

# Checklist for submitter

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

- [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
2023-05-31 17:25:22 -03:00
Martin Angers
4322a28f5a
Implement preassign endpoint as first step to match profiles and hosts to teams (#12046) 2023-05-31 09:24:22 -04:00
Lucas Manuel Rodriguez
1349a08464
Useful to allow easy troubleshooting of process_file_events table (#12038)
Useful while working on #11890.

Hidden flags `--audit_debug`, `--audit_fim_debug`,
`--audit_show_partial_fim_events` and
`--audit_show_untracked_res_warnings` are useful when troubleshooting
the `process_file_events` table. This change allows setting the flags in
the agent settings:

![Screenshot 2023-05-30 at 16 28
41](https://github.com/fleetdm/fleet/assets/2073526/cd871c4e-a228-4010-9f0c-2c2d274b6f77)
2023-05-31 09:05:14 -03:00
Juan Fernandez
43ab81ee11
Feature 11829: Tailor host table response to ChromeOS (#12002)
Updated ingestion logic and fixed ChromeOS virtual tables to accommodate the requested UI changes.
2023-05-30 22:13:42 -04:00
Lucas Manuel Rodriguez
33d61044b5
Change role of existing users only if SSO attributes are present in the SAMLResponse (#11966)
#10784

The removal of the now deprecated `sso_settings.enable_jit_role_sync`
config will be tackled in: #10688.

- [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 API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)~
- ~[ ] Documented any permissions changes~
- ~[ ] 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.~
- [X] Added/updated tests
- [X] 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)).~
2023-05-30 17:49:59 -03:00
Lucas Manuel Rodriguez
6acb567ade
Accept and ignore SSO role attributes with null value (#11959)
#10878

- [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 API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)~
- ~[ ] Documented any permissions changes~
- ~[ ] 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.~
- [X] Added/updated tests
- [X] 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)).~
2023-05-30 16:57:03 -03:00
gillespi314
e2243d24bf
Insert "verified" to mdm_apple_delivery_status table (#12033) 2023-05-30 14:11:42 -05:00
Juan Fernandez
f711e60de4
Feature 1183: Updated validation rule for policies platforms (#12004)
Users should be able to create policies that target ChromeOS
2023-05-30 13:57:14 -04:00
Martin Angers
4a077793f5
Return 400 instead of 500 on Apple BM auth error (#11899) 2023-05-29 11:52:42 -04:00
Mo Zhu
e1a0021e7a
remove address column from network_interfaces chromeos table (#11787)
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2023-05-26 16:47:19 -05:00
Juan Fernandez
de7377e54f
ChromeOS support for Fleet dashboard (#11953)
- Added built-in label for ChromeOS
- Ingest os_version info from ChromeOS hosts.
2023-05-26 14:32:01 -04:00
Juan Fernandez
2d5477266a
Feature 10566: Optimize query used for listing activities (#11708)
- Added index on `created_at` which is the sort key used when loading the log activities widget on the dashboard.
- Refactored query used when loading activities to avoid a full table scan.
2023-05-25 15:50:36 -04:00
Lucas Manuel Rodriguez
6415f062c6
Reduce size of DistributedQueryResult to improve live query performance (#11882)
This was found while working on #10957.

When running a live query, a lot of unused host data is stored in Redis
and sent on every live query result message via websockets. The frontend
and fleetctl just need `id`, `hostname` and `display_name`. (This
becomes worse every time we add new fields to the `Host` struct.)

Sample of one websocket message result when running `SELECT * from
osquery_info;`:

size in `main`: 2234 bytes
```
a["{\"type\":\"result\",\"data\":{\"distributed_query_execution_id\":57,\"host\":
{\"created_at\":\"2023-05-22T12:14:11Z\",\"updated_at\":\"2023-05-23T12:31:51Z\",
\"software_updated_at\":\"0001-01-01T00:00:00Z\",\"id\":106,\"detail_updated_at\":\"2023-05-23T11:50:04Z\",
\"label_updated_at\":\"2023-05-23T11:50:04Z\",\"policy_updated_at\":\"1970-01-02T00:00:00Z\",
\"last_enrolled_at\":\"2023-05-22T12:14:12Z\",
\"seen_time\":\"2023-05-23T09:52:23.876311-03:00\",\"refetch_requested\":false,
\"hostname\":\"lucass-macbook-pro.local\",\"uuid\":\"BD4DFA10-E334-41D9-8136-D2163A8FE588\",\"platform\":\"darwin\",\"osquery_version\":\"5.8.2\",\"os_version\":\"macOS 13.3.1\",\"build\":\"22E261\",\"platform_like\":\"darwin\",\"code_name\":\"\",
\"uptime\":91125000000000,\"memory\":34359738368,\"cpu_type\":\"x86_64h\",\"cpu_subtype\":\"Intel x86-64h Haswell\",\"cpu_brand\":\"Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz\",\"cpu_physical_cores\":4,\"cpu_logical_cores\":8,\"hardware_vendor\":\"Apple Inc.\",\"hardware_model\":\"MacBookPro16,2\",\"hardware_version\":\"1.0\",
\"hardware_serial\":\"0DPQR4HMD1FZ\",
\"computer_name\":\"Lucas’s MacBook Pro\",\"public_ip\":\"\",
\"primary_ip\":\"192.168.0.230\",\"primary_mac\":\"68:2f:67:8e:b6:1f\",
\"distributed_interval\":1,\"config_tls_refresh\":60,\"logger_tls_period\":10,\"team_id\":null,
\"pack_stats\":null,\"team_name\":null,
\"gigs_disk_space_available\":386.23,\"percent_disk_space_available\":40,
\"issues\":{\"total_issues_count\":0,\"failing_policies_count\":0},
\"mdm\":{\"enrollment_status\":null,\"server_url\":null,\"name\":\"\",\"encryption_key_available\":false},
\"status\":\"online\",\"display_text\":\"lucass-macbook-pro.local\",\"display_name\":\"Lucas’s MacBook Pro\"},
\"rows\":[{\"build_distro\":\"10.14\",\"build_platform\":\"darwin\",
\"config_hash\":\"b7ee9363a7c686e76e99ffb122e9c5241a791e69\",\"config_valid\":\"1\",
\"extensions\":\"active\",\"host_display_name\":\"Lucas’s MacBook Pro\",
\"host_hostname\":\"lucass-macbook-pro.local\",\"instance_id\":\"cde5de81-344b-4c76-b1c5-dae964fdd4f2\",\"pid\":\"8370\",\"platform_mask\":\"21\",\"start_time\":\"1684757652\",
\"uuid\":\"BD4DFA10-E334-41D9-8136-D2163A8FE588\",
\"version\":\"5.8.2\",\"watcher\":\"8364\"}],\"error\":null}}"]
```

vs. size of the message result on this branch: 675 bytes
```
a["{\"type\":\"result\",\"data\":{\"distributed_query_execution_id\":59,
\"host\":{\"id\":106,\"hostname\":\"lucass-macbook-pro.local\",
\"display_name\":\"Lucas’s MacBook Pro\"},
\"rows\":[{\"build_distro\":\"10.14\",\"build_platform\":\"darwin\",
\"config_hash\":\"f80dee827635db39077a458243379b3ad63311fd\",
\"config_valid\":\"1\",\"extensions\":\"active\",\"host_display_name\":\"Lucas’s MacBook Pro\",
\"host_hostname\":\"lucass-macbook-pro.local\",
\"instance_id\":\"cde5de81-344b-4c76-b1c5-dae964fdd4f2\",\"pid\":\"8370\",\"platform_mask\":\"21\",
\"start_time\":\"1684757652\",\"uuid\":\"BD4DFA10-E334-41D9-8136-D2163A8FE588\",\"version\":\"5.8.2\",
\"watcher\":\"8364\"}]}}"]
```

Manual tests included running with an old fleetctl running with a new
fleet server, and vice-versa, a new fleetctl running against an old
fleet server.

- [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] Documented any API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)
- ~[ ] Documented any permissions changes~
- ~[ ] 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.~
- [X] Added/updated tests
- [X] 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)).~
2023-05-25 08:11:53 -03:00
Juan Fernandez
012a633866
Fixed query used when aggregating WinOS stats (#11840)
Aggregated stats on the dashboard page were showing the wrong WinOS version.
2023-05-24 22:11:43 -04:00
gillespi314
3e3880b62d
Modify GET /mdm/apple/profiles API endpoint to return empty array instead of null when results set is empty (#11904) 2023-05-24 18:56:39 -05:00
Juan Fernandez
2249d171bc
Return DB results even if nothing has changed (#11936) 2023-05-24 14:05:45 -05:00
Lucas Manuel Rodriguez
9f7383b9ff
Filter out "null" string in installed_path from osquery (#11931) 2023-05-24 12:28:20 -05:00
gillespi314
259d4fa1ac
Track host DEP assignments in new table (#11875) 2023-05-23 13:01:04 -05:00
Roberto Dip
d0658868dc
adjust the UI to show a refetching spinner on critical queries (#11868)
A possible solution for https://github.com/fleetdm/fleet/issues/11860,
this updates the "My Device" page to show the spinner rotating if
critical queries are being fetched:



https://github.com/fleetdm/fleet/assets/4419992/0a84508a-4df2-4da3-b9bc-b3e75bab5e82


# Checklist for submitter

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

- [x] Manual QA for all new/changed functionality
2023-05-23 12:43:50 -03:00