From 8c6a5a489a873ebb43be61d21a8dd4bb6acfb326 Mon Sep 17 00:00:00 2001 From: Mosen Date: Mon, 27 Jun 2016 21:03:51 +1000 Subject: [PATCH] Fleshed out a bit more of the enroll service. --- profile.go | 1 + service.go | 15 ++++++++++++--- transport.go | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 transport.go diff --git a/profile.go b/profile.go index dd878062..f1cdbe88 100644 --- a/profile.go +++ b/profile.go @@ -62,6 +62,7 @@ type SCEPPayload struct { // TODO: Actually this is one of those non-nested payloads that doesnt respect the PayloadContent key. type MDMPayload struct { + Payload AccessRights int CheckInURL string CheckOutWhenRemoved bool diff --git a/service.go b/service.go index fbb5dcb0..3e981306 100644 --- a/service.go +++ b/service.go @@ -11,7 +11,7 @@ type service struct { Topic string // APNS Topic for MDM notifications } -func (svc service) Enroll() { +func (svc service) Enroll() (Profile, error) { profile := NewProfile() profile.PayloadIdentifier = "com.github.micromdm.micromdm.mdm" profile.PayloadOrganization = "MicroMDM" @@ -40,7 +40,7 @@ func (svc service) Enroll() { scepPayload.PayloadDisplayName = "SCEP" scepPayload.PayloadContent = scepContent - mdmContent := MDMPayload{ + mdmPayload := MDMPayload{ AccessRights: 8191, CheckInURL: svc.Url + "/mdm/checkin", CheckOutWhenRemoved: true, @@ -49,7 +49,16 @@ func (svc service) Enroll() { Topic: svc.Topic, } - mdmPayload := NewPayload("com.apple.mdm") + mdmPayload.PayloadVersion = 1 + mdmPayload.PayloadType = "com.apple.mdm" mdmPayload.PayloadDescription = "Enrolls with the MDM server" + mdmPayload.PayloadOrganization = "MicroMDM" + caPayload := NewPayload("com.apple.ssl.certificate") + caPayload.PayloadDisplayName = "Root certificate for MicroMDM" + caPayload.PayloadDescription = "Installs the root CA certificate for MicroMDM" + + append(profile.PayloadContent, scepPayload, mdmPayload, caPayload) + + return profile } diff --git a/transport.go b/transport.go new file mode 100644 index 00000000..36d4c161 --- /dev/null +++ b/transport.go @@ -0,0 +1 @@ +package enroll