Commit Graph

1141 Commits

Author SHA1 Message Date
Roberto Dip
48ee019507 fix unreleased issues for macOS DDM
for #17924 and #17923
2024-03-28 15:44:14 -03:00
Roberto Dip
e34b320ed5 Merge remote-tracking branch 'origin/main' into feat-macos-ddm 2024-03-27 11:58:22 -03:00
Martin Angers
8abee3e72d
Merge branch 'main' into feat-prefill-account-name 2024-03-27 09:53:02 -04:00
Roberto Dip
0be9f085b0
batch set declarations as pending when they're uploaded (#17876)
#17685
2024-03-27 10:44:22 -03:00
Lucas Manuel Rodriguez
ea92433c34
Disabling calendar policies removes scheduled calendar events (#17882)
#17230

Fix for the following scenarios:
- Team has only one policy with calendar enabled. Events are created on
user calendars. Then the user disables the calendar on such policy.
Expected behavior: Events on the user calendar should be cleaned up in
that scenario.
- Policy `platform` is edited (which removes `policy_membership`
entries) and we'd like to have the calendar event removed for the hosts
that do not apply anymore.

To cover these scenarios I changed `ds.GetTeamHostsPolicyMemberships` so
that it also returns hosts that have a calendar event AND have no
results on policies (returned as passing=1).
E.g. this could happen if there ARE calendar events for a team but with
a platform that doesn't match the host (so it has no results).
2024-03-27 10:33:09 -03:00
Martin Angers
b449900602 Regenerate schema.sql 2024-03-27 08:19:21 -04:00
Dante Catalfamo
7b13d9ce17
Add mdm_apple_declarative_requests table to log DDM requests (#17844)
#17792
2024-03-27 00:09:09 -03:00
Sarah Gillespie
1edd9f07bb
Update host details, list host filters, and MDM summary to include macOS declarations (#17866)
Issue #17619

---------

Co-authored-by: Roberto Dip <dip.jesusr@gmail.com>
2024-03-26 21:54:47 -03:00
Lucas Manuel Rodriguez
31fe9d17b9
More fixes to support users with hosts in same team and hosts in different teams (#17789)
#17441
2024-03-26 13:39:37 -05:00
Lucas Manuel Rodriguez
e8f177dd43
Additional changes to happy path and cleanup cron job (#17757)
#17441 & #17442
2024-03-26 13:39:37 -05:00
Lucas Manuel Rodriguez
9a8ac02bc1
Happy path implementation of the calendar cron job (#17713)
Happy path for #17441.
2024-03-26 13:39:36 -05:00
Victor Lyuboslavsky
2db8eb3c80
Update migrations for main rebase. 2024-03-26 13:39:36 -05:00
Victor Lyuboslavsky
63e9d49dfc
Calendar config updates -- policy table now has calendar_events_enabled (#17645)
# Checklist for submitter
- [ ] 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] 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-26 13:39:36 -05:00
Lucas Manuel Rodriguez
be0e89142f
Add migrations for calendar events (#17585)
#17230
2024-03-26 13:39:36 -05:00
Victor Lyuboslavsky
1c311b73be
Fleet in your calendar configs (#17462)
Sub-task for #17230 

# Configuration changes
App configuration:
```yaml
integrations:
  google_calendar:
    - email: name@service-account.com
      private_key: ***
      domain: fleetdm.com
```
Team configuration:
```yaml
integrations:
  google_calendar:
    email: name@service-account.com
    enable_calendar_events: true
    policies:
      - name: My policy
        id: 12
    webhook_url: https://example.com/policy-remediation
```

Note: Policy is looked up by name when configuration is set. The policy
id is set/updated by the server for internal use.

# Checklist for submitter
<!-- 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/`.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-03-26 13:39:36 -05:00
Roberto Dip
f0ad942a57
implement status reports for DDM commands (#17831)
for #17408
2024-03-26 10:40:35 -03:00
Roberto Dip
44727ace3b
fix issues with ddm CLI (#17826)
for #17404. I couldn't find tests for this portion of the code, so full
tests for this section will need to be added during freeze.
2024-03-25 17:36:26 -03:00
Roberto Dip
95df7e2b0b
implement DDM cron and protocol bits (#17791)
for #17399
2024-03-25 17:32:27 -03:00
Martin Angers
994040b1c9
Send DeviceConfigured MDM command after DEP enrollment (#17737) 2024-03-25 13:25:29 -04:00
Sarah Gillespie
60ba78fc9d
Additional backend support for DDM profiles (#17775) 2024-03-22 10:37:43 -05:00
Roberto Dip
495638b45a
bugfixes, integration and cleanup for DDM (#17756)
Improvements and fixes I found while integrating this

- Renamed db columns to match the profile tables for consistency
- Added columns to `host_mdm_apple_declarations`
- Removed `team_declaration_checksum_view`
- Remove the ad-hoc `MDMAppleRecordDeclarativeCheckIn`, I confused
myself by developing this using tests, the device actually sends an
`Acknowledged` response, which is recorded by nano
- Fixed bugs in the `declaration/../..` endpoints
    - The prefix for the endpoint is `declaration` without `s`
- The response needs to include a `ServerToken`, otherwise the
declaration fails
2024-03-21 13:12:32 -03:00
Sarah Gillespie
7dcfef38d4
Update name validations for POST /mdm/profiles endpoint (#17753)
Follow up for #17402
2024-03-21 12:25:28 -03:00
Sarah Gillespie
01e3b94e55
Update backend APIs for macOS DDM (#17734)
Co-authored-by: Jahziel Villasana-Espinoza <jahziel@fleetdm.com>
2024-03-20 14:15:07 -05:00
Sarah Gillespie
d56d0cde31
Update DDM protocol endpoints to use host UUID in support of profile labels (#17719) 2024-03-20 09:14:21 -05:00
Martin Angers
b0ab7bbdc4
Add enable_release_device_manually setting to team and no-team (#17698) 2024-03-19 13:21:16 -04:00
Sarah Gillespie
3d73174e90
Add macOS DDM protocol endpoints for tokens, declaration-items, and declaration/.../... (#17679) 2024-03-18 17:48:07 -05:00
Roberto Dip
93f040f7da
fix mysql 8+ test (#17702) 2024-03-18 17:35:18 -03:00
Roberto Dip
e26d23460c
record declarative checkin command responses (#17693)
this is to prevent nanomdm to send the DeclarativeManagement command
every time the host checks in.
2024-03-18 14:41:33 -03:00
Roberto Dip
dc87ac2271
add schema for DDM (#17636)
#17405
2024-03-14 18:08:19 -03:00
Sarah Gillespie
c2a7c670fa
Handle null case in datastore method to get host disk encryption status (#17541) 2024-03-14 10:01:20 -05:00
Jahziel Villasana-Espinoza
2b9487197c
feat: script content cleanup and column removal (#17374)
> Related issue: #17374

# 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-13 15:53:08 -04:00
Martin Angers
0f8192348b
Add missing index to MDM Windows enrollments table (#17559) 2024-03-13 11:27:37 -04:00
Victor Lyuboslavsky
ad5c0a90be
Team user should not access OS version on another team. (#17347)
#17117 
For `fleet/os_versions` and `/fleet/os_versions/[id]`, team users can no
longer access os versions on hosts from other teams.

### Team admin /os_versions - only returns os versions for the user's
team(s)
GET https://localhost:8080/api/v1/fleet/os_versions

### Team admin /os_versions/:id on 'No Team' - 403
GET https://localhost:8080/api/v1/fleet/os_versions/5

### Global admin /os_versions/:id?team_id does not exist anywhere - 404
GET https://localhost:8080/api/v1/fleet/os_versions/999999?team_id=1

# 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/`.
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-13 08:20:00 -05:00
Martin Angers
8d8181eb0d
Fix flaky test due to package-level test variable set in a separate test (#17393) 2024-03-13 09:12:19 -04:00
Victor Lyuboslavsky
1052b6b350
Reducing the number of deadlock errors. (#17290)
#16562

Based on local testing, these changes reduce the number of 'Deadlock
found' errors when multiple hosts share the same UUID.

The performance issues with vulnerability processing will be fixed as
part of issue https://github.com/fleetdm/fleet/issues/16858

# 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/`.
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-03-13 06:58:29 -05:00
Roberto Dip
525233efea
fix unreleased bug with ADE profile assignment (#17509)
for unreleased #17508
2024-03-08 16:45:18 -03:00
Jahziel Villasana-Espinoza
c808bba438
fix: don't show windows hosts when filtering by bootstrap package status (#17386)
> Related issue: #17341

# 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] Manual QA for all new/changed functionality
2024-03-06 15:07:48 -05:00
Sarah Gillespie
c29f0abf92
Update API and CLI to enable running scripts by name and team id (#17322)
TODO:
- Integration tests

# 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-03-05 08:53:17 -06:00
Martin Angers
16ba308039 Store script contents for wipe host via script 2024-03-05 08:51:57 -05:00
Martin Angers
88eeb9c1a4 Reorder database migrations 2024-03-05 08:22:11 -05:00
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
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
Martin Angers
0858f5a6f4
Scripts char limit: improve database migration performance and memory usage (#17338) 2024-03-04 13:51:32 -05: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
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
Gabriel Hernandez
e495144023 update schema file 2024-03-01 17:38:08 +00:00
Gabriel Hernandez
306133ae3b udpate migration timestamp for add fleet platform to host mdm action migration 2024-03-01 17:34:05 +00: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