fleetdm / fleet

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

"last_enrolled_at" key does not reflect MDM enrollment date #17710

Open pintomi1989 opened 7 months ago

pintomi1989 commented 7 months ago

Fleet version: <!-- Copy this from the "My account" page in the Fleet UI, or run fleetctl --version --> Reported in Fleet Fleet 4.47.0 Go go1.21.7 osquery 5.11.0 Fleetd 1.22.0 Web browser and operating system: Current version


💥  Actual behavior

Unexpected behaviour in the DEP / fleet sync flow on the getHost api data here are the steps we took:

What customer expected was the last_enrolled_at to be also null or empty whenever a device is deleted from Fleet.

Customer "internal sync & flow rely on this." Are they wrong on this assumption?

Also, we feel like the last_enrolled_at (or soon mdm_turned_on https://github.com/fleetdm/fleet/issues/17710) should update at the same time you update the “mdm” values (edited)

🧑‍💻  Steps to reproduce

  1. Enroll a host in a different Windows MDM.
  2. Attempt to migrate MDM enrollment to Fleet.

Questions to #g-mdm from @nonpunctual:

When an MDM enrolled device is deleted from Fleet should the "last_enrolled_at" date be "null" post deletion? Do we intentionally keep the "last_enrolled_at" date assuming that it might be necessary information if the same device enrolls again?

Customer assumes the field would be null post-deletion. I think this assumption is probably not aligned with with was built.

follow up on this: the customer is asking if they are seeing dates OTHER than 2000-01-01 00:00:00 in the last_enrolled_at field after deletion from Fleet, is that a bug? The way I read what you said above 2000-01-01 00:00:00 is the default for NEW records, not for devices that have records that have been deleted & re-added. Is that correct?

Answer from #g-mdm

Heads-up: last_enrolled_at is about osquery enrollment, not MDM!

When we create a new host entry after ingesting hosts from ABM, the last_enrolled_at value is set to 2000-01-01 00:00:00, which is our "zero" enrollment time. Could that be the "old" value they see?

Fleet defines enrollment as referring only to the fleetd agent installation/enrollment to the Fleet server.

By contrast, Fleet deliberately tries to avoid referring to MDM enrollment. Instead features are “turned on” in Fleet (which corresponds to MDM protocol enrollment).

For customers and other folks focused on MDM integrations (myself included), disambiguating the terminology we use is a big challenge

https://fleetdm.com/handbook/company/why-this-way#why-does-fleet-use-mdm-on-off-instead-of-mdm-enrolled-unenrolled

after a quick look, I don't see how that's happening, which makes me think it's a bug.

a long shot: maybe they have duplicate enrollments?

even if it's not a bug, it's at least a documentation improvement, because seems confusing.

valentinpezon-primo commented 7 months ago

Hi, typically it could corresspond to

MacOS:

Windows :

JoStableford commented 7 months ago

Related to a Slack conversation

nonpunctual commented 7 months ago

Please see https://fleetdm.com/docs/rest-api/rest-api#default-response30 json example to view the key / value that is being requested for changes. Thanks.

JoStableford commented 7 months ago

Related to a Slack conversation

nonpunctual commented 7 months ago

Whatever we call things works behind the scenes if customers are only using Fleet UI. I think once people are building integrations with the API, disambiguating the fields becomes more critical so maybe we need to revisit?

noahtalerman commented 7 months ago

Hey @pintomi1989, heads up, we brought this into the upcoming design sprint (4.49).