fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3.02k stars 419 forks source link

Windows MDM protocol commands #13069

Closed noahtalerman closed 10 months ago

noahtalerman commented 1 year ago

Goal

User story
As an IT admin or Fleet contributor,
I want to send any command supported by the Windows MDM protocol
so that I can manage my Windows devices.

Requirements

Changes

Product

Engineering

QA

Manual testing steps

  1. ✅ Validate feature is available for both free and paid tenants, specifically:
    • ✅ Validate the Wipe command is not available for free tenants, all other commands are
    • ✅ Validate able to run Wipe command with paid tenant
  2. ✅ Validate user roles:
    • ✅ Maintainer and higher, as well as GitOps users can run commands
    • ✅ Observer/+ cannot run commands
    • ✅ Team Maintainer/Admin can only run commands on hosts assigned to their teams
  3. ✅ Validate feature is only available via CLI/API, no UI updates at this time
  4. ✅ Send test commands and validate results:
    • ✅ Results are returned (reference Figma for success/failure states)
    • ✅ If host is online, command runs when received
    • ✅ If host is offline, command runs when host is back online
  5. ✅ Validate no changes made to macOS MDM functionality
  6. ✅ Validate fleetctl get hosts --mdm returns results for both macOS and Windows hosts

Confirmation

  1. [ ] Engineer (@____): Added comment to user story confirming succesful completion of QA.
  2. [ ] QA (@____): Added comment to user story confirming succesful completion of QA.
noahtalerman commented 1 year ago

Hey @marko-lisica I added this story to the product board because you said you're going to have some extra capacity this design sprint.

I haven't filed a story for Windows configuration profiles yet but I will get to that this week.

noahtalerman commented 1 year ago

Screenshot 2023-08-28 at 11 56 32 AM

What is the STATUS if Fleet hasn't sent the command? What about if Fleet send the command but we haven't heard back from the host?

Hey @marcosd4h, follow up to our discussion today, do we get a status code back from the MDM protocol if we haven't heard back from the host?

If we do already, I don't think we need to show a Fleet status like "Pending" in this case.

@marko-lisica found the possible status codes in the Open Mobile Alliance document here (page 86).

noahtalerman commented 1 year ago
  • Each time the IT admin sends a command, Fleet sends a push notification to ask the device to check in to the Fleet server
  • Windows hosts ask for new commands once per day

Hey @marcosd4h I added the above to the "Requirements" section in this issue following our discussion today. See notes and questions below for more info from our call.

Each time the IT admin sends a command, Fleet sends a push notification to ask the device to check in to the Fleet server

  • Windows hosts ask for new commands once per day
  • Windows allows you to configure "short polling" and "long polling" intervals
  • We can disable short polling
  • We can set long polling to once per day. This is relatively arbitrary. We don't need the device to check in often because we're sending push notifications on every command.
noahtalerman commented 1 year ago

cc @marko-lisica @georgekarrv ^

marcosd4h commented 1 year ago

Do we get a status code back from the MDM protocol if we haven't heard back from the host

@noahtalerman The server should handle the case where the host is not available and return a proper status code. The protocol does not handle that AFAIK. On the other hand, when the target host is available, and there is some failure, the protocol should respond with a one the documented status code here

georgekarrv commented 1 year ago

If we built off of the worker package, there is the jobs table available in the db. Additionally we could design another system itself for this.

Jobs could have issues w/ throughput, locks and cron stats.

noahtalerman commented 1 year ago

We think Fleet will have to create this account as Fleet the organization (similar to Apple Enterprise Developer program).

@marcosd4h do you know what kind of account this is? This way, we can file a BizOps request to get some help on this.

Does this look right? https://learn.microsoft.com/en-us/windows/client-management/push-notification-windows-mdm#get-wns-credentials-and-pfn-for-mdm-push-notification

noahtalerman commented 1 year ago

We cut the ability for GitOps uses to run MDM commands. More context here: https://github.com/fleetdm/fleet/issues/13595#issuecomment-1755623534

noahtalerman commented 12 months ago

Learning from @marcosd4h today:

cc @georgekarrv @gillespi314 @roperzh

noahtalerman commented 11 months ago

Each time the IT admin sends a command, Fleet sends a push notification to ask the device to check in to the Fleet server

@marcosd4h just checking on this requirement.

At some point we discussed that, in order to achieve this, Fleet may have to register w/ Microsoft as an MDM solution. Is this still true?

marcosd4h commented 11 months ago

@noahtalerman, yes, that's correct. MDM relies on Windows Push Notification Services (WNS) to deliver the MDM wake-up call.

The steps to configure this are:

The PFN has to be configured on the target device through the DMClient CSP via MS-MDM (Replace Command). Also, the ChannelURI is device-specific and has to be retrieved via MS-MDM too (Get Command)

More details here and here.

FYI @roperzh @mna

noahtalerman commented 11 months ago

@marcosd4h thanks!

The steps to configure this are:

Fleet has to register a Developer account here Then obtain a Package Family Name (PFN) code The PFN and the ChannelURI can later be used to send the MDM wake up push notification to the desired system.

Sounds like we need to do that as part of this story.

cc @georgekarrv

roperzh commented 11 months ago

@sabrinabuckets over-communicating that I merged a fix for the blocking issue so this is ready again.

sabrinabuckets commented 11 months ago

Manual testing steps completed, feature is QA approved for release.

noahtalerman commented 11 months ago

C&C: Pricing page changes are here: https://github.com/fleetdm/fleet/pull/14934/files#diff-f109cc3f7421e05eddf317b7c6cc51395977e63a25dd9eed437985060ed796edR465

TODO Noah: Update this doc page to add Windows. Try to trim extra stuff from the docs.

fleet-release commented 10 months ago

Windows MDM commands, Fleet's touch as light as clouds, Admins' tasks smooth as streams.