fleet/orbit/pkg/profiles
Roberto Dip 6e3248237c
read orbit profile configuration values using osascript in macOS (#12086)
The current approach to read the enroll secret and fleet url from a
configuration profile is not ideal because:

1. (important) We're looking for a profile with a `ProfileIdentifier`
equal to `com.fleetdm.fleetd.config`. This is not ideal because
`ProfileIdentifier` is often modified by MDM vendors to ensure that's
unique across all profiles in the system.
2. (nit) To look for the relevant profile, we were running `profiles
list -o stdout-xml`, which can output a large amount of data that we
need to parse and loop through to find the right profile.

I have also considered:

1. Reading the value from a file that gets created at `/Library/Managed
Preferences/com.fleetdm.fleetd.config.plist`, but I couldn't find any
official sources on the reliablity of this, and after consulting
internally and in the macAdmins slack I decided to not rely on it.
2. Keep on reading from the output of `profiles` but be smarter parsing
the output (we should still be able to find the right profile)

At the end, I decided to use osascript to read the value directly from
the system.
2023-06-01 20:50:52 -03:00
..
profiles.go Read enroll-secret and fleet-url from config profile on macOS (#10134) 2023-02-28 15:54:06 -03:00
profiles_darwin.go read orbit profile configuration values using osascript in macOS (#12086) 2023-06-01 20:50:52 -03:00
profiles_darwin_test.go read orbit profile configuration values using osascript in macOS (#12086) 2023-06-01 20:50:52 -03:00
profiles_notdarwin.go Read enroll-secret and fleet-url from config profile on macOS (#10134) 2023-02-28 15:54:06 -03:00
profiles_notdarwin_test.go Read enroll-secret and fleet-url from config profile on macOS (#10134) 2023-02-28 15:54:06 -03:00