mirror of
https://github.com/micromdm/micromdm/
synced 2026-05-13 01:46:05 +08:00
In iOS 10.13/macOS 10.15 a new, BYOD specific enrollment type was added, called User Enrollment. This enrollment type replaces the typical UDID field in checkin and acknowledge requests with a EnrollmentID field which is unique per each enrollment. One important aspect of this enrollment type is that no personally identifiable information is available to the MDM (UDID, SerialNumber). The implementation implemented here adds the new EnrollmentID field where appropriate, and ensures that the device tables do not store the enrollment ID. I will follow up this change set with one that allows listing/removing current enrollment IDs in a similar way that mdmctl get devices and mdmctl get users does.
37 lines
856 B
Go
37 lines
856 B
Go
package webhook
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/micromdm/micromdm/mdm"
|
|
)
|
|
|
|
type CheckinEvent struct {
|
|
UDID string `json:"udid,omitempty"`
|
|
EnrollmentID string `json:"enrollment_id,omitempty"`
|
|
Params map[string]string `json:"url_params"`
|
|
RawPayload []byte `json:"raw_payload"`
|
|
}
|
|
|
|
func checkinEvent(topic string, data []byte) (*Event, error) {
|
|
var ev mdm.CheckinEvent
|
|
if err := mdm.UnmarshalCheckinEvent(data, &ev); err != nil {
|
|
return nil, errors.Wrap(err, "unmarshal checkin event for webhook")
|
|
}
|
|
|
|
webhookEvent := Event{
|
|
Topic: topic,
|
|
EventID: ev.ID,
|
|
CreatedAt: ev.Time,
|
|
|
|
CheckinEvent: &CheckinEvent{
|
|
UDID: ev.Command.UDID,
|
|
EnrollmentID: ev.Command.EnrollmentID,
|
|
Params: ev.Params,
|
|
RawPayload: ev.Raw,
|
|
},
|
|
}
|
|
|
|
return &webhookEvent, nil
|
|
}
|