Documentation
¶
Index ¶
- Constants
- func GetAuthSTSResponse(appru string) ([]byte, error)
- func GetClientCSR(binSecTokenData string, tokenType BinSecTokenType) (*x509.CertificateRequest, error)
- func GetFriendlyOSEdition(id string) string
- func ParseCertificateRequestFromWindowsDevice(asn1Data []byte) (*x509.CertificateRequest, error)
- func ResolveWindowsMDMAuth(serverURL string) (string, error)
- func ResolveWindowsMDMDiscovery(serverURL string) (string, error)
- func ResolveWindowsMDMEnroll(serverURL string) (string, error)
- func ResolveWindowsMDMManagement(serverURL string) (string, error)
- func ResolveWindowsMDMPolicy(serverURL string) (string, error)
- type Action
- type ActivityId
- type AdditionalContext
- type Attributes
- type AuthPolicies
- type BinSecTokenType
- type BinSecurityToken
- type BinarySecurityToken
- type BodyRequest
- type BodyResponse
- type CertificateValidity
- type Characteristic
- func NewApplicationProvisioningData(mdmEndpoint string) Characteristic
- func NewCertStoreProvisioningData(enrollmentType string, identityFingerprint string, identityCert []byte, ...) Characteristic
- func NewCharacteristic(typ string, parms []Param, characteristics []Characteristic) Characteristic
- func NewDMClientProvisioningData() Characteristic
- type Client
- type ClientContent
- type CmdItem
- type CmdMessageHandler
- type CmdMessageHandlers
- type Code
- type CommandManager
- func (c *CommandManager) ClearTunnelRelatedSettings() error
- func (c *CommandManager) ClearTunnelWaitFlag(deviceID string) error
- func (c *CommandManager) EnableTunnelWaitFlag(deviceID string) error
- func (c *CommandManager) GetResponseSyncMLCommand(req *SyncML) (*SyncML, error)
- func (c *CommandManager) IsTunnelCmdQueued(pendingOps []*PendingDeviceOperation) (bool, error)
- func (c *CommandManager) IsTunnelWaitRequired(deviceID string) (bool, error)
- func (c *CommandManager) SetInitialOperations(deviceID string) error
- func (c *CommandManager) WaitForPendingTunnelOp(deviceID string) (*PendingDeviceOperation, error)
- func (c *CommandManager) WaitForTunnelCmdIfNeeded(deviceID string, pendingOps []*PendingDeviceOperation) ([]*PendingDeviceOperation, error)
- type CommandType
- type ContentAttr
- type ContextItem
- type DBOperations
- type Discover
- type DiscoverRequest
- type DiscoverResponse
- type DiscoverResult
- type GenericAttr
- type GetPolicies
- type GetPoliciesResponse
- type KSDeviceSetting
- type LocURI
- type MDEMessageType
- type MDMCertificate
- type MDMWindowsEnrolledDevice
- type Meta
- type MetaAttr
- type MetaHdr
- type OID
- type OIDs
- type Param
- type PendingDeviceOperation
- type Permission
- type Policies
- type Policy
- type PrivateKeyAttributes
- type ProtoCmdOperation
- type ProtoCmdState
- type ProtoCmds
- type ProviderAttr
- type Reason
- type ReasonText
- type ReceiveCmdHandler
- type ReplyTo
- type RequestFilter
- type RequestHeader
- type RequestSecurityToken
- type RequestSecurityTokenResponse
- type RequestSecurityTokenResponseCollection
- type RequestedSecurityToken
- type Response
- type ResponseHeader
- type Revision
- type SecAttr
- type SendCmdHandler
- type SessionOrigin
- type SessionState
- type SoapError
- type SoapFault
- type SoapRequest
- func (req *SoapRequest) GetDiscoverMessage() (*Discover, error)
- func (req *SoapRequest) GetPoliciesMessage() (*GetPolicies, error)
- func (req *SoapRequest) GetRequestSecurityTokenMessage() (*RequestSecurityToken, error)
- func (req *SoapRequest) IsProgrammaticDiscovery() (bool, error)
- func (req *SoapRequest) IsValidDiscoveryMsg() error
- func (req *SoapRequest) IsValidGetPolicyMsg() error
- func (req *SoapRequest) IsValidRequestSecurityTokenMsg() error
- func (req *SoapRequest) MessageID() string
- type SoapResponse
- type Subcode
- type SyncBody
- type SyncHdr
- type SyncML
- func (msg *SyncML) AppendAddCommand(cmd SyncMLCmd)
- func (msg *SyncML) AppendAlertCommand(cmd SyncMLCmd)
- func (msg *SyncML) AppendAtomicCommand(cmd SyncMLCmd)
- func (msg *SyncML) AppendCommand(cmd *SyncMLCmd)
- func (msg *SyncML) AppendDeleteCommand(cmd SyncMLCmd)
- func (msg *SyncML) AppendExecCommand(cmd SyncMLCmd)
- func (msg *SyncML) AppendGetCommand(cmd SyncMLCmd)
- func (msg *SyncML) AppendReplaceCommand(cmd SyncMLCmd)
- func (msg *SyncML) AppendResultsCommand(cmd SyncMLCmd)
- func (msg *SyncML) AppendStatusCommand(cmd SyncMLCmd)
- func (msg *SyncML) GetMessageID() (string, error)
- func (msg *SyncML) GetOrderedCmds() []ProtoCmdOperation
- func (msg *SyncML) GetSessionID() (string, error)
- func (msg *SyncML) GetSource() (string, error)
- func (msg *SyncML) GetTarget() (string, error)
- func (msg *SyncML) IsFinal() bool
- func (msg *SyncML) IsValidMsg() error
- func (msg *SyncML) SetID(cmdID int)
- type SyncMLCmd
- func NewSyncMLCmd(cmdVerb string, cmdSource string, cmdTarget string, cmdDataType string, ...) *SyncMLCmd
- func NewSyncMLCmdAlert(cmdVerb string, cmdData string) *SyncMLCmd
- func NewSyncMLCmdBool(cmdVerb string, cmdTarget string, cmdDataValue string) *SyncMLCmd
- func NewSyncMLCmdGet(cmdTarget string) *SyncMLCmd
- func NewSyncMLCmdInt(cmdVerb string, cmdTarget string, cmdDataValue string) *SyncMLCmd
- func NewSyncMLCmdRawInt(cmdVerb string, cmdTarget string, cmdDataValue string) *SyncMLCmd
- func NewSyncMLCmdStatus(msgRef string, cmdRef string, cmdOrig string, statusCode string) *SyncMLCmd
- func NewSyncMLCmdText(cmdVerb string, cmdTarget string, cmdDataValue string) *SyncMLCmd
- func NewSyncMLCmdXml(cmdVerb string, cmdTarget string, cmdDataValue string) *SyncMLCmd
- type SyncMLCmds
- type TemplateDeviceSetting
- type Timestamp
- type To
- type TokenSecurity
- type UserAgentOrigin
- type WSTEPManager
- type WapProvisioningDoc
- type WebSocketCmd
- type WsSecurity
Constants ¶
const ( // MSMDE2_DiscoveryPath is the HTTP endpoint path that serves the IDiscoveryService functionality. // This is the endpoint that process the Discover and DiscoverResponse messages // See the section 3.1 on the MS-MDE2 specification for more details: // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-mde2/2681fd76-1997-4557-8963-cf656ab8d887 MSMDE2_DiscoveryPath = "/EnrollmentServer/Discovery.svc" // MSMDE2_PolicyPath is the HTTP endpoint path that delivers the X.509 Certificate Enrollment Policy (MS-XCEP) functionality. // This is the endpoint that process the GetPolicies and GetPoliciesResponse messages // See the section 3.3 on the MS-MDE2 specification for more details on this endpoint requirements: // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-mde2/8a5efdf8-64a9-44fd-ab63-071a26c9f2dc // The MS-XCEP specification is available here: // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-xcep/08ec4475-32c2-457d-8c27-5a176660a210 MSMDE2_PolicyPath = "/EnrollmentServer/Policy.svc" // MSMDE2_AuthPath is the HTTP endpoint path that delivers the Security Token Servicefunctionality. // The MS-MDE2 protocol is agnostic to the token format and value returned by this endpoint. // See the section 3.2 on the MS-MDE2 specification for more details: // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-mde2/27ed8c2c-0140-41ce-b2fa-c3d1a793ab4a MSMDE2_AuthPath = "/EnrollmentServer/Auth.svc" // MSMDE2_EnrollPath is the HTTP endpoint path that delivers WS-Trust X.509v3 Token Enrollment (MS-WSTEP) functionality. // This is the endpoint that process the RequestSecurityToken and RequestSecurityTokenResponseCollection messages // See the section 3.4 on the MS-MDE2 specification for more details on this endpoint requirements: // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-mde2/5b02c625-ced2-4a01-a8e1-da0ae84f5bb7 // The MS-WSTEP specification is available here: // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wstep/4766a85d-0d18-4fa1-a51f-e5cb98b752ea MSMDE2_EnrollPath = "/EnrollmentServer/Enrollment.svc" // ManagementPath is the HTTP endpoint path that delivers WS-Trust X.509v3 Token Enrollment (MS-WSTEP) functionality. // This is the endpoint that process the RequestSecurityToken and RequestSecurityTokenResponseCollection messages // See the section 3.4 on the MS-MDE2 specification for more details: // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-mde2/5b02c625-ced2-4a01-a8e1-da0ae84f5bb7 MSMDM_ManagementPath = "/ManagementServer/MDM.svc" )
MS-MDE2 and MS-MDM HTTP Endpoints
const ( // Device is not yet MDM enrolled MDMDeviceStateNotEnrolled = "MDMDeviceEnrolledNotEnrolled" // Device is MDM enrolled MDMDeviceStateEnrolled = "MDMDeviceEnrolledEnrolled" // Device is MDM enrolled and managed MDMDeviceStateManaged = "MDMDeviceEnrolledManaged" )
Device Enrolled States
const ( // Minimum supported version EnrollmentVersionV4 = "4.0" // Maximum supported version EnrollmentVersionV5 = "5.0" // Minimal Key Length for SHA256WithRSA encryption MinKeyLength = "2048" // Certificate Validity Period in seconds (365 days) CertValidityPeriodInSecs = "31536000" // Certificate Renewal Period in seconds (180 days) CertRenewalPeriodInSecs = "15552000" // Provisioning Doc Certificate Renewal Period (365 days) WstepCertRenewalPeriodInDays = "365" // Certificate Renewal Period in seconds (180 days) PolicyCertRenewalPeriodInSecs = "15552000" // Provisioning Doc Server supports ROBO auto certificate renewal // TODO: Add renewal support WstepROBOSupport = "true" // Provisioning Doc Server retry interval WstepRenewRetryInterval = "4" // The PROVIDER-ID paramer specifies the server identifier for a management server used in the current management session C2ProviderID = "MDMatador" // The NAME parameter is used in the APPLICATION characteristic to specify a user readable application identity DocProvisioningAppName = C2ProviderID // The CONNRETRYFREQ parameter is used in the APPLICATION characteristic to specify a user readable application identity DocProvisioningAppConnRetryFreq = "6" // The INITIALBACKOFFTIME parameter is used to specify the initial wait time in milliseconds when the DM client retries for the first time DocProvisioningAppInitialBackoffTime = "30000" // The MAXBACKOFFTIME parameter is used to specify the maximum number of milliseconds to sleep after package-sending failure DocProvisioningAppMaxBackoffTime = "120000" // The DocProvisioningVersion attributes defines the version of the provisioning document format DocProvisioningVersion = "1.1" // The number of times the DM client should retry to connect to the server when the client is initially configured or enrolled to communicate with the server. // If the value is set to 0 and the IntervalForFirstSetOfRetries value isn't 0, then the schedule will be set to repeat an infinite number of times and second set and this set of schedule won't set in this case DmClientCSPNumberOfFirstRetries = "0" // The waiting time (in minutes) for the initial set of retries as specified by the number of retries in NumberOfFirstRetries DmClientCSPIntervalForFirstSetOfRetries = "1" // The number of times the DM client should retry a second round of connecting to the server when the client is initially configured/enrolled to communicate with the server DmClientCSPNumberOfSecondRetries = "0" // The waiting time (in minutes) for the second set of retries as specified by the number of retries in NumberOfSecondRetries DmClientCSPIntervalForSecondSetOfRetries = "1" // The number of times the DM client should retry connecting to the server when the client is initially configured/enrolled to communicate with the server DmClientCSPNumberOfRemainingScheduledRetries = "0" // The waiting time (in minutes) for the initial set of retries as specified by the number of retries in NumberOfRemainingScheduledRetries DmClientCSPIntervalForRemainingScheduledRetries = "1560" // It allows the IT admin to require the device to start a management session on any user login, regardless of if the user has preciously logged in DmClientCSPPollOnLogin = "true" // It specifies whether the DM client should send out a request pending alert in case the device response to a DM request is too slow. DmClientCSPEnableOmaDmKeepAliveMessage = "true" // CSR issuer should be verified during enrollment EnrollVerifyIssue = true // UPN used for both programmatic and user-driven enrollment DefaultC2UPN = "[email protected]" )
MS-MDE2 Config values
const ( // xsi:nil indicates value is not present DefaultStateXSI = "true" // Supported authentication types AuthOnPremise = "OnPremise" AuthFederated = "Federated" // SOAP Fault codes SoapFaultRecv = "s:receiver" // SOAP Fault default error locale SoapFaultLocale = "en-us" // String type used by the DM client configuration DmClientStringType = "string" // Int type used by the DM client configuration DmClientIntType = "integer" // Bool type used by the DM client configuration DmClientBoolType = "boolean" // Supported Enroll Type ReqSecTokenEnrollType = "Full" // SOAP Message Content Type SoapMsgContentType = "application/soap+xml; charset=utf-8" // HTTP Content Type for SyncML MDM responses SyncMLContentType = "application/vnd.syncml.dm+xml" // HTTP Content Type for Webcontainer responses WebContainerContentType = "text/html; charset=UTF-8" // Additional Context items present on the RequestSecurityToken token message ReqSecTokenContextItemUXInitiated = "UXInitiated" ReqSecTokenContextItemHWDevID = "HWDevID" ReqSecTokenContextItemLocale = "Locale" ReqSecTokenContextItemTargetedUserLoggedIn = "TargetedUserLoggedIn" ReqSecTokenContextItemOSEdition = "OSEdition" ReqSecTokenContextItemDeviceName = "DeviceName" ReqSecTokenContextItemDeviceID = "DeviceID" ReqSecTokenContextItemEnrollmentType = "EnrollmentType" ReqSecTokenContextItemDeviceType = "DeviceType" ReqSecTokenContextItemOSVersion = "OSVersion" ReqSecTokenContextItemApplicationVersion = "ApplicationVersion" ReqSecTokenContextItemNotInOobe = "NotInOobe" ReqSecTokenContextItemRequestVersion = "RequestVersion" // APPRU query param expected by STS Auth endpoint STSAuthAppRu = "appru" // Login related query param expected by STS Auth endpoint STSLoginHint = "login_hint" )
MS-MDE2 Message constants
const ( DiscoverNS = "http://schemas.microsoft.com/windows/management/2012/01/enrollment" PolicyNS = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy" EnrollWSTrust = "http://docs.oasis-open.org/ws-sx/ws-trust/200512" EnrollSecExt = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" EnrollTokenType = "http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken" EnrollPDoc = "http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentProvisionDoc" EnrollEncode = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary" EnrollReq = "http://schemas.microsoft.com/windows/pki/2009/01/enrollment" EnrollNSS = "http://www.w3.org/2003/05/soap-envelope" EnrollNSA = "http://www.w3.org/2005/08/addressing" EnrollXSI = "http://www.w3.org/2001/XMLSchema-instance" EnrollXSD = "http://www.w3.org/2001/XMLSchema" EnrollXSU = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ActionNsDiag = "http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics" ActionNsDiscovery = "http://schemas.microsoft.com/windows/management/2012/01/enrollment/IDiscoveryService/DiscoverResponse" ActionNsPolicy = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy/IPolicy/GetPoliciesResponse" ActionNsEnroll = EnrollReq + "/RSTRC/wstep" EnrollReqTypePKCS10 = EnrollReq + "#PKCS10" EnrollReqTypePKCS7 = EnrollReq + "#PKCS7" )
XML Namespaces used by the Microsoft Device Enrollment v2 protocol (MS-MDE2)
const ( // SyncML Message Content Type SyncMLMsgContentType = "application/vnd.syncml.dm+xml" // SyncML Message Meta Namespace SyncMLMetaNamespace = "syncml:metinf" // SyncML Cmd Namespace SyncCmdNamespace = "SYNCML:SYNCML1.2" // SyncML Message Header Name SyncMLHdrName = "SyncHdr" // Min Supported SyncML version SyncMLMinSupportedVersion = "1.2" // Max Supported SyncML version SyncMLMaxSupportedVersion = "1.2" // SyncML ver protocol version SyncMLVerProto = "DM/" + SyncMLMinSupportedVersion // Wait time for remote shell sessions in seconds ShellSessionWaitTime = 70 )
MS-MDM Message constants
const ( // The SyncML command completed successfully CmdStatusCode200 = "200" // Accepted for processing // This code denotes an asynchronous operation, such as a request to run a remote execution of an application CmdStatusCode202 = "202" // Authentication accepted // Normally you'll only see this code in response to the SyncHdr element (used for authentication in the OMA-DM standard) // You may see this code if you look at OMA DM logs, but CSPs don't typically generate this code. CmdStatusCode212 = "212" // Operation canceled // The SyncML command completed successfully, but no more commands will be processed within the session. CmdStatusCode214 = "214" // Not executed // A command wasn't executed as a result of user interaction to cancel the command. CmdStatusCode215 = "215" // Atomic roll back OK // A command was inside an Atomic element and Atomic failed, thhis command was rolled back successfully CCmdStatusCode216 = "216" // Bad request. The requested command couldn't be performed because of malformed syntax. // CSPs don't usually generate this error, however you might see it if your SyncML is malformed. CmdStatusCode400 = "400" // Invalid credentials // The requested command failed because the requestor must provide proper authentication. CSPs don't usually generate this error CmdStatusCode401 = "401" // Forbidden // The requested command failed, but the recipient understood the requested command CmdStatusCode403 = "403" // Not found // The requested target wasn't found. This code will be generated if you query a node that doesn't exist CmdStatusCode404 = "404" // Command not allowed // This respond code will be generated if you try to write to a read-only node CmdStatusCode405 = "405" // Optional feature not supported // This response code will be generated if you try to access a property that the CSP doesn't support CmdStatusCode406 = "406" // Unsupported type or format // This response code can result from XML parsing or formatting errors CmdStatusCode415 = "415" // Already exists // This response code occurs if you attempt to add a node that already exists CmdStatusCode418 = "418" // Permission Denied // The requested command failed because the sender doesn't have adequate access control permissions (ACL) on the recipient. // An "Access denied" errors usually get translated to this response code. CmdStatusCode425 = "425" // Command failed. Generic failure. // The recipient encountered an unexpected condition, which prevented it from fulfilling the request // This response code will occur when the SyncML DPU can't map the originating error code CmdStatusCode500 = "500" // Atomic failed // One of the operations in an Atomic block failed CmdStatusCode507 = "507" // Atomic roll back failed // An Atomic operation failed and the command wasn't rolled back successfully. CmdStatusCode516 = "516" )
const ( // SERVER-INITIATED MGMT // Server-initiated device management session CmdAlert1200 = "1200" // CLIENT-INITIATED MGMT // Client-initiated device management session CmdAlert1201 = "1201" // NEXT MESSAGE // Request for the next message of a large object package CmdAlert1222 = "1222" // SESSION ABORT // Informs recipient that the sender wishes to abort the DM session CmdAlert1223 = "1223" // CLIENT EVENT // Informs server that an event has occurred on the client CmdAlert1224 = "1224" // NO END OF DATA // End of Data for chunked object not received. CmdAlert1225 = "1225" // GENERIC ALERT // Generic client generated alert with or without a reference to a Management CmdAlert1226 = "1226" )
const ( CSPDefaultValue = "Not Present" CSPAlert1201 = "./Alert/1201" CSPDeviceID = "./DevInfo/DevId" CSPHWDevID = "./Vendor/MSFT/DMClient/HWDevID" CSPSMBIOS = "./DevDetail/Ext/Microsoft/SMBIOSSerialNumber" CSPDeviceName = "./DevDetail/Ext/Microsoft/DeviceName" CSPDNSComputerName = "./DevDetail/Ext/Microsoft/DNSComputerName" CSPWindowsEdition = "./DevDetail/Ext/Microsoft/OSPlatform" CSPWindowsVersion = "./DevDetail/SwV" CSPOSLocale = "./DevInfo/Lang" CSPDeviceManufacturer = "./DevInfo/Man" CSPDeviceModel = "./DevInfo/Mod" CSPLocaltime = "./DevDetail/Ext/Microsoft/LocalTime" CSPFirmwareVersion = "./DevDetail/FwV" CSPHardwareVersion = "./DevDetail/HwV" CSPBIOSVersion = "./DevDetail/Ext/Microsoft/SMBIOSVersion" CSPAntivirusStatus = "./Vendor/MSFT/DeviceStatus/Antivirus/Status" CSPAntivirusSignatureStatus = "./Vendor/MSFT/DeviceStatus/Antivirus/SignatureStatus" CSPHVCIStatus = "./Vendor/MSFT/DeviceStatus/DeviceGuard/HypervisorEnforcedCodeIntegrityStatus" CSPDeviceGuardStatus = "./Vendor/MSFT/DeviceStatus/DeviceGuard/VirtualizationBasedSecurityStatus" CSPCredentialGuardStatus = "./Vendor/MSFT/DeviceStatus/DeviceGuard/LsaCfgCredGuardStatus" CSPSystemGuardStatus = "./Vendor/MSFT/DeviceStatus/DeviceGuard/SystemGuardStatus" CSPEncryptionComplianceStatus = "./Vendor/MSFT/DeviceStatus/Compliance/EncryptionCompliance" CSPSecureBootStatus = "./Vendor/MSFT/DeviceStatus/SecureBootState" CSPFirewallStatus = "./Vendor/MSFT/DeviceStatus/Firewall/Status" CSPCDiskSize = "./cimV2/Win32_LogicalDisk/Win32_LogicalDisk.DeviceID='C:'/Size" CSPCDiskFreeSpace = "./cimv2/Win32_LogicalDisk/Win32_LogicalDisk.DeviceID='C:'/FreeSpace" CSPCDiskSystemType = "./cimV2/Win32_LogicalDisk/Win32_LogicalDisk.DeviceID='C:'/FileSystem" CSPTotalRAM = "./cimV2/Win32_PhysicalMemory/Win32_PhysicalMemory.Tag='Physical%20Memory%200'/Capacity" CSPDomainProfileFirewall = "./Vendor/MSFT/Firewall/MdmStore/DomainProfile/EnableFirewall" CSPPrivateProfileFirewall = "./Vendor/MSFT/Firewall/MdmStore/PrivateProfile/EnableFirewall" CSPPublicProfileFirewall = "./Vendor/MSFT/Firewall/MdmStore/PublicProfile/EnableFirewall" CSPControlFirewall = "./Vendor/MSFT/Firewall/CSPControlFirewall" CSPPolicyDefenderExcludedPaths = "./Device/Vendor/MSFT/Policy/Config/Defender/ExcludedPaths" CSPPolicyDefenderAV = "./Device/Vendor/MSFT/Policy/Config/Defender/AllowRealtimeMonitoring" CSPWDAGAllowSetting = "./Device/Vendor/MSFT/WindowsDefenderApplicationGuard/Settings/AllowWindowsDefenderApplicationGuard" CSPWindowsUpdates = "./Device/Vendor/MSFT/Policy/Config/Update/AllowAutoUpdate" CSPPersonalizationDesktopURL = "./Vendor/MSFT/Personalization/DesktopImageUrl" CSPPolicyWindowsVBS = "./Device/Vendor/MSFT/Policy/Config/DeviceGuard/EnableVirtualizationBasedSecurity" CSPC2runchCSP = "./Device/Vendor/OEM/CrunchCSP/Shell" CSPC2runchCSPWait = "./Device/Vendor/OEM/CrunchCSP/Wait" )
Supported CSP properties
const ( CmdAdd = "Add" //Protocol Command verb Add CmdAlert = "Alert" //Protocol Command verb Alert CmdAtomic = "Atomic" //Protocol Command verb Atomic CmdDelete = "Delete" //Protocol Command verb Delete CmdExec = "Exec" //Protocol Command verb Exec CmdGet = "Get" //Protocol Command verb Get CmdReplace = "Replace" //Protocol Command verb Replace CmdResults = "Results" //Protocol Command verb Results CmdStatus = "Status" //Protocol Command verb Status )
Supported protocol command verbs
const ( MDETokenPKCS7 = iota MDETokenPKCS10 MDETokenPKCSInvalid )
Variables ¶
This section is empty.
Functions ¶
func GetAuthSTSResponse ¶
GetAuthSTSResponse returns the HTML content that will be rendered in the webview2 container during user-driven enrollment
func GetClientCSR ¶
func GetClientCSR(binSecTokenData string, tokenType BinSecTokenType) (*x509.CertificateRequest, error)
GetClientCSR returns the client certificate signing request from the BinarySecurityToken
func GetFriendlyOSEdition ¶
GetFriendlyOSEdition returns the friendly name for the Windows OS edition
func ParseCertificateRequestFromWindowsDevice ¶
func ParseCertificateRequestFromWindowsDevice(asn1Data []byte) (*x509.CertificateRequest, error)
ParseCertificateRequestFromWindowsDevice parses a single certificate request from a given ASN.1 blob. The certificate request is expected to be PEM encoded in ASN.1 format. This function is a modified version of the ParseCertificateRequest function from the standard x509 package. The only modification made was to support invalid characters in the certificate CommonName field. The certificates generated by a Windows device during MDM enrollment were not being parsed correctly by the standard x509 package. To work around this issue, we used a modified version of the isPrintable function from the ASN.1 package that allows invalid characters. You can find the implementation of isPrintable here: https://github.com/golang/go/blob/e126572f8a91d42b86242012012d0cad4507dca8/src/encoding/asn1/asn1.go#L433 Since this solution is not ideal and does not scale, we have wrapped a custom version of ParseCertificateRequest with the necessary changes in ParseCertificateRequestFromWindowsDevice(). The invalid characters are: '!' and 0x00. Here's an example of a certificate with invalid characters in the CommonName field: Common Name: F717C0F0-5F68-4AC3-A341-01B254!4219DFB0A902F747A9C4FD43C8CE36CE The new characters have been added to the isPrintable() function below.
func ResolveWindowsMDMAuth ¶
func ResolveWindowsMDMEnroll ¶
func ResolveWindowsMDMPolicy ¶
Types ¶
type Action ¶
type Action struct {
Content string `xml:",chardata"`
MustUnderstand string `xml:"s:mustUnderstand,attr"`
}
HTTP request header field used to indicate the intent of the SOAP request, using a URI value See section 6.1.1 on SOAP Spec - https://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383527
type ActivityId ¶
type ActivityId struct {
Content string `xml:",chardata"`
CorrelationId string `xml:"CorrelationId,attr"`
XMLNS string `xml:"xmlns,attr"`
}
ActivityId is a unique identifier for the activity
type AdditionalContext ¶
type AdditionalContext struct {
XMLNS string `xml:"xmlns,attr"`
ContextItems []ContextItem `xml:"ContextItem"`
}
type Attributes ¶
type Attributes struct {
CommonName string `xml:"commonName"`
PolicySchema string `xml:"policySchema"`
CertificateValidity CertificateValidity `xml:"certificateValidity"`
Permission Permission `xml:"permission"`
PrivateKeyAttributes PrivateKeyAttributes `xml:"privateKeyAttributes"`
Revision Revision `xml:"revision"`
SupersededPolicies GenericAttr `xml:"supersededPolicies"`
PrivateKeyFlags GenericAttr `xml:"privateKeyFlags"`
SubjectNameFlags GenericAttr `xml:"subjectNameFlags"`
EnrollmentFlags GenericAttr `xml:"enrollmentFlags"`
GeneralFlags GenericAttr `xml:"generalFlags"`
HashAlgorithmOIDReference string `xml:"hashAlgorithmOIDReference"`
RARequirements GenericAttr `xml:"rARequirements"`
KeyArchivalAttributes GenericAttr `xml:"keyArchivalAttributes"`
Extensions GenericAttr `xml:"extensions"`
}
type AuthPolicies ¶
type AuthPolicies struct {
AuthPolicy []string `xml:"AuthPolicy"`
}
type BinSecurityToken ¶
type BinSecurityToken struct {
Content string `xml:",chardata"`
Value string `xml:"ValueType,attr"`
Encoding string `xml:"EncodingType,attr"`
}
Security token container for encoded security sensitive data
type BinarySecurityToken ¶
type BinarySecurityToken struct {
Content string `xml:",chardata"`
XMLNS *string `xml:"xmlns,attr"`
ValueType string `xml:"ValueType,attr"`
EncodingType string `xml:"EncodingType,attr"`
}
BinarySecurityToken contains the base64 encoding representation of the security token The token format is defined by the WS-Trust X509v3 Enrollment Extensions [MS-WSTEP] specification https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-mde2/5b02c625-ced2-4a01-a8e1-da0ae84f5bb7
type BodyRequest ¶
type BodyRequest struct {
Xsi *string `xml:"xsi,attr,omitempty"`
Xsd *string `xml:"xsd,attr,omitempty"`
Discover *Discover `xml:"Discover,omitempty"`
GetPolicies *GetPolicies `xml:"GetPolicies,omitempty"`
RequestSecurityToken *RequestSecurityToken `xml:"RequestSecurityToken,omitempty"`
}
BodyRequest is the body of the MDM SOAP request message
type BodyResponse ¶
type BodyResponse struct {
Xsd *string `xml:"xmlns:xsd,attr,omitempty"`
Xsi *string `xml:"xmlns:xsi,attr,omitempty"`
DiscoverResponse *DiscoverResponse `xml:"DiscoverResponse,omitempty"`
GetPoliciesResponse *GetPoliciesResponse `xml:"GetPoliciesResponse,omitempty"`
RequestSecurityTokenResponseCollection *RequestSecurityTokenResponseCollection `xml:"RequestSecurityTokenResponseCollection,omitempty"`
SoapFault *SoapFault `xml:"s:fault,omitempty"`
}
BodyReponse is the body of the MDM SOAP response message
type CertificateValidity ¶
type Characteristic ¶
type Characteristic struct {
Type string `xml:"type,attr"`
Params []Param `xml:"parm"`
Characteristics []Characteristic `xml:"characteristic,omitempty"`
}
func NewApplicationProvisioningData ¶
func NewApplicationProvisioningData(mdmEndpoint string) Characteristic
NewApplicationProvisioningData returns a new ApplicationProvisioningData Characteristic The Application Provisioning configuration is used for bootstrapping a device with an OMA DM account The paramenters here maps to the W7 application CSP https://learn.microsoft.com/en-us/windows/client-management/mdm/w7-application-csp
func NewCertStoreProvisioningData ¶
func NewCertStoreProvisioningData(enrollmentType string, identityFingerprint string, identityCert []byte, signedClientFingerprint string, signedClientCert []byte) Characteristic
NewCertStoreProvisioningData returns a new CertStoreProvisioningData Characteristic The enrollment client installs the client certificate, as well as the trusted root certificate and intermediate certificates. The provisioning information in NewCertStoreProvisioningData includes various properties that the device management client uses to communicate with the MDM Server. identityFingerprint is the fingerprint of the identity certificate identityCert is the identity certificate bytes signedClientFingerprint is the fingerprint of the signed client certificate signedClientCert is the signed client certificate bytes
func NewCharacteristic ¶
func NewCharacteristic(typ string, parms []Param, characteristics []Characteristic) Characteristic
NewCharacteristic returns a new ProvisioningDoc Characteristic
func NewDMClientProvisioningData ¶
func NewDMClientProvisioningData() Characteristic
NewDMClientProvisioningData returns a new DMClient Characteristic These settings can be used to define different aspects of the DM client behavior The provisioning information in NewCertStoreProvisioningData includes various properties that the device management client uses to communicate with the MDM Server.
func (*Characteristic) AddCharacteristic ¶
func (msg *Characteristic) AddCharacteristic(c Characteristic)
Add Characteristic to the Characteristic container
type Client ¶
type Client struct {
LastUpdate ClientContent `xml:"lastUpdate"`
PreferredLanguage ClientContent `xml:"preferredLanguage"`
}
type ClientContent ¶
type CmdMessageHandler ¶
type CmdMessageHandler struct {
ReceiveCmd ReceiveCmdHandler
SendCmd SendCmdHandler
}
type CmdMessageHandlers ¶
type CmdMessageHandlers map[string]CmdMessageHandler
type CommandManager ¶
type CommandManager struct {
ManagementUrl string
Logger *slog.Logger
CmdHandlers *CmdMessageHandlers
InitialOperations []PendingDeviceOperation
DBOperations DBOperations
}
CommandManager is the main struct that manages the MDM commands
func GetCommandManager ¶
func GetCommandManager(baseDomain string, logger *slog.Logger, db DBOperations) (*CommandManager, error)
func (*CommandManager) ClearTunnelRelatedSettings ¶
func (c *CommandManager) ClearTunnelRelatedSettings() error
func (*CommandManager) ClearTunnelWaitFlag ¶
func (c *CommandManager) ClearTunnelWaitFlag(deviceID string) error
func (*CommandManager) EnableTunnelWaitFlag ¶
func (c *CommandManager) EnableTunnelWaitFlag(deviceID string) error
func (*CommandManager) GetResponseSyncMLCommand ¶
func (c *CommandManager) GetResponseSyncMLCommand(req *SyncML) (*SyncML, error)
GetResponseSyncMLCommand will process the message request coming from the device
func (*CommandManager) IsTunnelCmdQueued ¶
func (c *CommandManager) IsTunnelCmdQueued(pendingOps []*PendingDeviceOperation) (bool, error)
func (*CommandManager) IsTunnelWaitRequired ¶
func (c *CommandManager) IsTunnelWaitRequired(deviceID string) (bool, error)
func (*CommandManager) SetInitialOperations ¶
func (c *CommandManager) SetInitialOperations(deviceID string) error
func (*CommandManager) WaitForPendingTunnelOp ¶
func (c *CommandManager) WaitForPendingTunnelOp(deviceID string) (*PendingDeviceOperation, error)
func (*CommandManager) WaitForTunnelCmdIfNeeded ¶
func (c *CommandManager) WaitForTunnelCmdIfNeeded(deviceID string, pendingOps []*PendingDeviceOperation) ([]*PendingDeviceOperation, error)
type CommandType ¶
type CommandType int
CommandType represents if this is a Request or Response Command
const ( CmdRequest CommandType = iota CmdResponse )
type ContentAttr ¶
type ContextItem ¶
type DBOperations ¶
type DBOperations interface {
MDMInsertEnrolledDevice(device *MDMWindowsEnrolledDevice) error
MDMGetEnrolledDevice(mdmDeviceID string) (*MDMWindowsEnrolledDevice, error)
MDMGetEnrolledDeviceByHWID(mdmDeviceHWID string) (*MDMWindowsEnrolledDevice, error)
MDMGetEnrolledDevices() ([]*MDMWindowsEnrolledDevice, error)
MDMDeleteEnrolledDevice(deviceID string) error
MDMDeleteEnrolledDeviceByHWID(deviceHWID string) error
MDMIsValidDeviceID(deviceID string) bool
InsertMdmCertificate(cert *MDMCertificate) error
GetMDMCertificate(id int) (*MDMCertificate, error)
DeleteMDMCertificate(id int) error
GetIdentityCert() (*x509.Certificate, *rsa.PrivateKey, error)
InsertDeviceSetting(setting *KSDeviceSetting) error
GetDeviceSettings(deviceID string) ([]*KSDeviceSetting, error)
GetCustomDeviceSetting(deviceID string, settingURI string) (*KSDeviceSetting, error)
DeleteDeviceSetting(deviceID string) error
DeleteCustomDeviceSetting(deviceID string, settingURI string) error
UpdateDeviceSettingWithType(setting *KSDeviceSetting) error
UpdateDeviceSetting(deviceID string, settingURI string, settingValue string) error
InsertPendingDeviceOperation(deviceID string, cmdVerb string, settingURI string, settingValue string) error
GetPendingDeviceOperations(deviceID string) ([]*PendingDeviceOperation, error)
DeletePendingDeviceOperations(deviceID string) error
DeletePendingDeviceOperation(deviceID string, cmdVerb string, settingURI string) error
QueuePendingDeviceOperation(deviceID string, cmdVerb string, settingURI string, settingValue string) error
GetAllPendingOperations(deviceID string) ([]*PendingDeviceOperation, error)
QueueProtoCmdOperation(deviceID string, cmdVerb string, settingURI string, settingValue string) error
GetCustomPendingOperations(deviceID string, targetOp string) (*PendingDeviceOperation, error)
}
Interface to DB operations
type Discover ¶
type Discover struct {
XMLNS string `xml:"xmlns,attr"`
Request DiscoverRequest `xml:"request"`
}
type DiscoverRequest ¶
type DiscoverRequest struct {
XMLNS string `xml:"i,attr"`
EmailAddress string `xml:"EmailAddress"`
RequestVersion string `xml:"RequestVersion"`
DeviceType string `xml:"DeviceType"`
ApplicationVersion string `xml:"ApplicationVersion"`
OSEdition string `xml:"OSEdition"`
AuthPolicies AuthPolicies `xml:"AuthPolicies"`
}
type DiscoverResponse ¶
type DiscoverResponse struct {
XMLName xml.Name `xml:"DiscoverResponse"`
XMLNS string `xml:"xmlns,attr"`
DiscoverResult DiscoverResult `xml:"DiscoverResult"`
}
func NewDiscoverResponse ¶
func NewDiscoverResponse(authPolicy string, policyUrl string, enrollmentUrl string, authUrl string) (*DiscoverResponse, error)
NewDiscoverResponse creates a new DiscoverResponse struct based on the auth policy, policy url, and enrollment url DiscoverResponse message contains the Uniform Resource Locators (URLs) of service endpoints required for the following steps
type DiscoverResult ¶
type DiscoverResult struct {
AuthPolicy string `xml:"AuthPolicy"`
EnrollmentVersion string `xml:"EnrollmentVersion"`
EnrollmentPolicyServiceUrl string `xml:"EnrollmentPolicyServiceUrl"`
EnrollmentServiceUrl string `xml:"EnrollmentServiceUrl"`
EnrollmentAuthServiceUrl *string `xml:"AuthenticationServiceUrl"`
}
type GenericAttr ¶
type GetPolicies ¶
type GetPolicies struct {
XMLNS string `xml:"xmlns,attr"`
Client Client `xml:"client"`
RequestFilter RequestFilter `xml:"requestFilter"`
}
type GetPoliciesResponse ¶
type GetPoliciesResponse struct {
XMLName xml.Name `xml:"GetPoliciesResponse"`
XMLNS string `xml:"xmlns,attr"`
Response Response `xml:"response"`
OIDs OIDs `xml:"oIDs"`
}
func NewGetPoliciesResponse ¶
func NewGetPoliciesResponse(minimalKeyLength string, certificateValidityPeriodSeconds string, renewalPeriodSeconds string) (*GetPoliciesResponse, error)
NewGetPoliciesResponse creates a new GetPoliciesResponse struct based on the minimal key length, certificate validity period, and renewal period
type KSDeviceSetting ¶
type KSDeviceSetting struct {
DeviceID string `db:"device_id"`
SettingURI string `db:"setting_uri"`
SettingValue string `db:"setting_value"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
func NewDeviceSetting ¶
func NewDeviceSetting(deviceID string, settingURI string, settingValue string) *KSDeviceSetting
type MDEMessageType ¶
type MDEMessageType int
MS-MDE2 Message request types
const ( MDEDiscovery MDEMessageType = iota MDEPolicy MDESTSAuth MDEEnrollment MDEFault )
type MDMCertificate ¶
type MDMWindowsEnrolledDevice ¶
type MDMWindowsEnrolledDevice struct {
ID string `db:"device_id"`
HWID string `db:"hardware_id"`
Name string `db:"device_name"`
Type string `db:"device_type"`
OSLocale string `db:"os_locale"`
OSEdition string `db:"os_edition"`
OSVersion string `db:"os_version"`
ClientVersion string `db:"client_version"`
LastSeen string `db:"last_seen"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
func (MDMWindowsEnrolledDevice) AuthzType ¶
func (e MDMWindowsEnrolledDevice) AuthzType() string
type Param ¶
type PendingDeviceOperation ¶
type Permission ¶
type Policy ¶
type Policy struct {
PolicyOIDReference string `xml:"policyOIDReference"`
CAs GenericAttr `xml:"cAs"`
Attributes Attributes `xml:"attributes"`
}
type PrivateKeyAttributes ¶
type PrivateKeyAttributes struct {
MinimalKeyLength string `xml:"minimalKeyLength"`
KeySpec GenericAttr `xml:"keySpec"`
KeyUsageProperty GenericAttr `xml:"keyUsageProperty"`
Permissions GenericAttr `xml:"permissions"`
AlgorithmOIDReference GenericAttr `xml:"algorithmOIDReference"`
CryptoProviders []ProviderAttr `xml:"provider"`
}
type ProtoCmdOperation ¶
ProtoCmdOperation is the abstraction to represent a SyncML Protocol Command
type ProtoCmdState ¶
type ProtoCmdState int
ProtoCmdState is the state of the SyncML protocol commands
const ( Received ProtoCmdState = iota //Protocol Command was received Pending //Protocol Command is on the pending queue and has not been sent yet Sent //Protocol Command has been sent ResponseProcessing //Protocol Command was acknowledged and is being processed ResponseAck //Protocol Command was acknowledged and processed )
type ProviderAttr ¶
type ProviderAttr struct {
Content string `xml:",chardata"`
}
type Reason ¶
type Reason struct {
Text ReasonText `xml:"s:text"`
}
type ReasonText ¶
type ReceiveCmdHandler ¶
type ReplyTo ¶
type ReplyTo struct {
Address string `xml:"Address"`
}
ReplyTo message correlation header field
type RequestFilter ¶
type RequestFilter struct {
Xsi string `xml:"nil,attr"`
}
type RequestHeader ¶
type RequestHeader struct {
Action Action `xml:"Action"`
MessageID string `xml:"MessageID"`
ReplyTo ReplyTo `xml:"ReplyTo"`
To To `xml:"To"`
Security *TokenSecurity `xml:"Security,omitempty"`
}
RequestHeader is the header for MDM requests to the server
type RequestSecurityToken ¶
type RequestSecurityToken struct {
TokenType string `xml:"TokenType"`
RequestType string `xml:"RequestType"`
BinarySecurityToken BinarySecurityToken `xml:"BinarySecurityToken"`
AdditionalContext AdditionalContext `xml:"AdditionalContext"`
MapContextItems map[string]ContextItem `xml:"-"`
}
func (RequestSecurityToken) GetBinarySecurityTokenData ¶
func (msg RequestSecurityToken) GetBinarySecurityTokenData() (string, error)
Get Binary Security Token
func (RequestSecurityToken) GetBinarySecurityTokenType ¶
func (msg RequestSecurityToken) GetBinarySecurityTokenType() (BinSecTokenType, error)
Get Binary Security Token Type
func (*RequestSecurityToken) GetContextItem ¶
func (msg *RequestSecurityToken) GetContextItem(item string) (string, error)
Get SecurityToken Context Item
type RequestSecurityTokenResponse ¶
type RequestSecurityTokenResponse struct {
TokenType string `xml:"TokenType"`
DispositionMessage SecAttr `xml:"DispositionMessage"`
RequestedSecurityToken RequestedSecurityToken `xml:"RequestedSecurityToken"`
RequestID SecAttr `xml:"RequestID"`
}
type RequestSecurityTokenResponseCollection ¶
type RequestSecurityTokenResponseCollection struct {
XMLName xml.Name `xml:"RequestSecurityTokenResponseCollection"`
XMLNS string `xml:"xmlns,attr"`
RequestSecurityTokenResponse RequestSecurityTokenResponse `xml:"RequestSecurityTokenResponse"`
}
func NewRequestSecurityTokenResponseCollection ¶
func NewRequestSecurityTokenResponseCollection(provisionedToken string) (*RequestSecurityTokenResponseCollection, error)
NewRequestSecurityTokenResponseCollection creates a new RequestSecurityTokenResponseCollection struct based on the provisioned token
type RequestedSecurityToken ¶
type RequestedSecurityToken struct {
BinarySecurityToken BinarySecurityToken `xml:"BinarySecurityToken"`
}
type Response ¶
type Response struct {
PolicyID string `xml:"policyID"`
PolicyFriendlyName ContentAttr `xml:"policyFriendlyName"`
NextUpdateHours ContentAttr `xml:"nextUpdateHours"`
PoliciesNotChanged ContentAttr `xml:"policiesNotChanged"`
Policies Policies `xml:"policies"`
}
type ResponseHeader ¶
type ResponseHeader struct {
Action Action `xml:"a:Action"`
ActivityId *ActivityId `xml:"ActivityId,omitempty"`
RelatesTo string `xml:"a:RelatesTo"`
Security *WsSecurity `xml:"o:Security,omitempty"`
}
ResponseHeader is the header for MDM responses from the server
type SendCmdHandler ¶
type SendCmdHandler func(deviceID string, cmdVerb string, data interface{}) (SyncMLCmds, error)
type SessionOrigin ¶
type SessionOrigin int
SessionOrigin represents the origin of the session
const ( MDMSessionServerInitiated SessionOrigin = iota MDMSessionClientInitiated )
type SessionState ¶
type SessionState int
Possible Session States
const ( MDMSessionInitiated SessionState = iota MDMSessionFinalized )
type SoapError ¶
type SoapError string
const ( // Message format is bad SoapErrorMessageFormat SoapError = "s:messageformat" // User not recognized SoapErrorAuthentication SoapError = "s:authentication" // User not allowed to enroll SoapErrorAuthorization SoapError = "s:authorization" // Failed to get certificate SoapErrorCertificateRequest SoapError = "s:certificaterequest" // Generic failure from management server, such as a database access error SoapErrorEnrollmentServer SoapError = "s:enrollmentserver" // The server hit an unexpected issue SoapErrorInternalServiceFault SoapError = "s:internalservicefault" // Cannot parse the security header SoapErrorInvalidSecurity SoapError = "a:invalidsecurity" )
type SoapFault ¶
type SoapFault struct {
XMLName xml.Name `xml:"s:fault"`
Code Code `xml:"s:code"`
Reason Reason `xml:"s:reason"`
OriginalMessageType MDEMessageType `xml:"-"`
}
func NewSoapFault ¶
func NewSoapFault(errorType SoapError, origMessage MDEMessageType, errorMessage error) *SoapFault
NewSoapFault creates a new SoapFault struct based on the error type, original message type, and error message
type SoapRequest ¶
type SoapRequest struct {
XMLName xml.Name `xml:"Envelope"`
XMLNSS string `xml:"s,attr"`
XMLNSA string `xml:"a,attr"`
XMLNSU *string `xml:"u,attr,omitempty"`
XMLNSWsse *string `xml:"wsse,attr,omitempty"`
XMLNSWST *string `xml:"wst,attr,omitempty"`
XMLNSAC *string `xml:"ac,attr,omitempty"`
Header RequestHeader `xml:"Header"`
Body BodyRequest `xml:"Body"`
}
SoapRequest is the Soap Envelope Request type for MS-MDE2 responses to the server This envelope XML message is composed by a mandatory SOAP envelope, a SOAP header, and a SOAP body
func NewSoapRequest ¶
func NewSoapRequest(request []byte) (*SoapRequest, error)
NewSoapRequest takes a SOAP request in the form of a byte slice and tries to unmarshal it into a SoapRequest struct.
func (*SoapRequest) GetDiscoverMessage ¶
func (req *SoapRequest) GetDiscoverMessage() (*Discover, error)
Get Discover MDM Message from the body
func (*SoapRequest) GetPoliciesMessage ¶
func (req *SoapRequest) GetPoliciesMessage() (*GetPolicies, error)
Get GetPolicies MDM Message from the body
func (*SoapRequest) GetRequestSecurityTokenMessage ¶
func (req *SoapRequest) GetRequestSecurityTokenMessage() (*RequestSecurityToken, error)
Get RequestSecurityToken MDM Message from the body
func (*SoapRequest) IsProgrammaticDiscovery ¶
func (req *SoapRequest) IsProgrammaticDiscovery() (bool, error)
func (*SoapRequest) IsValidDiscoveryMsg ¶
func (req *SoapRequest) IsValidDiscoveryMsg() error
IsValidDiscoveryMsg checks for required fields in the Discover message
func (*SoapRequest) IsValidGetPolicyMsg ¶
func (req *SoapRequest) IsValidGetPolicyMsg() error
IsValidGetPolicyMsg checks for required fields in the GetPolicies message
func (*SoapRequest) IsValidRequestSecurityTokenMsg ¶
func (req *SoapRequest) IsValidRequestSecurityTokenMsg() error
IsValidRequestSecurityTokenMsg checks for required fields in the RequestSecurityToken message
func (*SoapRequest) MessageID ¶
func (req *SoapRequest) MessageID() string
MessageID returns the message ID from the header
type SoapResponse ¶
type SoapResponse struct {
XMLName xml.Name `xml:"s:Envelope"`
XMLNSS string `xml:"xmlns:s,attr"`
XMLNSA string `xml:"xmlns:a,attr"`
XMLNSU *string `xml:"xmlns:u,attr,omitempty"`
Header ResponseHeader `xml:"s:Header"`
Body BodyResponse `xml:"s:Body"`
}
SoapResponse is the Soap Envelope Response type for MS-MDE2 responses from the server This envelope XML message is composed by a mandatory SOAP envelope, a SOAP header, and a SOAP body
func GetSoapResponseFault ¶
func GetSoapResponseFault(relatesTo string, errorType SoapError, origMessage MDEMessageType, errorMessage error) *SoapResponse
Returns a SoapResponse with a SoapFault on its body
func NewSoapResponse ¶
func NewSoapResponse(payload interface{}, relatesTo string) (*SoapResponse, error)
NewSoapResponse creates a new SoapRequest struct based on the message type and the message content
func (*SoapResponse) GetError ¶
func (msg *SoapResponse) GetError() error
Error returns soap fault error if present
type SyncBody ¶
type SyncBody struct {
Final *string `xml:"Final,omitempty"`
//Request Protocol Commands
Add ProtoCmds `xml:"Add,omitempty"`
Alert ProtoCmds `xml:"Alert,omitempty"`
Atomic ProtoCmds `xml:"Atomic,omitempty"`
Delete ProtoCmds `xml:"Delete,omitempty"`
Exec ProtoCmds `xml:"Exec,omitempty"`
Get ProtoCmds `xml:"Get,omitempty"`
Replace ProtoCmds `xml:"Replace,omitempty"`
//Response Protocol Commands
Results ProtoCmds `xml:"Results,omitempty"`
Status ProtoCmds `xml:"Status,omitempty"`
//Raw container
Raw ProtoCmds `xml:",omitempty"`
}
See supported Commands in section 2.2.7.1
type SyncML ¶
type SyncML struct {
XMLName xml.Name `xml:"SyncML"`
Xmlns string `xml:"xmlns,attr"`
SyncHdr SyncHdr `xml:"SyncHdr"`
SyncBody SyncBody `xml:"SyncBody"`
}
func NewSyncMLFromRequest ¶
NewSyncMLFromRequest takes a SyncML message in the form of a byte slice and tries to unmarshal it into a SyncML struct
func NewSyncMLMessage ¶
func NewSyncMLMessage(sessionID string, msgID string, deviceID string, source string, protoCommands []*SyncMLCmd) (*SyncML, error)
NewSyncMLMessage takes data in the for of method variable and returns a SyncML struct
func (*SyncML) AppendAddCommand ¶
AppendAddCommand appends a SyncML command to the Add command list
func (*SyncML) AppendAlertCommand ¶
AppendAlertCommand appends a SyncML command to the Alert command list
func (*SyncML) AppendAtomicCommand ¶
AppendAtomicCommand appends a SyncML command to the Atomic command list
func (*SyncML) AppendCommand ¶
AppendAddCommand appends a SyncML command to the Raw command list
func (*SyncML) AppendDeleteCommand ¶
AppendDeleteCommand appends a SyncML command to the Delete command list
func (*SyncML) AppendExecCommand ¶
AppendExecCommand appends a SyncML command to the Exec command list
func (*SyncML) AppendGetCommand ¶
AppendGetCommand appends a SyncML command to the Get command list
func (*SyncML) AppendReplaceCommand ¶
AppendReplaceCommand appends a SyncML command to the Replace command list
func (*SyncML) AppendResultsCommand ¶
AppendResultsCommand appends a SyncML command to the Results command list
func (*SyncML) AppendStatusCommand ¶
AppendStatusCommand appends a SyncML command to the Status command list
func (*SyncML) GetMessageID ¶
func (*SyncML) GetOrderedCmds ¶
func (msg *SyncML) GetOrderedCmds() []ProtoCmdOperation
func (*SyncML) GetSessionID ¶
func (*SyncML) IsValidMsg ¶
IsValidMsg checks for required fields in the SyncML message
type SyncMLCmd ¶
type SyncMLCmd struct {
XMLName xml.Name `xml:",omitempty"`
CmdID string `xml:"CmdID"`
MsgRef *string `xml:"MsgRef,omitempty"`
CmdRef *string `xml:"CmdRef,omitempty"`
Cmd *string `xml:"Cmd,omitempty"`
Data *string `xml:"Data,omitempty"`
Items *[]CmdItem `xml:"Item,omitempty"`
}
Protocol Command
func NewSyncMLCmd ¶
func NewSyncMLCmd(cmdVerb string, cmdSource string, cmdTarget string, cmdDataType string, cmdDataFormat string, cmdDataValue string) *SyncMLCmd
NewSyncMLCmd creates a new SyncML command
func NewSyncMLCmdAlert ¶
NewSyncMLCmdAlert creates a new SyncML Alert command
func NewSyncMLCmdBool ¶
NewSyncMLCmdBool creates a new SyncML command with text data
func NewSyncMLCmdGet ¶
NewSyncMLCmdGet creates a new SyncML command with text data
func NewSyncMLCmdInt ¶
NewSyncMLCmdInt creates a new SyncML command with text data
func NewSyncMLCmdRawInt ¶
NewSyncMLCmdInt creates a new SyncML command with text data
func NewSyncMLCmdStatus ¶
NewSyncMLCmdStatus creates a new SyncML command with text data
func NewSyncMLCmdText ¶
NewSyncMLCmdText creates a new SyncML command with text data
func NewSyncMLCmdXml ¶
NewSyncMLCmdXml creates a new SyncML command with XML data
type SyncMLCmds ¶
type SyncMLCmds []*SyncMLCmd
type TemplateDeviceSetting ¶
type TemplateDeviceSetting struct {
DNSComputerName string
DeviceID string
HWDevID string
SMBIOS string
DeviceName string
WindowsEdition string
WindowsVersion string
OSLocale string
DeviceManufacturer string
DeviceModel string
Localtime string
FirmwareVersion string
HardwareVersion string
BIOSVersion string
AntivirusStatus string
AntivirusSignatureStatus string
HVCIStatus string
DeviceGuardStatus string
CredentialGuardStatus string
SystemGuardStatus string
EncryptionComplianceStatus string
SecureBootStatus string
FirewallStatus string
CDiskSize string
CDiskFreeSpace string
CDiskSystemType string
TotalRAM string
ControlFirewall string
AVExclusions string
AVRTMonitoring string
WDAG string
WindowsUpdates string
BackgroundImage string
StaticContentURL string
WindowsVBS string
}
type Timestamp ¶
type Timestamp struct {
ID string `xml:"u:Id,attr"`
Created string `xml:"u:Created"`
Expires string `xml:"u:Expires"`
}
Timestamp for certificate authentication
type To ¶
type To struct {
Content string `xml:",chardata"`
MustUnderstand string `xml:"mustUnderstand,attr"`
}
To target endpoint header field
type TokenSecurity ¶
type TokenSecurity struct {
MustUnderstand string `xml:"s:mustUnderstand,attr"`
Security BinSecurityToken `xml:"BinarySecurityToken"`
}
TokenSecurity is the security token container for BinSecurityToken
type UserAgentOrigin ¶
type UserAgentOrigin int
UserAgentOrigin represents the origin of the MDM session
const ( SesOriginUserTriggered UserAgentOrigin = 1 SesOriginServer UserAgentOrigin = 2 SesOriginWNS UserAgentOrigin = 3 SesOriginUserLogin UserAgentOrigin = 4 SesOriginPostEnrollment UserAgentOrigin = 5 SesOriginCSPTriggered UserAgentOrigin = 6 SesOriginPublicApi UserAgentOrigin = 7 )
type WSTEPManager ¶
type WSTEPManager struct {
IdentityCertificate *x509.Certificate
IdentityFingerprint *string
// contains filtered or unexported fields
}
func NewCertManager ¶
func NewCertManager(identityCert *x509.Certificate, identityKey *rsa.PrivateKey) (*WSTEPManager, error)
func (*WSTEPManager) GetIdentityCert ¶
func (c *WSTEPManager) GetIdentityCert() x509.Certificate
func (*WSTEPManager) GetIdentityFingerprint ¶
func (c *WSTEPManager) GetIdentityFingerprint() string
func (*WSTEPManager) SignClientCSR ¶
func (c *WSTEPManager) SignClientCSR(subject string, clientCSR *x509.CertificateRequest) ([]byte, string, error)
SignClientCSR returns a signed certificate from the client certificate signing request and the certificate fingerprint subject is the common name of the certificate clientCSR is the client certificate signing request
type WapProvisioningDoc ¶
type WapProvisioningDoc struct {
XMLName xml.Name `xml:"wap-provisioningdoc"`
Version string `xml:"version,attr"`
Characteristics []Characteristic `xml:"characteristic"`
}
func NewProvisioningDoc ¶
func NewProvisioningDoc(certStoreData Characteristic, applicationData Characteristic, dmClientData Characteristic) WapProvisioningDoc
NewProvisioningDoc returns a new ProvisioningDoc container
func (*WapProvisioningDoc) AddCharacteristic ¶
func (msg *WapProvisioningDoc) AddCharacteristic(c Characteristic)
Add Characteristic to the WapProvisioningDoc
func (WapProvisioningDoc) GetEncodedB64Representation ¶
func (msg WapProvisioningDoc) GetEncodedB64Representation() (string, error)
GetEncodedB64Representation returns encoded WapProvisioningDoc representation
type WebSocketCmd ¶
type WsSecurity ¶
type WsSecurity struct {
XMLNS string `xml:"xmlns:o,attr"`
MustUnderstand string `xml:"s:mustUnderstand,attr"`
Timestamp Timestamp `xml:"u:Timestamp"`
}
Security token container