Documentation
¶
Index ¶
- Constants
- Variables
- func HTTPErrors(r *http.Response) error
- func ReplaceIdentityRandom(e *Enrollment) error
- type Enrollment
- func (e *Enrollment) DoAuthenticate(ctx context.Context) error
- func (e *Enrollment) DoEnroll(ctx context.Context) error
- func (e *Enrollment) DoEscrowBootstrapToken(ctx context.Context, token []byte) error
- func (e *Enrollment) DoGetBootstrapToken(ctx context.Context) (*mdm.BootstrapToken, error)
- func (e *Enrollment) DoReportAndFetch(ctx context.Context, report io.Reader) (*http.Response, error)
- func (e *Enrollment) DoTokenUpdate(ctx context.Context) error
- func (e *Enrollment) EnrollID() *mdm.EnrollID
- func (e *Enrollment) GenAuthenticate() (io.Reader, error)
- func (e *Enrollment) GenTokenUpdate() (io.Reader, error)
- func (e *Enrollment) GetEnrollment() *mdm.Enrollment
- func (c *Enrollment) GetIdentity(context.Context) (*x509.Certificate, crypto.PrivateKey, error)
- func (e *Enrollment) GetPush() *mdm.Push
- func (e *Enrollment) ID() string
- func (e *Enrollment) NewMDMRequest(ctx context.Context) *mdm.Request
- type HTTPError
- type Transport
Constants ¶
const Limit10KiB = 10 * 1024
Variables ¶
var ErrAlreadyEnrolled = errors.New("already enrolled")
Functions ¶
func HTTPErrors ¶
HTTPErrors reports an HTTP error for a non-200 HTTP response. The first 10KiB of the body is read for non-200 response. For a 200 response nil is returned. Caller is responsible for closing response body.
func ReplaceIdentityRandom ¶
func ReplaceIdentityRandom(e *Enrollment) error
ReplaceIdentityRandom changes the certificate private key to a random certificate and key.
Types ¶
type Enrollment ¶
type Enrollment struct {
// contains filtered or unexported fields
}
Enrollment emulates an MDM enrollment. Currently it mostly emulates device channel enrollments.
func NewFromCheckins ¶
func NewFromCheckins(doer protocol.Doer, serverURL, checkInURL, authenticatePath, tokenUpdatePath string) (*Enrollment, error)
NewFromCheckins loads device information from authenticate and tokenupdate files on disk.
func NewRandomDeviceEnrollment ¶
func NewRandomDeviceEnrollment(doer protocol.Doer, topic, serverURL, checkInURL string) (*Enrollment, error)
NewRandomDeviceEnrollment creates a new randomly identified MDM enrollment.
func (*Enrollment) DoAuthenticate ¶
func (e *Enrollment) DoAuthenticate(ctx context.Context) error
DoAuthenticate sends an Authenticate check-in message to the MDM server.
func (*Enrollment) DoEnroll ¶
func (e *Enrollment) DoEnroll(ctx context.Context) error
DoEnroll enrolls (or re-enrolls) this enrollment into MDM. Authenticate and TokenUpdate check-in messages are sent via the transport to the MDM server.
func (*Enrollment) DoEscrowBootstrapToken ¶
func (e *Enrollment) DoEscrowBootstrapToken(ctx context.Context, token []byte) error
DoEscrowBootstrapToken sends the Bootstrap Token to the MDM server.
func (*Enrollment) DoGetBootstrapToken ¶
func (e *Enrollment) DoGetBootstrapToken(ctx context.Context) (*mdm.BootstrapToken, error)
DoGetBootstrapToken retrieves the Bootstrap Token from the MDM erver.
func (*Enrollment) DoReportAndFetch ¶
func (e *Enrollment) DoReportAndFetch(ctx context.Context, report io.Reader) (*http.Response, error)
DoReportAndFetch sends report to the MDM server. Any new command delivered will be in the response. The caller is responsible for closing the response body.
func (*Enrollment) DoTokenUpdate ¶
func (e *Enrollment) DoTokenUpdate(ctx context.Context) error
DoTokenUpdate sends a TokenUpdate check-in message to the MDM server. A new random push token is generated for the device.
func (*Enrollment) EnrollID ¶
func (e *Enrollment) EnrollID() *mdm.EnrollID
EnrollID returns the NanoMDM enroll ID.
func (*Enrollment) GenAuthenticate ¶
func (e *Enrollment) GenAuthenticate() (io.Reader, error)
GenAuthenticate creates an XML Plist Authenticate check-in message.
func (*Enrollment) GenTokenUpdate ¶
func (e *Enrollment) GenTokenUpdate() (io.Reader, error)
GenTokenUpdate creates an XML Plist TokenUpdate check-in message.
func (*Enrollment) GetEnrollment ¶
func (e *Enrollment) GetEnrollment() *mdm.Enrollment
GetEnrollment returns the enrollment identifier data.
func (*Enrollment) GetIdentity ¶
func (c *Enrollment) GetIdentity(context.Context) (*x509.Certificate, crypto.PrivateKey, error)
GetIdentity supplies the identity certificate and key of this enrollment.
func (*Enrollment) GetPush ¶
func (e *Enrollment) GetPush() *mdm.Push
GetPush returns the enrollment push info data.
func (*Enrollment) ID ¶
func (e *Enrollment) ID() string
ID returns the NanoMDM "normalized" enrollment ID.
func (*Enrollment) NewMDMRequest ¶
func (e *Enrollment) NewMDMRequest(ctx context.Context) *mdm.Request
type Transport ¶
type Transport interface { // DoCheckIn performs an HTTP MDM check-in to the CheckInURL (or ServerURL). // The caller is responsible for closing the response body. DoCheckIn(context.Context, io.Reader) (*http.Response, error) // DoReportResultsAndFetchNext sends an HTTP MDM report-results-and-retrieve-next-command request to the ServerURL. // The caller is responsible for closing the response body. DoReportResultsAndFetchNext(ctx context.Context, report io.Reader) (*http.Response, error) }