mdm

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("serial not found")

ErrNotFound indicates the serial number was not found

Functions

This section is empty.

Types

type Config

type Config struct {
	MDMPrefix       string
	MDMToken        string
	SigningIdentity string
	CacheSize       int
	CacheTTL        time.Duration
	CachePrefix     string
	*profile.Config
}

Config is configuration for an MDM

type FileStore

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

FileStore implements FileStore completely in memory and uses an LRU cache to limit memory usage

func NewFileStore

func NewFileStore(size int, ttl time.Duration) *FileStore

NewFileStore returns a new FileStore with the given cache size (item count) and item ttl

func (*FileStore) Get

func (m *FileStore) Get(path string) ([]byte, error)

Get returns the file at the given path and removes it

func (*FileStore) Peek

func (m *FileStore) Peek(path string) ([]byte, error)

Peek returns the file at the given path without removing it

func (*FileStore) Put

func (m *FileStore) Put(name string, data []byte) (string, error)

Put stores the data and returns a path with format "<random id>/<name>"

type MDM

type MDM struct {
	*Config

	*FileStore
	// contains filtered or unexported fields
}

MDM is a MicroMDM service

func New

func New(config *Config) (*MDM, error)

New creates a new MDM from config

func (*MDM) Command

func (m *MDM) Command(cmd map[string]interface{}) error

Command runs the MDM cmd

func (*MDM) Deliver

func (m *MDM) Deliver(serial string) error

Deliver generates the necessary profile and certificates and delivers them to the device with serial

func (*MDM) InstallEnterpriseApplication

func (m *MDM) InstallEnterpriseApplication(udid string, manifest *macospkg.Manifest) error

InstallEnterpriseApplication runs the InstallEnterpriseApplication command with the given udid and manifest

func (*MDM) InstallProfile

func (m *MDM) InstallProfile(udid string, profile *profile.TopLevelProfile) error

InstallProfile runs the InstallProfile command with the given udid and profile

func (*MDM) SerialToUDID

func (m *MDM) SerialToUDID(serial string) (string, error)

SerialToUDID returns the UDID for the given serial. If the serial is not found, ErrNotFound is returned

type Payload

type Payload struct {
	CA           string
	CAKey        string
	Localhost    string
	LocalhostKey string
}

Payload is the script payload containing CA and localhost key pairs

func GeneratePKI

func GeneratePKI(years int, config *profile.Config) (*profile.TopLevelProfile, *Payload, error)

GeneratePKI generates and returns a certificate root profile and PEM encoded CA and localhost key pairs with the given CA validity in years

Jump to

Keyboard shortcuts

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