device

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClassCertificate
	ClassKey
	ClassIdentity
)
View Source
const (
	PayloadRequiresNetwork = 1 << iota
	PayloadRequiresIdentities
)
View Source
const (
	KeychainSystem = "System"
)

Variables

This section is empty.

Functions

func BucketGet

func BucketGet(tx *bolt.Tx, bucket, key string) []byte

BucketGet retrieves a value from a bucket or returns nil.

func BucketGetInt

func BucketGetInt(tx *bolt.Tx, bucket, key string) int

BucketGetInt retrieves a value from a bucket or returns 0.

func BucketGetKeysWithPrefix

func BucketGetKeysWithPrefix(tx *bolt.Tx, bucket string, prefix string, stripPrefix bool) []string

BucketGetKeysWithPrefix retrieves a list of keys with a prefix in a bucket

func BucketGetString

func BucketGetString(tx *bolt.Tx, bucket, key string) string

BucketGetString retrieves a value from a bucket or returns "".

func BucketPutOrDelete

func BucketPutOrDelete(tx *bolt.Tx, bucket, key string, value []byte) error

BucketPutOrDelete Puts a value to a BoltDB bucket. If the value is empty the key is Deleted.

func BucketPutOrDeleteInt

func BucketPutOrDeleteInt(tx *bolt.Tx, bucket, key string, value int) error

BucketPutOrDeleteInt Puts a value to a BoltDB bucket. If the value is 0 the key is Deleted.

func BucketPutOrDeleteString

func BucketPutOrDeleteString(tx *bolt.Tx, bucket, key, value string) error

BucketPutOrDeleteString Puts a value to a BoltDB bucket. If the value is empty the key is Deleted.

func List

func List(db *bolt.DB) (udids []string, err error)

List devices in bolt DB storage

Types

type AuthenticationRequest

type AuthenticationRequest struct {
	BuildVersion string `plist:",omitempty"`
	DeviceName   string
	IMEI         string `plist:",omitempty"`
	MEID         string `plist:",omitempty"`
	MessageType  string
	Model        string `plist:",omitempty"`
	ModelName    string `plist:",omitempty"`
	OSVersion    string `plist:",omitempty"`
	ProductName  string `plist:",omitempty"`
	SerialNumber string `plist:",omitempty"`
	Topic        string
	UDID         string
	EnrollmentID string `plist:",omitempty"` // macOS 10.15 and iOS 13.0 and later
}

AuthenticationRequest ...

type ConnectRequest

type ConnectRequest struct {
	UDID        string
	CommandUUID string `plist:",omitempty"`
	Status      string
	ErrorChain  []ErrorChain `plist:",omitempty"`

	RequestType string `plist:",omitempty"`
}

type ConnectResponse

type ConnectResponse struct {
	Command     ConnectResponseCommand
	CommandUUID string
}

type ConnectResponseCommand

type ConnectResponseCommand struct {
	RequestType string
}

type Device

type Device struct {
	UDID         string
	Serial       string
	ComputerName string

	MDMIdentityKeychainUUID string
	MDMProfileIdentifier    string
	// contains filtered or unexported fields
}

Device represents a pseudo Apple device for MDM interactions

func Load

func Load(udid string, db *bolt.DB) (device *Device, err error)

Load a device from bolt DB storage

func New

func New(name string, db *bolt.DB) *Device

New creates a new device with a random serial number and UDID

func (*Device) InstallProfile

func (device *Device) InstallProfile(pb []byte) error

func (*Device) MDMClient

func (device *Device) MDMClient() (*MDMClient, error)

func (*Device) RemoveProfile

func (device *Device) RemoveProfile(profileID string) error

func (*Device) Save

func (device *Device) Save() error

Save device to bolt DB storage

func (*Device) SystemKeychain

func (device *Device) SystemKeychain() *Keychain

func (*Device) SystemProfileStore

func (device *Device) SystemProfileStore() *ProfileStore

func (*Device) ValidateProfileInstall

func (device *Device) ValidateProfileInstall(p *cfgprofiles.Profile, fromMDM bool) error

type DeviceInfo

type DeviceInfo struct {
	Command     DeviceInfoCommand
	CommandUUID string
}

type DeviceInfoCommand

type DeviceInfoCommand struct {
	ConnectResponseCommand
	Queries []string
}

type DeviceInfoResponse

type DeviceInfoResponse struct {
	ConnectRequest
	QueryResponses map[string]string
}

type ErrorChain

type ErrorChain struct {
	ErrorCode            int
	ErrorDomain          string
	LocalizedDescription string
	USEnglishDescription string `plist:",omitempty"`
}

type InstallProfile

type InstallProfile struct {
	Command     InstallProfileCommand
	CommandUUID string
}

type InstallProfileCommand

type InstallProfileCommand struct {
	ConnectResponseCommand
	Payload                      []byte
	RequestRequiresNetworkTether bool `plist:",omitempty"`
}

type InstallProfileResponse

type InstallProfileResponse struct {
	ConnectRequest
	RequestType string
}

type Keychain

type Keychain struct {
	ID   string
	Type string

	DB *bolt.DB
}

func NewKeychain

func NewKeychain(id, kcType string, db *bolt.DB) *Keychain

type KeychainItem

type KeychainItem struct {
	Keychain *Keychain

	UUID  string
	Class int
	Item  []byte

	// ClassIdentity
	IdentityCertificateUUID string
	IdentityKeyUUID         string

	// ClassKey
	Key *rsa.PrivateKey

	// ClassCertificate
	Certificate *x509.Certificate
}

func LoadKeychainItem

func LoadKeychainItem(kc *Keychain, uuid string) (kci *KeychainItem, err error)

LoadKeychainItem loads a *KeychainItem from a keychain's BoltDB.

func NewKeychainItem

func NewKeychainItem(kc *Keychain, class int) *KeychainItem

func (*KeychainItem) Delete

func (kci *KeychainItem) Delete() error

func (*KeychainItem) Save

func (kci *KeychainItem) Save() error

Save writes a keychain item to a keychain's BoltDB.

type MDMClient

type MDMClient struct {
	Device     *Device
	MDMPayload *cfgprofiles.MDMPayload

	IdentityCertificate *x509.Certificate
	IdentityPrivateKey  *rsa.PrivateKey
}

func (*MDMClient) Connect

func (c *MDMClient) Connect() error

type ProfileListResponse

type ProfileListResponse struct {
	ConnectRequest
	ProfileList []*profileListProfile
}

type ProfileStore

type ProfileStore struct {
	ID string

	DB *bolt.DB
}

func NewProfileStore

func NewProfileStore(id string, db *bolt.DB) *ProfileStore

func (*ProfileStore) ListUUIDs

func (ps *ProfileStore) ListUUIDs() (uuids []string, err error)

func (*ProfileStore) Load

func (ps *ProfileStore) Load(id string) (p *cfgprofiles.Profile, err error)

type TokenUpdateRequest

type TokenUpdateRequest struct {
	AwaitingConfiguration bool   `plist:",omitempty"`
	EnrollmentID          string `plist:",omitempty"` // macOS 10.15 and iOS 13.0 and later
	EnrollmentUserID      string `plist:",omitempty"` // macOS 10.15 and iOS 13.0 and later
	MessageType           string
	NotOnConsole          bool `plist:",omitempty"`
	PushMagic             string
	Token                 []byte
	Topic                 string
	UDID                  string
	UnlockToken           []byte `plist:",omitempty"`
	UserShortName         string `plist:",omitempty"`
	UserID                string `plist:",omitempty"`
	UserLongName          string `plist:",omitempty"`
}

Jump to

Keyboard shortcuts

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