fleetdm / fleet

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

Wrong server URL for MDM enrolled hosts #9898

Closed roperzh closed 1 year ago

roperzh commented 1 year ago

Fleet version: 4.27.x

🧑‍💻  Expected behavior

When a host is enrolled into MDM, we assign the correct server URL for Fleet's MDM solution.

💥  Actual behavior

The URL is incomplete, causing the app to think that there are two different MDM solutions.

image

Note that one is https://dogfood.fleetdm.com(wrong URL) and the other https://dogfood.fleetdm.com/apple/mdm (correct URL)

More info

When a new host is enrolled into MDM we call this function:

https://github.com/fleetdm/fleet/blob/ad5229ddfa30e498f179d75ddc6f3613e74fa9bd/server/datastore/mysql/apple_mdm.go#L643

However, all the callers use AppConfig.ServerSettings.ServerURL as the serverURL parameter, so we should be using this helper in upsertMDMAppleHostMDMInfoDB

https://github.com/fleetdm/fleet/blob/ad5229ddfa30e498f179d75ddc6f3613e74fa9bd/server/mdm/apple/apple_mdm.go#L43-L45

fleet-release commented 1 year ago

Clouds of ease,
Fixing wrong URL bliss,
Fleet's MDM smiles.