Documentation
¶
Overview ¶
Package storage defines interfaces, types, data, and helpers related to storage and retrieval for MDM enrollments and commands.
Index ¶
- Variables
- type AllStorage
- type BootstrapTokenStore
- type CertAuthRetriever
- type CertAuthStore
- type CheckinStore
- type CommandAndReportResultsStore
- type CommandEnqueuer
- type PushCertStore
- type PushCertStorer
- type PushStore
- type ServiceStore
- type StoreMigrator
- type TokenUpdateTallyStore
- type UserAuthenticateStore
Constants ¶
This section is empty.
Variables ¶
var ErrDeviceChannelOnly = errors.New("operation supported on device channel only")
ErrDeviceChannelOnly is returned when storage operations are only possible on the device MDM channel.
Functions ¶
This section is empty.
Types ¶
type AllStorage ¶
type AllStorage interface {
ServiceStore
PushStore
PushCertStore
CommandEnqueuer
CertAuthStore
CertAuthRetriever
StoreMigrator
TokenUpdateTallyStore
PushCertStorer
}
AllStorage represents all required storage by NanoMDM.
type BootstrapTokenStore ¶
type BootstrapTokenStore interface {
StoreBootstrapToken(r *mdm.Request, msg *mdm.SetBootstrapToken) error
// RetrieveBootstrapToken retrieves the previously-escrowed Bootstrap Token.
// If a token has not yet been escrowed then a nil token and no error should be returned.
RetrieveBootstrapToken(r *mdm.Request, msg *mdm.GetBootstrapToken) (*mdm.BootstrapToken, error)
}
type CertAuthRetriever ¶ added in v0.6.0
type CertAuthRetriever interface {
// EnrollmentFromHash retrieves a normalized enrollment ID from a cert hash.
// The hash parameter, when present, is likely (but not required) to be
// a 64-charachter hex string representation of a SHA-256 digest.
// Implementations should return an empty string if no result is found.
EnrollmentFromHash(ctx context.Context, hash string) (string, error)
}
type CertAuthStore ¶
type CertAuthStore interface {
// HasCertHash checks if hash has ever been associated to any enrollment.
HasCertHash(r *mdm.Request, hash string) (has bool, err error)
// EnrollmentHasCertHash checks that r.ID has any hash associated.
// The hash parameter can usually be ignored.
EnrollmentHasCertHash(r *mdm.Request, hash string) (bool, error)
// IsCertHashAssociated checks that r.ID is associated to hash.
IsCertHashAssociated(r *mdm.Request, hash string) (bool, error)
// AssociateCertHash associates r.ID with hash.
// Here hash is a cryptographic hash of the request certificate.
AssociateCertHash(r *mdm.Request, hash string) error
}
CertAuthStore stores and retrieves cert-to-enrollment associations. The request enrollment ID should be normalized for just the device channel. The hash parameter, when present, is likely (but not required) to be a 64-charachter hex string representation of a SHA-256 digest.
type CheckinStore ¶
type CheckinStore interface {
// StoreAuthenticate stores the Authenticate check-in message from an enrollment.
StoreAuthenticate(r *mdm.Request, msg *mdm.Authenticate) error
// StoreTokenUpdate stores the TokenUpdate check-in message.
// Storing this first TokenUpdate message represents a successful enrollment.
// Note both device and user channel enrollments receive TokenUpdate messages.
StoreTokenUpdate(r *mdm.Request, msg *mdm.TokenUpdate) error
// Disable the MDM enrollment.
// If r is from a device channel then any user channels for this device
// also need to be disabled.
Disable(r *mdm.Request) error
UserAuthenticateStore
}
CheckinStore stores MDM check-in data.
type CommandAndReportResultsStore ¶
type CommandAndReportResultsStore interface {
StoreCommandReport(r *mdm.Request, report *mdm.CommandResults) error
RetrieveNextCommand(r *mdm.Request, skipNotNow bool) (*mdm.Command, error)
ClearQueue(r *mdm.Request) error
}
CommandAndReportResultsStore stores and retrieves MDM command queue data.
type CommandEnqueuer ¶
type CommandEnqueuer interface {
EnqueueCommand(ctx context.Context, id []string, cmd *mdm.Command) (map[string]error, error)
}
CommandEnqueuer is able to enqueue MDM commands.
type PushCertStore ¶
type PushCertStore interface {
// IsPushCertStale asks whether staleToken is stale or not.
// The staleToken is returned from RetrievePushCert
// and should turn stale (and return true) if the certificate has
// changed—such as being renewed.
IsPushCertStale(ctx context.Context, topic string, staleToken string) (bool, error)
RetrievePushCert(ctx context.Context, topic string) (cert *tls.Certificate, staleToken string, err error)
}
PushCertStore retrieves APNs push certificates.
type PushCertStorer ¶ added in v0.9.0
type PushCertStorer interface {
// StorePushCert stores the PEM certificate and private key.
// The APNs topic (UserID OID), which implementations will likely
// need to use as a key, is decoded from the from the PEM certificate.
StorePushCert(ctx context.Context, pemCert, pemKey []byte) error
}
PushCertStorer stores APNs push certificates.
type PushStore ¶
type PushStore interface {
// RetrievePushInfo retrieves push data for the given ids.
//
// If an ID does not exist or is not enrolled properly then
// implementations should silently skip returning any push data for
// them. It is up to the caller to discern any missing IDs from the
// returned map.
RetrievePushInfo(ctx context.Context, ids []string) (map[string]*mdm.Push, error)
}
PushStore retrieves APNs push-related data.
type ServiceStore ¶
type ServiceStore interface {
CheckinStore
CommandAndReportResultsStore
BootstrapTokenStore
}
ServiceStore stores & retrieves both command and check-in data.
type StoreMigrator ¶
type StoreMigrator interface {
// RetrieveMigrationCheckins sends the (decoded) forms of
// Authenticate and TokenUpdate messages to the provided channel.
// Note that order matters: device channel TokenUpdate messages must
// follow Authenticate messages and user channel TokenUpdates must
// follow the device channel TokenUpdate.
RetrieveMigrationCheckins(context.Context, chan<- interface{}) error
}
StoreMigrator retrieves MDM check-ins
type TokenUpdateTallyStore ¶
type UserAuthenticateStore ¶ added in v0.7.0
type UserAuthenticateStore interface {
// StoreUserAuthenticate stores the UserAuthenticate check-in message from an enrollment.
StoreUserAuthenticate(r *mdm.Request, msg *mdm.UserAuthenticate) error
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package diskv implements a NanoMDM storage backend using the diskv key-value store.
|
Package diskv implements a NanoMDM storage backend using the diskv key-value store. |
|
Package file implements filesystem-based storage for MDM services
|
Package file implements filesystem-based storage for MDM services |
|
Package inmem implements an in-memory NanoMDM storage backend.
|
Package inmem implements an in-memory NanoMDM storage backend. |
|
Package kv implements a NanoMDM storage backend that uses key-value stores.
|
Package kv implements a NanoMDM storage backend that uses key-value stores. |
|
Package mysql stores and retrieves MDM data from MySQL
|
Package mysql stores and retrieves MDM data from MySQL |
|
Package pgsql stores and retrieves MDM data from PostgresSQL
|
Package pgsql stores and retrieves MDM data from PostgresSQL |