Commit Graph

53 Commits

Author SHA1 Message Date
Roberto Dip
5544b2c579
account for pending hosts in bootstrap package filters (#11417)
https://github.com/fleetdm/fleet/issues/11395
2023-04-28 16:37:56 -03:00
Roberto Dip
5029ed5daf
automatically update the remote DEP profile when the server URL changes (#11423)
#11414
2023-04-28 15:26:38 -03:00
Gabriel Hernandez
bd9176d67e
UI for bootstrap package flows (#11288)
relates to #10935

This is the UI for all the flows around adding, removing, downloading,
and viewing information about a bootstrap package for fleet mdm. This is
pretty comprehensive but includes:

### Backend

**Update `Get host/id`** to include bootstrap package name

```json
{
  "macos_setup": {
    ...
    "bootstrap_package_name": "test.pkg"
  }
}
```

### Frontend

**UI for ABM not being set up**:


![image](https://user-images.githubusercontent.com/1153709/234018772-3221e27b-50a4-454e-8e9f-b62c9d349010.png)

**UIs for uploading, downloading, and deleting bootstrap package**:


![image](https://user-images.githubusercontent.com/1153709/234017915-871f252f-bf80-4282-9acf-5ebea12c6efa.png)


![image](https://user-images.githubusercontent.com/1153709/234018029-322a5f30-dd22-44e3-b9ae-a4af7acb68b4.png)


![image](https://user-images.githubusercontent.com/1153709/234018163-4b84a2ce-a064-4952-a63d-0c8307391052.png)

**UIs for seeing bootstrap status aggregate data**


![image](https://user-images.githubusercontent.com/1153709/234018107-455d63ab-5b2c-4727-ad20-eef6b269c336.png)

**UIs for filtering hosts by bootstrap status**


![image](https://user-images.githubusercontent.com/1153709/234018334-170fe93a-700e-48eb-b198-2a1cc54d31a7.png)

**UIs for seeing package status on host details and my device page**:


![image](https://user-images.githubusercontent.com/1153709/234018488-7b515db4-1248-4be7-8de3-9b74bb5d4795.png)


![image](https://user-images.githubusercontent.com/1153709/234018525-d653cb2d-9ef9-437e-8eba-141e557f4f39.png)

- [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] Manual QA for all new/changed functionality

---------

Co-authored-by: Roberto Dip <dip.jesusr@gmail.com>
Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com>
Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-04-27 16:10:41 +01:00
Roberto Dip
a23d208b1d
gate DEP enrollment behind SSO when configured (#11309)
#10739

Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com>
2023-04-27 09:43:20 -03:00
gillespi314
8df5f26bea
Add user activity logs for MDM bootstrap package endpoints (#11302) 2023-04-26 13:40:14 -05:00
Martin Angers
77855a5e1d
Add activities for macOS setup assistant. (#11310) 2023-04-26 10:37:03 -04:00
Roberto Dip
9068faf38f
Allow to configure SSO settings for MDM end user authentication (#11270)
Related to #10741, this adds a new key to app config named
`end_user_authentication`, which can be configured using the same keys
as the existing SSO feature.

Per the spec, if the feature is configured, it's implicitly enabled, at
least until we get to #10999.

Note that this only enables the SSO config, a second part of the ticket
with endpoints for the EULA will be tackled separately.
2023-04-25 12:16:33 -03:00
Martin Angers
582e85c876
Add support for the mdm.macos_setup.macos_setup_assistant key in fleetctl, API (#11296) 2023-04-25 09:36:01 -04:00
Roberto Dip
9cd51af022
fix flaky TestIntegrationsMDM/TestDEPProfileAssignment (#11304)
This test was failing because we can send other commands when a DEP
device is enrolling (eg: to install a bootstrap package) and the test
was assuming that the first command we'll always get is the command to
install `fleetd`.

We have discussed in the past (@gillespi314 suggested that is important)
increasing the accuracy of the timestamps in the `nano_commadns` table,
which is the proper fix for this.
2023-04-25 10:05:57 -03:00
gillespi314
a37d138f4b
Migrate MDM status values in datastore and API layers (#11278) 2023-04-24 16:27:15 -05:00
Roberto Dip
5c487890ca
add an endpoint to get an aggregate summary of bootstrap packages (#11156)
Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com>
Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-04-22 10:23:38 -05:00
Roberto Dip
ddb5894709
remove unused logic specific to DEP+Okta+ROP (#11261)
In #10338 we introduced logic to gate DEP profiles behind Okta auth
using the ROP flow.

We're not going to use that, and instead we're going to gate profiles
behind SSO, which can be used from multiple providers and supports SSO
(the initial motivation behind the ROP flow was to create a local user
account.)

This removes some of the old code, which was never used in
production/documented for the public to use.

At the moment I'm leaving the `mdm_idp_accounts` table and related
methods untouched, as it's unclear yet if we're going to need a similar
auxiliar table, and I would rather deal with the migrations all at once.
2023-04-21 14:57:52 -03:00
Martin Angers
c1d3f67e6f
Add fleetctl get mdm-commands command and supporting API endpoint (#11163) 2023-04-17 11:45:16 -04:00
Lucas Manuel Rodriguez
5aa5f8aae3
Add MDM configuration permissions to GitOps (#11207)
#8593 

Adding new MDM functionality to GitOps.

- ~[ ] 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)~
- [X] 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-04-17 12:08:55 -03:00
Lucas Manuel Rodriguez
1ebfbb14eb
New gitops role (#10850)
#8593

This PR adds a new role `gitops` to Fleet.
MDM capabilities for the role coming on a separate PR. We need this
merged ASAP so that we can unblock the UI work for this.

- [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
- ~[ ] 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-04-12 16:11:04 -03:00
Roberto Dip
a59b8a5096
various profile fixes (#11084)
### Related tickets

https://github.com/fleetdm/fleet/issues/10775
https://github.com/fleetdm/fleet/issues/10678
https://github.com/fleetdm/fleet/issues/11024
https://github.com/fleetdm/fleet/issues/11026

### What's happening

- Implemented the hashing mechanism defined by @mna in #10678, however
this mechanism is mainly relevant for batch profile updates via the CLI,
we can't leverage it when a host switches teams.
- Modified `BulkSetPendingMDMAppleHostProfiles` so when two profiles
with the same identifier are sheduled both for removal and update, the
function will now mark only the `install` as `pending` so it's picked by
the cron, and will `DELETE` the `remove` entry from the database so it's
not picked by the cron and never sent to the user.
- `GetHostMDMProfiles` and consequently the profiles returned in `GET
/api/_version_/fleet/hosts` return `host_mdm_apple_profiles.state =
NULL` as "Enforcing (pending", the distinction between `status =
'pending'` and `status IS NULL` is only useful for the cron, for users
both mean the same thing, and all our profile aggregations already
behave this way.
- Using the solution implemented by @gillespi314 in
https://github.com/fleetdm/fleet/pull/10998 we're now deleting the host
row from `host_disk_encryption_keys` if a host is moved from a team that
enforces disk encryption to a team that doesn't.


# Checklist for submitter

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

- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-04-08 23:23:36 -03:00
Roberto Dip
77e5c004f4
implement bootstrap packages during DEP enrollment (#11052)
#10213
2023-04-07 17:31:02 -03:00
Roberto Dip
40c5bb1c25
install fleetd on DEP enrolled hosts during enrollment (#10971)
https://github.com/fleetdm/fleet/issues/9459
2023-04-05 20:52:26 -03:00
Martin Angers
741a7aa5d0
Finalize MDM commands part 3: add the fleetctl get mdm-command-results command (#10964) 2023-04-05 10:50:36 -04:00
Roberto Dip
337d61c823
automatically install a fleetd configuration profile to relevant teams (#10910)
Related to #9459, this adds logic to the cron to add a
`com.fleetdm.fleetd.config` configuration profile to the
`apple_mdm_configuration_profiles` table.

As noted in the comments, this makes some assumptions:

- This profile will be applied to all hosts in the team (or "no team",)
but it will only be used by hosts that have a fleetd installation
without
  an enroll secret and fleet URL (mainly DEP enrolled hosts).
- Once the profile is applied to a team (or "no team",) it's not removed
if
  AppConfig.MDM.AppleBMDefaultTeam changes, this is to preserve existing
agents using the configuration (mainly ServerURL as EnrollSecret is used
  only during enrollment)
2023-04-04 17:09:20 -03:00
Martin Angers
e0e547f1a2
Finalize MDM commands part 2: implement fleetctl mdm run-command (#10866) 2023-04-03 14:25:49 -04:00
Roberto Dip
729c1e4042
automatically create DEP JSON profiles if none is set. (#10871)
#9569
2023-03-30 14:25:30 -03:00
Gabriel Hernandez
005956f9bc
Feat/implement api for disk encryption status aggregate (#10422)
relates to #9434

implements the `GET /fleet/mdm/apple/filevault/summary` aggregate
endpoint.

- [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] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests

---------

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-03-28 15:50:14 +01:00
Martin Angers
b6e10eb6da
Update host MDM profile status to pending in response to triggering events (#10443) 2023-03-27 14:43:01 -04:00
Martin Angers
2fb5aa629d
Normalize the naming of mdm settings, update docs and document missing ones (#10681)
#10408
2023-03-23 07:30:28 -03:00
Roberto Dip
09b6b8610f
delete all host MDM profiles when is unenrolled programatically through the API (#10603)
https://github.com/fleetdm/fleet/issues/10507
2023-03-20 19:37:15 -03:00
Roberto Dip
61a8a80514
allow to rotate disk encryption key from My Device (#10592)
Related to https://github.com/fleetdm/fleet/issues/8961

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-03-20 16:14:07 -03:00
Roberto Dip
f04ff27180
Prevent user action in profiles managed by Fleet (#10559)
related to https://github.com/fleetdm/fleet/issues/10547,
https://github.com/fleetdm/fleet/issues/10549,
https://github.com/fleetdm/fleet/issues/10550 and
https://github.com/fleetdm/fleet/issues/10552 this prevents user
interaction with fleet-managed profiles, including:

- batch actions
- individual POST/UPDATE/DELETE actions
- listing

# Checklist for submitter

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

- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
2023-03-17 18:52:30 -03:00
Roberto Dip
a1ca172c95
allow to set up a DEP flow gated by Okta auth (#10338)
#10271
2023-03-13 10:33:32 -03:00
Martin Angers
0d6b9b98d4
Add mdm.macos_settings disk encryption fields to the response of GET /hosts/{id} and device. (#10371) 2023-03-08 15:42:23 -05:00
Martin Angers
765c8754b6
Add enabled/disabled disk encryption activities and trigger profiles generation (#10319) 2023-03-08 08:31:53 -05:00
Martin Angers
50a2739609
Allow updating enable_disk_encryption via the Modify Team endpoint (#10208) 2023-03-06 09:54:51 -05:00
gillespi314
615052a9ac
Create new API endpoint to provide aggregate status count of MDM profiles applying to hosts (#10194) 2023-03-01 18:36:59 -06:00
Martin Angers
4593c49ec4
Add disk_encryption option to config and team YAML (#10185) 2023-02-28 15:34:46 -05:00
Martin Angers
e3ddb5f3ce
Support matching a host in orbit enrollment using the serial number (#9612) 2023-02-28 12:55:04 -05:00
gillespi314
5a988872a7
Filter removed mdm profiles from host details (#10074) 2023-02-23 14:33:36 -06:00
Roberto Dip
cc4d6c9a2c
fix: don't try to send commands to non MDM enrolled hosts (#10052) 2023-02-23 16:17:53 -03:00
Roberto Dip
e152b5ab07
adjust MDM integration tests to be more accurate (#10059) 2023-02-23 14:48:50 -03:00
Roberto Dip
262e9870e3
add a cron job to reconcile profiles (#9946)
https://github.com/fleetdm/fleet/issues/9590
2023-02-22 14:49:06 -03:00
Roberto Dip
5a09ac0bfc
refactor how we send Fleet initiated MDM commands (#9903)
https://github.com/fleetdm/fleet/issues/9590

- move the logic to send commands into its own service method that can
be used internally by cron jobs and other services.
- deprecate the use of `rawEnqueueCommand` as it's copyied from the
nanomdm codebase where it's used in other context as a general command
API handler
2023-02-17 16:26:51 -03:00
gillespi314
086964726d
Add API endpoints for MDM config profiles (#9817)
Issue #9586

# 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] Documented any API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)
- [ ] Documented any permissions 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
2023-02-17 09:28:28 -06:00
Martin Angers
4a1f3988f0
Add "edited macos profiles" activity when applying custom settings via fleetctl (#9862)
#9587 and #9639
2023-02-16 13:53:26 -03:00
Martin Angers
33f33163a9
Add macos custom profiles support via fleetctl apply (#9824) 2023-02-15 13:01:44 -05:00
gillespi314
8daead3ef5
Update route for hosts encryption key (#9821) 2023-02-14 12:17:31 -06:00
Roberto Dip
7cd581866a
add API endpoint to see disk encryption key (#9713)
https://github.com/fleetdm/fleet/issues/8708
2023-02-08 20:20:23 -03:00
Roberto Dip
ffed7f8ebe
return 422 status code if fleetdm.com returns any 4xx status for CSR (#9610)
Related to https://github.com/fleetdm/fleet/issues/9588, we now handle 4xx responses from the fleetdm.com server and forward those to the client.

At the time of this commit, the only 4xx response that wasn't already handled by the server is because of an invalid email domain, so we assume that, but we should look into establishing a pattern of error messages with the website instead.
2023-02-01 12:50:22 -03:00
Roberto Dip
4c4c114e96
add mocks + tests and move things around (#9574)
#8948

- Add more go:generate commands for MDM mocks
- Add unit and integration tests for MDM code
- Move interfaces from their PoC location to match existing patterns
2023-01-31 11:46:01 -03:00
Roberto Dip
b4f46bf91c
run go mod tidy and fix incorrectly imported dependency (#9529)
Two minor things are happening here:

1. A new direct dependency was added in #9489, this runs `go mod tidy`
to update `go.mod` and `go.sum`
2. `"go.uber.org/atomic"` was automatically imported instead of
`"sys/atomic"` in #9494
2023-01-27 14:51:27 -03:00
Martin Angers
d0e6891d10
Add endpoint to trigger CSR request for APNs on fleetdm.com (#9494) 2023-01-25 14:44:29 -05:00
gillespi314
1b4e8e692a
Add API endpoint to unenroll a host from Fleet's MDM (#9447) 2023-01-23 17:05:24 -06:00