mdm

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 20 Imported by: 11

Documentation

Index

Constants

View Source
const (
	ContextKeyDeviceCertificate contextKey = iota
	ContextKeyDeviceCertificateVerifyError
)
View Source
const (
	ConnectTopic           = "mdm.Connect"
	AuthenticateTopic      = "mdm.Authenticate"
	TokenUpdateTopic       = "mdm.TokenUpdate"
	CheckoutTopic          = "mdm.CheckOut"
	GetBootstrapTokenTopic = "mdm.GetBootstrapToken"
	SetBootstrapTokenTopic = "mdm.SetBootstrapToken"
)

Variables

This section is empty.

Functions

func DeviceCertificateFromContext added in v1.5.0

func DeviceCertificateFromContext(ctx context.Context) (*x509.Certificate, error)

func MakeAcknowledgeEndpoint

func MakeAcknowledgeEndpoint(svc Service) endpoint.Endpoint

func MakeCheckinEndpoint

func MakeCheckinEndpoint(svc Service) endpoint.Endpoint

func MarshalAcknowledgeEvent

func MarshalAcknowledgeEvent(e *AcknowledgeEvent) ([]byte, error)

func MarshalCheckinEvent

func MarshalCheckinEvent(e *CheckinEvent) ([]byte, error)

MarshalCheckinEvent serializes an event to a protocol buffer wire format.

func RegisterHTTPHandlers

func RegisterHTTPHandlers(r *mux.Router, e Endpoints, logger log.Logger)

func UnmarshalAcknowledgeEvent

func UnmarshalAcknowledgeEvent(data []byte, e *AcknowledgeEvent) error

func UnmarshalCheckinEvent

func UnmarshalCheckinEvent(data []byte, e *CheckinEvent) error

UnmarshalCheckinEvent parses a protocol buffer representation of data into the Event.

Types

type AcknowledgeEvent

type AcknowledgeEvent struct {
	ID       string
	Time     time.Time
	Response Response
	Params   map[string]string
	Raw      []byte
}

type BootstrapToken added in v1.9.0

type BootstrapToken struct {
	BootstrapToken []byte
}

BootstrapToken holds MDM Bootstrap Token data

type BootstrapTokenRetriever added in v1.9.0

type BootstrapTokenRetriever interface {
	// GetBootstrapToken returns the Bootstrap Token for the device by udid
	GetBootstrapToken(ctx context.Context, udid string) ([]byte, error)
}

BootBootstrapTokenRetriever retrieves BootStrap Tokens for devices

type CheckinCommand

type CheckinCommand struct {
	// MessageType can be either
	// Authenticate, CheckOut, TokenUpdate,
	// GetBootstrapToken, or SetBootstrapToken
	MessageType  string
	Topic        string
	UDID         string
	EnrollmentID string
	// contains filtered or unexported fields
}

CheckinRequest represents an MDM checkin command struct.

type CheckinEvent

type CheckinEvent struct {
	ID      string
	Time    time.Time
	Command CheckinCommand
	Params  map[string]string
	Raw     []byte
}

type Endpoints

type Endpoints struct {
	CheckinEndpoint     endpoint.Endpoint
	AcknowledgeEndpoint endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service) Endpoints

type ErrorChainItem

type ErrorChainItem struct {
	ErrorCode            int    `json:"error_code,omitempty"`
	ErrorDomain          string `json:"error_domain,omitempty"`
	LocalizedDescription string `json:"localized_description,omitempty"`
	USEnglishDescription string `json:"us_english_description,omitempty"`
}

type MDMService

type MDMService struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(pub pubsub.Publisher, queue Queue, dev BootstrapTokenRetriever) *MDMService

func (*MDMService) Acknowledge

func (svc *MDMService) Acknowledge(ctx context.Context, req AcknowledgeEvent) (payload []byte, err error)

func (*MDMService) Checkin

func (svc *MDMService) Checkin(ctx context.Context, event CheckinEvent) ([]byte, error)

type Middleware

type Middleware func(Service) Service

type Queue

type Queue interface {
	Next(context.Context, Response) ([]byte, error)
	Clear(context.Context, CheckinEvent) error
}

Queue is an MDM Command Queue.

type Response

type Response struct {
	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 Service

type Service interface {
	// Checkin is called for all checkin messages (such as Authenticate
	// and TokenUpdate). Checkin messages return a response to the
	// client in payload.
	Checkin(ctx context.Context, event CheckinEvent) (payload []byte, err error)
	// Acknowledge is called when a client reports a command result and
	// fetches the next command. Acknowledge calls return a command in
	// payload.
	Acknowledge(ctx context.Context, event AcknowledgeEvent) (payload []byte, err error)
}

Service describes the core MDM protocol interactions with clients.

Directories

Path Synopsis
package appmanifest provides utilities for managing app manifest files used by MDM InstallApplication commands.
package appmanifest provides utilities for managing app manifest files used by MDM InstallApplication commands.
internal
mdm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL