Support User Enrollment (#597)

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.
This commit is contained in:
Victor Vrantchan
2019-06-29 15:36:13 -07:00
committed by GitHub
parent afcf5466a5
commit 127955dc74
14 changed files with 209 additions and 137 deletions

View File

@@ -1,3 +1,6 @@
## [v1.6.0](https://github.com/micromdm/micromdm/compare/v1.4.0...1.5.0) TBD
* Add support for User Enrollment (#597)
## [v1.5.0](https://github.com/micromdm/micromdm/compare/v1.4.0...1.5.0) June 15 2019
* Fix DEP token update issue (#513, #510)

View File

@@ -16,12 +16,13 @@ type AcknowledgeEvent struct {
}
type Response struct {
RequestType string `json:"request_type,omitempty" plist:",omitempty"`
UDID string
UserID *string `json:"user_id,omitempty" plist:"UserID,omitempty"`
Status string
CommandUUID string
ErrorChain []ErrorChainItem `json:"error_chain" plist:",omitempty"`
RequestType string `json:"request_type,omitempty" plist:",omitempty"`
UDID string
UserID *string `json:"user_id,omitempty" plist:"UserID,omitempty"`
EnrollmentID *string `json:"enrollment_id,omitempty" plist:"EnrollmentID,omitempty"`
Status string
CommandUUID string
ErrorChain []ErrorChainItem `json:"error_chain" plist:",omitempty"`
}
type ErrorChainItem struct {
@@ -41,6 +42,9 @@ func MarshalAcknowledgeEvent(e *AcknowledgeEvent) ([]byte, error) {
if e.Response.UserID != nil {
response.UserId = *e.Response.UserID
}
if e.Response.EnrollmentID != nil {
response.EnrollmentId = *e.Response.EnrollmentID
}
return proto.Marshal(&connectproto.Event{
Id: e.ID,
@@ -63,11 +67,12 @@ func UnmarshalAcknowledgeEvent(data []byte, e *AcknowledgeEvent) error {
}
r := pb.GetResponse()
e.Response = Response{
UDID: r.GetUdid(),
UserID: strPtr(r.GetUserId()),
Status: r.GetStatus(),
RequestType: r.GetRequestType(),
CommandUUID: r.GetCommandUuid(),
UDID: r.GetUdid(),
UserID: strPtr(r.GetUserId()),
EnrollmentID: strPtr(r.GetEnrollmentId()),
Status: r.GetStatus(),
RequestType: r.GetRequestType(),
CommandUUID: r.GetCommandUuid(),
}
e.Raw = pb.GetRaw()
e.Params = pb.GetParams()

View File

@@ -11,6 +11,8 @@ import (
)
func (svc *MDMService) Checkin(ctx context.Context, event CheckinEvent) error {
// reject user settings at the loginwindow.
// https://github.com/micromdm/micromdm/pull/379
if event.Command.MessageType == "UserAuthenticate" {
return &rejectUserAuth{}
}

View File

@@ -21,9 +21,10 @@ type CheckinEvent struct {
type CheckinCommand struct {
// MessageType can be either Authenticate,
// TokenUpdate or CheckOut
MessageType string
Topic string
UDID string
MessageType string
Topic string
UDID string
EnrollmentID string
auth
update
}
@@ -71,9 +72,10 @@ func (d hexData) String() string {
// MarshalCheckinEvent serializes an event to a protocol buffer wire format.
func MarshalCheckinEvent(e *CheckinEvent) ([]byte, error) {
command := &checkinproto.Command{
MessageType: e.Command.MessageType,
Topic: e.Command.Topic,
Udid: e.Command.UDID,
MessageType: e.Command.MessageType,
Topic: e.Command.Topic,
Udid: e.Command.UDID,
EnrollmentId: e.Command.EnrollmentID,
}
switch e.Command.MessageType {
case "Authenticate":
@@ -123,9 +125,10 @@ func UnmarshalCheckinEvent(data []byte, e *CheckinEvent) error {
return nil
}
e.Command = CheckinCommand{
MessageType: pb.Command.MessageType,
Topic: pb.Command.Topic,
UDID: pb.Command.Udid,
MessageType: pb.Command.MessageType,
Topic: pb.Command.Topic,
UDID: pb.Command.Udid,
EnrollmentID: pb.Command.EnrollmentId,
}
switch pb.Command.MessageType {
case "Authenticate":

View File

@@ -19,11 +19,11 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Event struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Time int64 `protobuf:"varint,2,opt,name=time" json:"time,omitempty"`
Command *Command `protobuf:"bytes,3,opt,name=command" json:"command,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Time int64 `protobuf:"varint,2,opt,name=time,proto3" json:"time,omitempty"`
Command *Command `protobuf:"bytes,3,opt,name=command,proto3" json:"command,omitempty"`
Raw []byte `protobuf:"bytes,4,opt,name=raw,proto3" json:"raw,omitempty"`
Params map[string]string `protobuf:"bytes,5,rep,name=params" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
Params map[string]string `protobuf:"bytes,5,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -33,7 +33,7 @@ func (m *Event) Reset() { *m = Event{} }
func (m *Event) String() string { return proto.CompactTextString(m) }
func (*Event) ProtoMessage() {}
func (*Event) Descriptor() ([]byte, []int) {
return fileDescriptor_checkin_7e1d11c144d2ce7a, []int{0}
return fileDescriptor_checkin_f106eb4ffaf2f7e3, []int{0}
}
func (m *Event) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Event.Unmarshal(m, b)
@@ -89,11 +89,12 @@ func (m *Event) GetParams() map[string]string {
}
type Command struct {
MessageType string `protobuf:"bytes,1,opt,name=message_type,json=messageType" json:"message_type,omitempty"`
Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"`
Udid string `protobuf:"bytes,3,opt,name=udid" json:"udid,omitempty"`
Authenticate *Authenticate `protobuf:"bytes,4,opt,name=authenticate" json:"authenticate,omitempty"`
TokenUpdate *TokenUpdate `protobuf:"bytes,5,opt,name=token_update,json=tokenUpdate" json:"token_update,omitempty"`
MessageType string `protobuf:"bytes,1,opt,name=message_type,json=messageType,proto3" json:"message_type,omitempty"`
Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"`
Udid string `protobuf:"bytes,3,opt,name=udid,proto3" json:"udid,omitempty"`
Authenticate *Authenticate `protobuf:"bytes,4,opt,name=authenticate,proto3" json:"authenticate,omitempty"`
TokenUpdate *TokenUpdate `protobuf:"bytes,5,opt,name=token_update,json=tokenUpdate,proto3" json:"token_update,omitempty"`
EnrollmentId string `protobuf:"bytes,6,opt,name=enrollment_id,json=enrollmentId,proto3" json:"enrollment_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -103,7 +104,7 @@ func (m *Command) Reset() { *m = Command{} }
func (m *Command) String() string { return proto.CompactTextString(m) }
func (*Command) ProtoMessage() {}
func (*Command) Descriptor() ([]byte, []int) {
return fileDescriptor_checkin_7e1d11c144d2ce7a, []int{1}
return fileDescriptor_checkin_f106eb4ffaf2f7e3, []int{1}
}
func (m *Command) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Command.Unmarshal(m, b)
@@ -158,17 +159,24 @@ func (m *Command) GetTokenUpdate() *TokenUpdate {
return nil
}
func (m *Command) GetEnrollmentId() string {
if m != nil {
return m.EnrollmentId
}
return ""
}
type Authenticate struct {
OsVersion string `protobuf:"bytes,1,opt,name=os_version,json=osVersion" json:"os_version,omitempty"`
BuildVersion string `protobuf:"bytes,2,opt,name=build_version,json=buildVersion" json:"build_version,omitempty"`
ProductName string `protobuf:"bytes,3,opt,name=product_name,json=productName" json:"product_name,omitempty"`
SerialNumber string `protobuf:"bytes,4,opt,name=serial_number,json=serialNumber" json:"serial_number,omitempty"`
Imei string `protobuf:"bytes,5,opt,name=imei" json:"imei,omitempty"`
Meid string `protobuf:"bytes,6,opt,name=meid" json:"meid,omitempty"`
DeviceName string `protobuf:"bytes,7,opt,name=device_name,json=deviceName" json:"device_name,omitempty"`
OsVersion string `protobuf:"bytes,1,opt,name=os_version,json=osVersion,proto3" json:"os_version,omitempty"`
BuildVersion string `protobuf:"bytes,2,opt,name=build_version,json=buildVersion,proto3" json:"build_version,omitempty"`
ProductName string `protobuf:"bytes,3,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"`
SerialNumber string `protobuf:"bytes,4,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"`
Imei string `protobuf:"bytes,5,opt,name=imei,proto3" json:"imei,omitempty"`
Meid string `protobuf:"bytes,6,opt,name=meid,proto3" json:"meid,omitempty"`
DeviceName string `protobuf:"bytes,7,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"`
Challenge []byte `protobuf:"bytes,8,opt,name=challenge,proto3" json:"challenge,omitempty"`
Model string `protobuf:"bytes,9,opt,name=model" json:"model,omitempty"`
ModelName string `protobuf:"bytes,10,opt,name=model_name,json=modelName" json:"model_name,omitempty"`
Model string `protobuf:"bytes,9,opt,name=model,proto3" json:"model,omitempty"`
ModelName string `protobuf:"bytes,10,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -178,7 +186,7 @@ func (m *Authenticate) Reset() { *m = Authenticate{} }
func (m *Authenticate) String() string { return proto.CompactTextString(m) }
func (*Authenticate) ProtoMessage() {}
func (*Authenticate) Descriptor() ([]byte, []int) {
return fileDescriptor_checkin_7e1d11c144d2ce7a, []int{2}
return fileDescriptor_checkin_f106eb4ffaf2f7e3, []int{2}
}
func (m *Authenticate) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Authenticate.Unmarshal(m, b)
@@ -270,13 +278,13 @@ func (m *Authenticate) GetModelName() string {
type TokenUpdate struct {
Token []byte `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
PushMagic string `protobuf:"bytes,2,opt,name=push_magic,json=pushMagic" json:"push_magic,omitempty"`
PushMagic string `protobuf:"bytes,2,opt,name=push_magic,json=pushMagic,proto3" json:"push_magic,omitempty"`
UnlockToken []byte `protobuf:"bytes,3,opt,name=unlock_token,json=unlockToken,proto3" json:"unlock_token,omitempty"`
AwaitingConfiguration bool `protobuf:"varint,4,opt,name=awaiting_configuration,json=awaitingConfiguration" json:"awaiting_configuration,omitempty"`
UserId string `protobuf:"bytes,5,opt,name=user_id,json=userId" json:"user_id,omitempty"`
UserLongName string `protobuf:"bytes,6,opt,name=user_long_name,json=userLongName" json:"user_long_name,omitempty"`
UserShortName string `protobuf:"bytes,7,opt,name=user_short_name,json=userShortName" json:"user_short_name,omitempty"`
NotOnConsole bool `protobuf:"varint,8,opt,name=not_on_console,json=notOnConsole" json:"not_on_console,omitempty"`
AwaitingConfiguration bool `protobuf:"varint,4,opt,name=awaiting_configuration,json=awaitingConfiguration,proto3" json:"awaiting_configuration,omitempty"`
UserId string `protobuf:"bytes,5,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
UserLongName string `protobuf:"bytes,6,opt,name=user_long_name,json=userLongName,proto3" json:"user_long_name,omitempty"`
UserShortName string `protobuf:"bytes,7,opt,name=user_short_name,json=userShortName,proto3" json:"user_short_name,omitempty"`
NotOnConsole bool `protobuf:"varint,8,opt,name=not_on_console,json=notOnConsole,proto3" json:"not_on_console,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -286,7 +294,7 @@ func (m *TokenUpdate) Reset() { *m = TokenUpdate{} }
func (m *TokenUpdate) String() string { return proto.CompactTextString(m) }
func (*TokenUpdate) ProtoMessage() {}
func (*TokenUpdate) Descriptor() ([]byte, []int) {
return fileDescriptor_checkin_7e1d11c144d2ce7a, []int{3}
return fileDescriptor_checkin_f106eb4ffaf2f7e3, []int{3}
}
func (m *TokenUpdate) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TokenUpdate.Unmarshal(m, b)
@@ -370,46 +378,47 @@ func init() {
proto.RegisterType((*TokenUpdate)(nil), "checkinproto.TokenUpdate")
}
func init() { proto.RegisterFile("checkin.proto", fileDescriptor_checkin_7e1d11c144d2ce7a) }
func init() { proto.RegisterFile("checkin.proto", fileDescriptor_checkin_f106eb4ffaf2f7e3) }
var fileDescriptor_checkin_7e1d11c144d2ce7a = []byte{
// 602 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xdf, 0x6e, 0xd3, 0x30,
0x14, 0xc6, 0x95, 0x74, 0x6d, 0x97, 0x93, 0x6c, 0x20, 0x8b, 0x41, 0x98, 0x40, 0xeb, 0xca, 0x84,
0x7a, 0x55, 0xa4, 0x21, 0xc4, 0x1f, 0x21, 0x24, 0x34, 0xed, 0x02, 0x09, 0x06, 0x32, 0x83, 0xdb,
0xc8, 0x4d, 0x4c, 0x6a, 0x35, 0xb1, 0xa3, 0xc4, 0xe9, 0xd4, 0x47, 0xe2, 0x05, 0x78, 0x12, 0x9e,
0x80, 0x27, 0x41, 0xe7, 0x38, 0xdd, 0xd2, 0xbb, 0x73, 0x7e, 0xfe, 0xfc, 0xe5, 0x9c, 0x2f, 0x86,
0x83, 0x74, 0x29, 0xd3, 0x95, 0xd2, 0xf3, 0xaa, 0x36, 0xd6, 0xb0, 0xa8, 0x6b, 0xa9, 0x9b, 0xfe,
0xf3, 0x60, 0x78, 0xb9, 0x96, 0xda, 0xb2, 0x43, 0xf0, 0x55, 0x16, 0x7b, 0x13, 0x6f, 0x16, 0x70,
0x5f, 0x65, 0x8c, 0xc1, 0x9e, 0x55, 0xa5, 0x8c, 0xfd, 0x89, 0x37, 0x1b, 0x70, 0xaa, 0xd9, 0x0b,
0x18, 0xa7, 0xa6, 0x2c, 0x85, 0xce, 0xe2, 0xc1, 0xc4, 0x9b, 0x85, 0xe7, 0x47, 0xf3, 0xbe, 0xdb,
0xfc, 0xc2, 0x1d, 0xf2, 0xad, 0x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dc, 0x36, 0xb2, 0x4e, 0x54, 0xd6, 0xa5, 0x37, 0xc2, 0xf6,
0x53, 0xc6, 0xce, 0xe0, 0x90, 0x0e, 0x0a, 0xa3, 0x73, 0xb7, 0x9a, 0x4b, 0x32, 0x42, 0xfa, 0xd9,
0xe8, 0x9c, 0x02, 0x7b, 0x0e, 0xf7, 0x48, 0xd5, 0x2c, 0x4d, 0x6d, 0xfb, 0xa9, 0x1e, 0x20, 0xfe,
0x8e, 0x94, 0x74, 0x67, 0x70, 0xa8, 0x8d, 0x4d, 0x8c, 0xc6, 0xd9, 0x1a, 0x53, 0xb8, 0x74, 0xf7,
0x79, 0xa4, 0x8d, 0xfd, 0xaa, 0x2f, 0x1c, 0x5b, 0x8c, 0xe8, 0x11, 0xbe, 0xfc, 0x1f, 0x00, 0x00,
0xff, 0xff, 0x87, 0xd1, 0x6a, 0xe1, 0x46, 0x04, 0x00, 0x00,
var fileDescriptor_checkin_f106eb4ffaf2f7e3 = []byte{
// 619 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x52, 0xdd, 0x6a, 0xdb, 0x4a,
0x10, 0x46, 0x76, 0x6c, 0x47, 0x23, 0x25, 0xe7, 0xb0, 0x9c, 0x9c, 0xa3, 0x13, 0x5a, 0xe2, 0xb8,
0xa1, 0xf8, 0xca, 0x85, 0x94, 0xd2, 0x1f, 0x4a, 0xa1, 0x84, 0x5c, 0x04, 0xda, 0xb4, 0x6c, 0xd3,
0xde, 0x8a, 0x8d, 0x34, 0x95, 0x17, 0x6b, 0x77, 0x85, 0xb4, 0x72, 0xf0, 0x23, 0xf5, 0x05, 0xfa,
0x40, 0x7d, 0x8b, 0xde, 0x95, 0x9d, 0x95, 0x13, 0xf9, 0x6e, 0xe6, 0x9b, 0x6f, 0xbe, 0x9d, 0xf9,
0x76, 0xe0, 0x20, 0x5b, 0x62, 0xb6, 0x92, 0x7a, 0x51, 0x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0x41, 0x88, 0x93, 0x9c, 0xfd, 0x18, 0x40,
0xd4, 0xb3, 0xde, 0x5f, 0xc5, 0x0a, 0xbd, 0x65, 0x31, 0xf7, 0x89, 0x13, 0xa9, 0xda, 0x66, 0x99,
0x2a, 0x51, 0xdc, 0x1f, 0x4c, 0xe8, 0x90, 0x8f, 0x0e, 0x70, 0x46, 0xb5, 0xba, 0x34, 0xd9, 0x2a,
0xf5, 0xbd, 0x43, 0xea, 0x8d, 0x3c, 0x46, 0xea, 0xec, 0x05, 0xfc, 0x2b, 0xee, 0x84, 0xb4, 0x52,
0x17, 0x69, 0x66, 0xf4, 0x77, 0x59, 0xb4, 0xb5, 0xb0, 0xce, 0x79, 0xe7, 0xd8, 0x3e, 0x3f, 0xda,
0x56, 0x2f, 0xfa, 0x45, 0xf6, 0x1f, 0x4c, 0xda, 0x06, 0x6b, 0xf7, 0xed, 0xde, 0xbd, 0xb1, 0x4b,
0xaf, 0x72, 0x76, 0x06, 0x87, 0x54, 0x28, 0x8d, 0x2e, 0xfc, 0x6a, 0xdd, 0x59, 0x38, 0xf4, 0x83,
0xd1, 0x05, 0x19, 0xf6, 0x14, 0xfe, 0x22, 0x56, 0xb3, 0x34, 0xb5, 0xed, 0xbb, 0x7a, 0xe0, 0xe0,
0x2f, 0x0e, 0x25, 0xde, 0x19, 0x1c, 0x6a, 0x63, 0x53, 0xa3, 0xdd, 0x6c, 0x8d, 0x29, 0xbd, 0xbb,
0xfb, 0x3c, 0xd6, 0xc6, 0x7e, 0xd2, 0x17, 0x1e, 0xbb, 0x1d, 0xd3, 0xa5, 0x3e, 0xff, 0x13, 0x00,
0x00, 0xff, 0xff, 0x5a, 0x90, 0x46, 0x6c, 0x6b, 0x04, 0x00, 0x00,
}

View File

@@ -16,6 +16,7 @@ message Command {
string udid = 3;
Authenticate authenticate = 4;
TokenUpdate token_update = 5;
string enrollment_id = 6;
}
message Authenticate {

View File

@@ -19,11 +19,11 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Event struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Time int64 `protobuf:"varint,2,opt,name=time" json:"time,omitempty"`
Response *Response `protobuf:"bytes,3,opt,name=response" json:"response,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Time int64 `protobuf:"varint,2,opt,name=time,proto3" json:"time,omitempty"`
Response *Response `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
Raw []byte `protobuf:"bytes,4,opt,name=raw,proto3" json:"raw,omitempty"`
Params map[string]string `protobuf:"bytes,5,rep,name=params" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
Params map[string]string `protobuf:"bytes,5,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -33,7 +33,7 @@ func (m *Event) Reset() { *m = Event{} }
func (m *Event) String() string { return proto.CompactTextString(m) }
func (*Event) ProtoMessage() {}
func (*Event) Descriptor() ([]byte, []int) {
return fileDescriptor_connect_0a9da89ca45acccc, []int{0}
return fileDescriptor_connect_1685d4746e4a2c8b, []int{0}
}
func (m *Event) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Event.Unmarshal(m, b)
@@ -89,11 +89,12 @@ func (m *Event) GetParams() map[string]string {
}
type Response struct {
Udid string `protobuf:"bytes,1,opt,name=udid" json:"udid,omitempty"`
UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId" json:"user_id,omitempty"`
Status string `protobuf:"bytes,3,opt,name=status" json:"status,omitempty"`
RequestType string `protobuf:"bytes,4,opt,name=request_type,json=requestType" json:"request_type,omitempty"`
CommandUuid string `protobuf:"bytes,5,opt,name=command_uuid,json=commandUuid" json:"command_uuid,omitempty"`
Udid string `protobuf:"bytes,1,opt,name=udid,proto3" json:"udid,omitempty"`
UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
RequestType string `protobuf:"bytes,4,opt,name=request_type,json=requestType,proto3" json:"request_type,omitempty"`
CommandUuid string `protobuf:"bytes,5,opt,name=command_uuid,json=commandUuid,proto3" json:"command_uuid,omitempty"`
EnrollmentId string `protobuf:"bytes,6,opt,name=enrollment_id,json=enrollmentId,proto3" json:"enrollment_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -103,7 +104,7 @@ func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) {
return fileDescriptor_connect_0a9da89ca45acccc, []int{1}
return fileDescriptor_connect_1685d4746e4a2c8b, []int{1}
}
func (m *Response) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Response.Unmarshal(m, b)
@@ -158,32 +159,41 @@ func (m *Response) GetCommandUuid() string {
return ""
}
func (m *Response) GetEnrollmentId() string {
if m != nil {
return m.EnrollmentId
}
return ""
}
func init() {
proto.RegisterType((*Event)(nil), "connectproto.Event")
proto.RegisterMapType((map[string]string)(nil), "connectproto.Event.ParamsEntry")
proto.RegisterType((*Response)(nil), "connectproto.Response")
}
func init() { proto.RegisterFile("connect.proto", fileDescriptor_connect_0a9da89ca45acccc) }
func init() { proto.RegisterFile("connect.proto", fileDescriptor_connect_1685d4746e4a2c8b) }
var fileDescriptor_connect_0a9da89ca45acccc = []byte{
// 285 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0xbd, 0x4e, 0xc3, 0x30,
0x1c, 0xc4, 0xe5, 0xa4, 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 0x34, 0xbe,
0x84, 0x13, 0x67, 0x84, 0x6e, 0x25, 0x8f, 0x9f, 0x73, 0x6f, 0x9f, 0x38, 0x5e, 0x43, 0x6e, 0x2c,
0xb3, 0xce, 0x04, 0xe2, 0x82, 0x46, 0x87, 0x6f, 0x60, 0xa5, 0xc5, 0xa7, 0x13, 0xc6, 0xb6, 0x76,
0x1a, 0x45, 0x00, 0x2c, 0x68, 0x19, 0x6f, 0x2f, 0xd3, 0x28, 0x7c, 0xa4, 0x1b, 0xfa, 0x9e, 0x29,
0xde, 0x3a, 0x27, 0x39, 0xc9, 0xe6, 0x48, 0xbc, 0xbd, 0x3a, 0xc9, 0xdf, 0xf2, 0xc0, 0x7c, 0xfb,
0x1b, 0x00, 0x00, 0xff, 0xff, 0x78, 0xb5, 0xce, 0x2a, 0xa5, 0x01, 0x00, 0x00,
var fileDescriptor_connect_1685d4746e4a2c8b = []byte{
// 306 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x50, 0x3d, 0x4f, 0xf3, 0x30,
0x18, 0x94, 0x93, 0x26, 0x6f, 0xf3, 0x24, 0x7d, 0x85, 0x2c, 0x54, 0x22, 0x16, 0x42, 0x59, 0x32,
0x65, 0x28, 0x03, 0x1f, 0x7b, 0x87, 0x6e, 0xc8, 0x82, 0xb9, 0x0a, 0xf5, 0x33, 0x44, 0x34, 0x76,
0xf0, 0x47, 0x51, 0xfe, 0x1a, 0xff, 0x87, 0xff, 0x81, 0xec, 0x9a, 0x52, 0xb6, 0xbb, 0xf3, 0xf9,
0x7c, 0x67, 0x98, 0x6d, 0xa5, 0x10, 0xb8, 0x35, 0xcd, 0xa0, 0xa4, 0x91, 0xb4, 0x08, 0xd4, 0xb3,
0xc5, 0x17, 0x81, 0x64, 0xb5, 0x47, 0x61, 0xe8, 0x7f, 0x88, 0x3a, 0x5e, 0x92, 0x8a, 0xd4, 0x19,
0x8b, 0x3a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xf5, 0x9e, 0xe2, 0x57, 0x5c, 0xf3, 0xd7,
0xd4, 0x7f, 0xcc, 0xed, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x57, 0xaf, 0x0d, 0xca, 0x01,
0x00, 0x00,
}

View File

@@ -16,5 +16,5 @@ message Response {
string status = 3;
string request_type = 4;
string command_uuid = 5;
string enrollment_id = 6;
}

View File

@@ -66,10 +66,15 @@ func (w *Worker) updatePushInfoFromTokenUpdate(ctx context.Context, message []by
PushMagic: ev.Command.PushMagic,
MDMTopic: ev.Command.Topic,
}
// UDID is the primary key for storing the APNS values.
// For MDM managed users, use the UserID instead,
// and for BYOD User Enrollment, use the EnrollmentID.
if ev.Command.UserID != "" {
// use the GUID if this is a user TokenUpdate.
info.UDID = ev.Command.UserID
}
if ev.Command.EnrollmentID != "" {
info.UDID = ev.Command.EnrollmentID
}
err := w.db.Save(ctx, &info)
return errors.Wrapf(err, "saving pushinfo for udid=%s", info.UDID)
}

View File

@@ -64,6 +64,11 @@ func (mw *udidCertAuthMiddleware) validateUDIDCertAuth(udid, certHash []byte) (b
}
func (mw *udidCertAuthMiddleware) Acknowledge(ctx context.Context, req mdm.AcknowledgeEvent) ([]byte, error) {
// only validate device enrollments, user enrollments should be separate.
if req.Response.EnrollmentID != nil {
return mw.next.Acknowledge(ctx, req)
}
devcert, err := mdm.DeviceCertificateFromContext(ctx)
if err != nil {
return nil, errors.Wrap(err, "error retrieving device certificate")
@@ -79,6 +84,10 @@ func (mw *udidCertAuthMiddleware) Acknowledge(ctx context.Context, req mdm.Ackno
}
func (mw *udidCertAuthMiddleware) Checkin(ctx context.Context, req mdm.CheckinEvent) error {
// only validate device enrollments, user enrollments should be separate.
if req.Command.EnrollmentID != "" {
return mw.next.Checkin(ctx, req)
}
devcert, err := mdm.DeviceCertificateFromContext(ctx)
if err != nil {
return errors.Wrap(err, "error retrieving device certificate")

View File

@@ -141,6 +141,10 @@ func (w *Worker) updateFromAcknowledge(ctx context.Context, message []byte) erro
return errors.Wrap(err, "unmarshal acknowledge event")
}
if ev.Response.EnrollmentID != nil {
return nil
}
dev, err := w.db.DeviceByUDID(ctx, ev.Response.UDID)
if err != nil {
return errors.Wrapf(err, "retrieve device with udid %s", ev.Response.UDID)
@@ -158,6 +162,10 @@ func (w *Worker) updateFromCheckout(ctx context.Context, message []byte) error {
return errors.Wrap(err, "unmarshal checkin event")
}
if ev.Command.EnrollmentID != "" {
return nil
}
dev, err := w.db.DeviceByUDID(ctx, ev.Command.UDID)
if err != nil {
return errors.Wrapf(err, "retrieve device with udid %s", ev.Command.UDID)
@@ -177,8 +185,8 @@ func (w *Worker) updateFromTokenUpdate(ctx context.Context, message []byte) erro
return errors.Wrap(err, "unmarshal checkin event")
}
if ev.Command.UserID != "" {
// do not process user checkin events while updating device records.
// do not process managed user, or user enrollment checkin events while updating device records.
if ev.Command.UserID != "" || ev.Command.EnrollmentID != "" {
return nil
}
@@ -213,6 +221,10 @@ func (w *Worker) updateFromAuthenticate(ctx context.Context, message []byte) err
return errors.Wrap(err, "unmarshal checkin event")
}
if ev.Command.EnrollmentID != "" {
return nil
}
device, reenrolling, err := getOrCreateDevice(ctx, w.db, ev.Command.SerialNumber, ev.Command.UDID)
if err != nil {
return errors.Wrap(err, "get device for authenticate event")

View File

@@ -48,11 +48,18 @@ func (db *Store) Next(ctx context.Context, resp mdm.Response) ([]byte, error) {
}
func (db *Store) nextCommand(ctx context.Context, resp mdm.Response) (*Command, error) {
// The UDID is the primary key for the queue.
// Depending on the enrollment type, replace the UDID with a different ID type.
// UserID for managed user channel
// EnrollmentID for BYOD User Enrollment.
udid := resp.UDID
if resp.UserID != nil {
// use the user id for user level commands
udid = *resp.UserID
}
if resp.EnrollmentID != nil {
udid = *resp.EnrollmentID
}
dc, err := db.DeviceCommand(udid)
if err != nil {
if isNotFound(err) {

View File

@@ -7,11 +7,12 @@ import (
)
type AcknowledgeEvent struct {
UDID string `json:"udid"`
Status string `json:"status"`
CommandUUID string `json:"command_uuid"`
Params map[string]string `json:"url_params"`
RawPayload []byte `json:"raw_payload"`
UDID string `json:"udid,omitempty"`
EnrollmentID string `json:"enrollment_id,omitempty"`
Status string `json:"status"`
CommandUUID string `json:"command_uuid,omitempty"`
Params map[string]string `json:"url_params,omitempty"`
RawPayload []byte `json:"raw_payload"`
}
func acknowledgeEvent(topic string, data []byte) (*Event, error) {
@@ -32,6 +33,9 @@ func acknowledgeEvent(topic string, data []byte) (*Event, error) {
RawPayload: ev.Raw,
},
}
if ev.Response.EnrollmentID != nil {
webhookEvent.AcknowledgeEvent.EnrollmentID = *ev.Response.EnrollmentID
}
return &webhookEvent, nil
}

View File

@@ -7,9 +7,10 @@ import (
)
type CheckinEvent struct {
UDID string `json:"udid"`
Params map[string]string `json:"url_params"`
RawPayload []byte `json:"raw_payload"`
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) {
@@ -24,9 +25,10 @@ func checkinEvent(topic string, data []byte) (*Event, error) {
CreatedAt: ev.Time,
CheckinEvent: &CheckinEvent{
UDID: ev.Command.UDID,
Params: ev.Params,
RawPayload: ev.Raw,
UDID: ev.Command.UDID,
EnrollmentID: ev.Command.EnrollmentID,
Params: ev.Params,
RawPayload: ev.Raw,
},
}