-
Notifications
You must be signed in to change notification settings - Fork 40
Description
This is a long existing minor bug that doesn't affect typical enterprise deployments.
When the SyncBaseURL configuration key is deleted, we call into the configurator to clearSyncState, but this only clears the in-memory copy. The sync-state.plist should be deleted so that when Santa restarts, old sync settings aren't still used.
However, flushing cannot happen immediately. This is due to some very poorly written MDM implementations that don't properly handle updates. Naïve MDM implementations will often times unnecessarily remove a configuration profile and replace with the updated one, causing Santa configuration to appear to flap. To ensure that we don't inadvertently clear the sync state too quickly, Santa delays the clear operation for several minutes just in case a new profile is immediately installed.
This delay can cause issue though if the backing file is not eventually cleared or Santa is restarted (e.g., maybe it was updated at the same time as a new profile was laid down).
Santa must ensure that the backing plist is eventually cleared after clearing the in-memory version. Additionally, on startup, Santa must determine if a valid SyncBaseURL exists, and if not, restart the timer to clear the sync state so stale values are eventually wiped out. Note: The timer should be used here instead of immediately wiping out the sync state due to the same flapping reasoning.