Documentation
¶
Overview ¶
Package profile composes, signs, and parses Apple configuration profiles (.mobileconfig): the top-level envelope, the common payload keys, stable identifiers, and CMS signing.
Why ¶
Every enrollment starts with a profile, and phase 3 of the plan of record needs one built from typed payloads rather than templated XML. Payload bodies are the generated types in schema/profiles; this package supplies what Apple documents under profile-specific payload keys but does not generate: the Configuration envelope, PayloadIdentifier and PayloadUUID handling, scope, and a Resolver that maps PayloadType to a typed payload on parse (decision record 0009). Signing and parsing share the cms package so a signed profile round-trips and RequireSignature can reject an unsigned one.
Which payloads go into an enrollment profile, and the OTA flow that delivers them, are enroll's concern; the payload schemas themselves are generated and never hand-edited.
References ¶
- Decision record 0009: docs/research/decisions/0009-enrollment-profiles.md
- Decision record 0010: docs/research/decisions/0010-ota-profile-service.md
- Plan of record: docs/research/implementation_plan.md (phase 3)
- Threat model: docs/security/threat-model.md (Enrollment profile row)
- Apple: https://developer.apple.com/documentation/devicemanagement/profile-specific-payload-keys
- Apple: https://developer.apple.com/documentation/devicemanagement/deploying-device-management-enrollment-profiles
- Schema: third_party/device-management/mdm/profiles/TopLevel.yaml, CommonPayloadKeys.yaml
- RFC 5652 (Cryptographic Message Syntax): https://www.rfc-editor.org/rfc/rfc5652
Index ¶
Constants ¶
const ( ScopeSystem = "System" ScopeUser = "User" )
Scope values for PayloadScope.
const PayloadTypeConfiguration = "Configuration"
PayloadTypeConfiguration is the top-level PayloadType of every profile.
Variables ¶
var ( ErrInvalid = errors.New("profile: invalid") ErrParse = errors.New("profile: parse") )
Errors returned by this package.
Functions ¶
func DefaultResolver ¶
DefaultResolver resolves a payload type through schema/profiles.
Types ¶
type ParseOptions ¶
type ParseOptions struct {
// Verify is applied when the data is CMS-signed. Roots nil means any
// embedded chain is accepted; see cms.VerifyOptions.
Verify cms.VerifyOptions
// RequireSignature rejects unsigned input.
RequireSignature bool
// Resolve overrides the registry lookup. The default resolves payload
// types with exactly one generated type and keeps the rest raw.
Resolve Resolver
// MaxBytes bounds the plist (default plist.Decoder default).
MaxBytes int
}
ParseOptions configure Parse.
type Parsed ¶
type Parsed struct {
Profile *Profile
// Signer is the certificate that signed the profile, nil when unsigned.
Signer *x509.Certificate
// Plist is the decoded (unsigned) plist bytes.
Plist []byte
}
Parsed is the result of Parse.
type Payload ¶
type Payload struct {
Identifier string
UUID string
Version int64 // default 1
DisplayName string
Description string
Organization string
// Content is the payload body, a type from schema/profiles or a Raw.
Content profiles.Payload
}
Payload is one entry in PayloadContent: the common keys plus a typed body.
type Profile ¶
type Profile struct {
Identifier string
UUID string
Version int64 // default 1
DisplayName string
Description string
Organization string
Scope string
RemovalDisallowed bool
Payloads []Payload
// Extra top-level keys emitted verbatim (ConsentText, RemovalDate...).
// Reserved keys set by the builder are ignored here.
Extra map[string]any
}
Profile is a configuration profile.
type Raw ¶
Raw is a payload whose body is kept as plist keys, for payload types with no generated type or where the registry cannot pick one.
func (*Raw) PayloadTypeName ¶
PayloadTypeName implements profiles.Payload.