diff --git a/docs/architecture/2019-05-03_no_device_configured_without_blueprint.md b/docs/architecture/2019-05-03_no_device_configured_without_blueprint.md new file mode 100644 index 00000000..b91a6d93 --- /dev/null +++ b/docs/architecture/2019-05-03_no_device_configured_without_blueprint.md @@ -0,0 +1,17 @@ +# Do not send DeviceConfigured when there are no user configured blueprints. + +## Context + +DEP enrolled devices use an `AwaitDeviceConfigured` mode, which can be optionally enabled in a DEP profile. If enabled, the device will wait at the Remote Management screen, and not proceed until the MDM issues a `DeviceConfigured` command. +MicroMDM introduced the concept of a `Blueprint`, which an administrator can configure to apply `InstallProfile` and `InstallApplication` payloads. At the end of the list of pre-configured commands the MDM would default to sending the `DeviceConfigured` command. + +It would be useful to allow a separate service to make a decision about whether it is ok to proceed with device provisioning past enrollment. + +## Decision + +When there are no blueprints configured, the MicroMDM server will not send _any_ commands to the device. +That means, if `AwaitDeviceConfigured` is enabled on the device, upon enrollment the device will remain at the Remote Management screen until an API request queues the DeviceConfigured command. + +## Status + +Accepted diff --git a/platform/blueprint/worker.go b/platform/blueprint/worker.go index 33713824..05d0fb45 100644 --- a/platform/blueprint/worker.go +++ b/platform/blueprint/worker.go @@ -93,6 +93,11 @@ func (w *Worker) handleTokenUpdateEvent(ctx context.Context, message []byte) err return errors.Wrap(err, "unmarshal checkin event") } if ev.Command.UserID != "" { + level.Debug(w.logger).Log( + "msg", "skipping user token update in blueprint worker.", + "device_udid", ev.Command.UDID, + "user_id", ev.Command.UserID, + ) // skip UserID token updates return nil } @@ -102,6 +107,15 @@ func (w *Worker) handleTokenUpdateEvent(ctx context.Context, message []byte) err return errors.Wrap(err, "get blueprints by ApplyAtEnroll") } + // if there are no blueprints exit early. This will ensure that DeviceConfigured is not sent. + if len(bps) == 0 { + level.Debug(w.logger).Log( + "msg", "no blueprints to apply", + "device_udid", ev.Command.UDID, + ) + return nil + } + for _, bp := range bps { level.Debug(w.logger).Log( "msg", "applying blueprint",