Documentation
¶
Index ¶
- Constants
- func BuildAddComputerRequest(parentDN, computerName, domainName, computerPass string, ldapPort int) (string, error)
- func BuildAddContainerRequest(parentDN, cn string, ldapPort int) (string, error)
- func BuildAddCustomRequest(parentDN, rdn string, attrs []IMDAAttributeSpec, ldapPort int) (string, error)
- func BuildAddGroupRequest(parentDN, groupName string, groupType string, ldapPort int) (string, error)
- func BuildAddOURequest(parentDN, ouName string, ldapPort int) (string, error)
- func BuildAddUserRequest(parentDN, userName, domainName, userPass string, enabled bool, ldapPort int) (string, error)
- func BuildChangeOptionalFeatureRequest(distinguishedName string, enable bool, featureID string, ldapPort int) (string, error)
- func BuildChangePasswordRequest(accountDN, partitionDN, oldPassword, newPassword string, ldapPort int) (string, error)
- func BuildCreateComputerRequest(parentDN, computerName string, ldapPort int) (string, error)
- func BuildCreateRequest(instanceXML string, ldapPort int) string
- func BuildDeleteRequest(dn string, ldapPort int) string
- func BuildEnumerateRequest(baseDN, filter string, attrs []string, scope int, ldapPort int) string
- func BuildGetADDomainControllerRequest(ntdsSettingsDNs []string, ldapPort int) (string, error)
- func BuildGetADDomainRequest(ldapPort int) (string, error)
- func BuildGetADForestRequest(ldapPort int) (string, error)
- func BuildGetADGroupMemberRequest(groupDN, partitionDN string, recursive bool, ldapPort int) (string, error)
- func BuildGetADPrincipalAuthorizationGroupRequest(partitionDN, principalDN string, ldapPort int) (string, error)
- func BuildGetADPrincipalGroupMembershipRequest(...) (string, error)
- func BuildGetRequest(dn string, attrs []string, ldapPort int) string
- func BuildGetStatusRequest(enumerationContext string, ldapPort int) string
- func BuildGetVersionRequest(ldapPort int) (string, error)
- func BuildMexGetRequest() string
- func BuildModifyRequest(operation, attr string, values []string, xsiType string) (string, error)
- func BuildPullRequest(enumerationContext string, maxElements int, ldapPort int, sdFlags int) string
- func BuildPutRequest(dn, instanceXML string, ldapPort int) string
- func BuildReleaseRequest(enumerationContext string, ldapPort int) string
- func BuildRenewRequest(enumerationContext, expires string, ldapPort int) string
- func BuildSetPasswordRequest(accountDN, partitionDN, newPassword string, ldapPort int) (string, error)
- func BuildTranslateNameRequest(formatOffered, formatDesired string, names []string, ldapPort int) (string, error)
- func ParseChangeOptionalFeatureResponse(soapXML string) error
- func ParseFaultIfPresent(soapXML string) error
- func ParseReleaseResponse(soapXML string) error
- func ParseWSTransferCreateAddress(soapXML string) (string, error)
- func PrettyXML(input string) string
- func ScopeToString(scope int) string
- type ADCAPActiveDirectoryDomain
- type ADCAPActiveDirectoryDomainController
- type ADCAPActiveDirectoryForest
- type ADCAPActiveDirectoryGroup
- type ADCAPActiveDirectoryObject
- type ADCAPActiveDirectoryPartition
- type ADCAPActiveDirectoryPrincipal
- type ADCAPVersionInfo
- type ADWSItem
- type ADWSValue
- type BaseObjectSearchResponseXML
- type Body
- type CreateResponseXML
- type EnumerateResponse
- type EnumerateResponseXML
- type Envelope
- type Fault
- type FaultCode
- type FaultDetail
- type FaultReason
- type FaultSubcode
- type FieldValue
- type GetStatusResponse
- type GetStatusResponseXML
- type Header
- type IMDAAttributeSpec
- type Items
- type NameTranslateResult
- type ObjectEntry
- type ObjectField
- type ObjectReferencePropertyXML
- type PartialAttributeXML
- type PullResponse
- type PullResponseXML
- type RenewResponse
- type RenewResponseXML
- type ResourceCreatedXML
Constants ¶
const ( NsSOAP = "http://www.w3.org/2003/05/soap-envelope" NsWSAddr = "http://www.w3.org/2005/08/addressing" NsADData = "http://schemas.microsoft.com/2008/1/ActiveDirectory/Data" NsAD = "http://schemas.microsoft.com/2008/1/ActiveDirectory" NsWSEnum = "http://schemas.xmlsoap.org/ws/2004/09/enumeration" NsWSTransfer = "http://schemas.xmlsoap.org/ws/2004/09/transfer" NsCustomActions = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions" )
const ( ActionEnumerate = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate" ActionEnumerateResp = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse" ActionPull = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull" ActionPullResp = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/PullResponse" ActionGetStatus = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/GetStatus" ActionGetStatusResp = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/GetStatusResponse" ActionRenew = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Renew" ActionRenewResp = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/RenewResponse" ActionRelease = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/Release" ActionReleaseResp = "http://schemas.xmlsoap.org/ws/2004/09/enumeration/ReleaseResponse" ActionPut = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Put" ActionPutResp = "http://schemas.xmlsoap.org/ws/2004/09/transfer/PutResponse" ActionDelete = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete" ActionDeleteResp = "http://schemas.xmlsoap.org/ws/2004/09/transfer/DeleteResponse" ActionCreate = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create" ActionCreateResp = "http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse" ActionGet = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get" ActionGetResp = "http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse" ActionChangeOptionalFeature = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/ChangeOptionalFeature" ActionChangeOptionalFeatureResponse = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/ChangeOptionalFeatureResponse" ActionGetADDomain = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/GetADDomain" ActionGetADDomainResponse = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/GetADDomainResponse" ActionGetADDomainController = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/GetADDomainController" ActionGetADDomainControllerResponse = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/GetADDomainControllerResponse" ActionGetADForest = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/GetADForest" ActionGetADForestResponse = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/GetADForestResponse" ActionGetVersion = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/GetVersion" ActionGetVersionResponse = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/TopologyManagement/GetVersionResponse" ActionChangePassword = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/ChangePassword" ActionGetADGroupMember = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/GetADGroupMember" ActionGetADGroupMemberResponse = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/GetADGroupMemberResponse" ActionGetADPrincipalAuthorizationGroup = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/GetADPrincipalAuthorizationGroup" ActionGetADPrincipalAuthorizationGroupResponse = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/GetADPrincipalAuthorizationGroupResponse" ActionGetADPrincipalGroupMembership = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/GetADPrincipalGroupMembership" ActionGetADPrincipalGroupMembershipResponse = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/GetADPrincipalGroupMembershipResponse" ActionSetPassword = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/SetPassword" ActionTranslateName = "http://schemas.microsoft.com/2008/1/ActiveDirectory/CustomActions/AccountManagement/TranslateName" )
const ( ResourceInstance = "http://schemas.microsoft.com/2008/1/ActiveDirectory/Data/Instance" AddressAnonymous = "http://www.w3.org/2005/08/addressing/anonymous" DialectXPathLevel1 = "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/XPath-Level-1" DialectLdapQuery = "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/LdapQuery" )
Variables ¶
This section is empty.
Functions ¶
func BuildAddComputerRequest ¶
func BuildAddComputerRequest(parentDN, computerName, domainName, computerPass string, ldapPort int) (string, error)
BuildAddComputerRequest builds a WS-Transfer Create (IMDA AddRequest) that creates a computer account under parentDN, mirroring SharpADWS' AddComputer method.
Required inputs:
- parentDN: container DN (SharpADWS uses CN=Computers,<defaultNamingContext>)
- computerName: may include or omit trailing '$'
- domainName: used to build dNSHostName and SPN
- computerPass: will be encoded as unicodePwd (UTF-16LE with quotes)
func BuildAddCustomRequest ¶
func BuildAddCustomRequest(parentDN, rdn string, attrs []IMDAAttributeSpec, ldapPort int) (string, error)
BuildAddCustomRequest builds a WS-Transfer Create (IMDA AddRequest) against the ResourceFactory endpoint with user-provided attributes.
parentDN is the container DN; rdn is the relative distinguished name (e.g. "CN=Foo"). ldapPort controls the ad:instance header (389=DC, 3268=GC).
func BuildAddGroupRequest ¶
func BuildAddGroupRequest(parentDN, groupName string, groupType string, ldapPort int) (string, error)
BuildAddGroupRequest builds a WS-Transfer Create (IMDA AddRequest) that creates a group under parentDN.
groupType defaults to global security group if empty.
func BuildAddOURequest ¶
func BuildAddUserRequest ¶
func BuildAddUserRequest(parentDN, userName, domainName, userPass string, enabled bool, ldapPort int) (string, error)
BuildAddUserRequest builds a WS-Transfer Create (IMDA AddRequest) that creates a user account under parentDN.
Notes:
- If userPass is empty, the user is created disabled (userAccountControl=514).
- If userPass is set, unicodePwd is set; if enabled is true, userAccountControl=512 else 514.
func BuildCreateRequest ¶
func BuildDeleteRequest ¶
func BuildEnumerateRequest ¶
func BuildGetADDomainRequest ¶
func BuildGetADForestRequest ¶
func BuildGetStatusRequest ¶
func BuildGetVersionRequest ¶
func BuildMexGetRequest ¶
func BuildMexGetRequest() string
BuildMexGetRequest builds a WS-MetadataExchange GetMetadata request. It uses a WS-Transfer Get directed at the MEX endpoint. The To header contains ResourceInstance as a placeholder which callers normalize to the actual endpoint URL (e.g. via NormalizeSOAPAddressing in the wsenum package).
func BuildModifyRequest ¶
BuildModifyRequest builds an IMDA ModifyRequest XML payload suitable to be used as the body for WS-Transfer Put.
operation must be one of: add, replace, delete. attr may be either a full type (e.g. "addata:description") or a local attribute name (e.g. "description"). If attr has no prefix, it is treated as an AD data attribute and is converted to "addata:<name>".
xsiType controls the ad:value xsi:type used (defaults to xsd:string).
func BuildPullRequest ¶
func BuildPutRequest ¶
func BuildReleaseRequest ¶
func BuildRenewRequest ¶
func BuildSetPasswordRequest ¶
func ParseFaultIfPresent ¶
func ParseReleaseResponse ¶
func ParseWSTransferCreateAddress ¶
ParseWSTransferCreateAddress extracts the created resource address/object reference from a WS-Transfer CreateResponse.
ADWS may surface the created resource as either:
- <wst:ResourceCreated><wsa:Address>...</wsa:Address></wst:ResourceCreated>
- or an AD-specific <ad:objectReferenceProperty>...</ad:objectReferenceProperty>
This function is best-effort: it returns the first matching value found.
func PrettyXML ¶
PrettyXML attempts to pretty-print an XML document. If formatting fails, it returns the original input.
func ScopeToString ¶
Types ¶
type ADCAPActiveDirectoryDomain ¶
type ADCAPActiveDirectoryDomain struct {
ADCAPActiveDirectoryPartition
AllowedDNSSuffixes []string `xml:"AllowedDNSSuffixes>string"`
AppliedGroupPolicies []string `xml:"AppliedGroupPolicies>string"`
ChildDomains []string `xml:"ChildDomains>string"`
ComputersContainer string `xml:"ComputersContainer"`
DomainControllersContainer string `xml:"DomainControllersContainer"`
DomainMode int `xml:"DomainMode"`
DomainSID string `xml:"DomainSID"`
ForeignSecurityPrincipalsContainer string `xml:"ForeignSecurityPrincipalsContainer"`
Forest string `xml:"Forest"`
InfrastructureMaster string `xml:"InfrastructureMaster"`
LastLogonReplicationInterval string `xml:"LastLogonReplicationInterval"`
ManagedBy string `xml:"ManagedBy"`
NetBIOSName string `xml:"NetBIOSName"`
PDCEmulator string `xml:"PDCEmulator"`
ParentDomain string `xml:"ParentDomain"`
RIDMaster string `xml:"RIDMaster"`
SystemsContainer string `xml:"SystemsContainer"`
UsersContainer string `xml:"UsersContainer"`
}
ADCAPActiveDirectoryDomain is the decoded subset of MS-ADCAP ActiveDirectoryDomain.
func ParseGetADDomainResponse ¶
func ParseGetADDomainResponse(soapXML string) (*ADCAPActiveDirectoryDomain, error)
type ADCAPActiveDirectoryDomainController ¶
type ADCAPActiveDirectoryDomainController struct {
DefaultPartition string `xml:"DefaultPartition"`
HostName string `xml:"HostName"`
InvocationId string `xml:"InvocationId"`
LdapPort int `xml:"LdapPort"`
NTDSSettingsObjectDN string `xml:"NTDSSettingsObjectDN"`
Name string `xml:"Name"`
Partitions []string `xml:"Partitions>string"`
ServerObjectDN string `xml:"ServerObjectDN"`
ServerObjectGuid string `xml:"ServerObjectGuid"`
Site string `xml:"Site"`
SslPort int `xml:"SslPort"`
}
func ParseGetADDomainControllerResponse ¶
func ParseGetADDomainControllerResponse(soapXML string) ([]ADCAPActiveDirectoryDomainController, error)
type ADCAPActiveDirectoryForest ¶
type ADCAPActiveDirectoryForest struct {
ApplicationPartitions []string `xml:"ApplicationPartitions>string"`
CrossForestReferences []string `xml:"CrossForestReferences>string"`
DomainNamingMaster string `xml:"DomainNamingMaster"`
Domains []string `xml:"Domains>string"`
ForestMode int `xml:"ForestMode"`
GlobalCatalogs []string `xml:"GlobalCatalogs>string"`
Name string `xml:"Name"`
RootDomain string `xml:"RootDomain"`
SPNSuffixes []string `xml:"SPNSuffixes>string"`
SchemaMaster string `xml:"SchemaMaster"`
Sites []string `xml:"Sites>string"`
UPNSuffixes []string `xml:"UPNSuffixes>string"`
}
ADCAPActiveDirectoryForest is the decoded subset of MS-ADCAP ActiveDirectoryForest.
func ParseGetADForestResponse ¶
func ParseGetADForestResponse(soapXML string) (*ADCAPActiveDirectoryForest, error)
type ADCAPActiveDirectoryGroup ¶
type ADCAPActiveDirectoryGroup struct {
ADCAPActiveDirectoryPrincipal
GroupScope string `xml:"GroupScope"`
GroupType string `xml:"GroupType"`
}
ADCAPActiveDirectoryGroup is the decoded subset of MS-ADCAP ActiveDirectoryGroup.
func ParseGetADPrincipalAuthorizationGroupResponse ¶
func ParseGetADPrincipalAuthorizationGroupResponse(soapXML string) ([]ADCAPActiveDirectoryGroup, error)
func ParseGetADPrincipalGroupMembershipResponse ¶
func ParseGetADPrincipalGroupMembershipResponse(soapXML string) ([]ADCAPActiveDirectoryGroup, error)
type ADCAPActiveDirectoryObject ¶
type ADCAPActiveDirectoryObject struct {
DistinguishedName string `xml:"DistinguishedName"`
Name string `xml:"Name"`
ObjectClass string `xml:"ObjectClass"`
ObjectGuid string `xml:"ObjectGuid"`
ObjectTypes []string `xml:"ObjectTypes>string"`
ReferenceServer string `xml:"ReferenceServer"`
}
ADCAPActiveDirectoryObject is the decoded subset of MS-ADCAP ActiveDirectoryObject. It is used by multiple MS-ADCAP operations that return principals/groups.
type ADCAPActiveDirectoryPartition ¶
type ADCAPActiveDirectoryPartition struct {
ADCAPActiveDirectoryObject
DNSRoot string `xml:"DNSRoot"`
DeletedObjectsContainer string `xml:"DeletedObjectsContainer"`
LostAndFoundContainer string `xml:"LostAndFoundContainer"`
QuotasContainer string `xml:"QuotasContainer"`
ReadOnlyReplicaDirectoryServer []string `xml:"ReadOnlyReplicaDirectoryServer>string"`
ReplicaDirectoryServer []string `xml:"ReplicaDirectoryServer>string"`
SubordinateReferences []string `xml:"SubordinateReferences>string"`
}
ADCAPActiveDirectoryPartition is the decoded subset of MS-ADCAP ActiveDirectoryPartition.
type ADCAPActiveDirectoryPrincipal ¶
type ADCAPActiveDirectoryPrincipal struct {
ADCAPActiveDirectoryObject
SID string `xml:"SID"`
SamAccountName string `xml:"SamAccountName"`
}
ADCAPActiveDirectoryPrincipal is the decoded subset of MS-ADCAP ActiveDirectoryPrincipal.
func ParseGetADGroupMemberResponse ¶
func ParseGetADGroupMemberResponse(soapXML string) ([]ADCAPActiveDirectoryPrincipal, error)
type ADCAPVersionInfo ¶
ADCAPVersionInfo is the parsed result of MS-ADCAP GetVersion.
func ParseGetVersionResponse ¶
func ParseGetVersionResponse(soapXML string) (*ADCAPVersionInfo, error)
type ADWSItem ¶
type ADWSItem struct {
ObjectGUID string
DistinguishedName string
Attributes map[string][]ADWSValue
}
func ParseBaseObjectSearchResponse ¶
ParseBaseObjectSearchResponse parses a WS-Transfer Get response as returned by the ADWS Windows/Resource endpoint.
The response body is typically:
<da:BaseObjectSearchResponse>
<da:PartialAttribute>
<addata:cn LdapSyntax="UnicodeString"><ad:value ...>...</ad:value></addata:cn>
</da:PartialAttribute>
...
</da:BaseObjectSearchResponse>
type BaseObjectSearchResponseXML ¶
type BaseObjectSearchResponseXML struct {
PartialAttributes []PartialAttributeXML `xml:"PartialAttribute"`
}
type Body ¶
type Body struct {
EnumerateResponse *EnumerateResponseXML `xml:"EnumerateResponse,omitempty"`
PullResponse *PullResponseXML `xml:"PullResponse,omitempty"`
GetStatusResponse *GetStatusResponseXML `xml:"GetStatusResponse,omitempty"`
RenewResponse *RenewResponseXML `xml:"RenewResponse,omitempty"`
CreateResponse *CreateResponseXML `xml:"CreateResponse,omitempty"`
BaseObjectSearchResponse *BaseObjectSearchResponseXML `xml:"BaseObjectSearchResponse,omitempty"`
Fault *Fault `xml:"Fault,omitempty"`
}
type CreateResponseXML ¶
type CreateResponseXML struct {
ResourceCreated *ResourceCreatedXML `xml:"ResourceCreated"`
ObjectReferenceProperty *ObjectReferencePropertyXML `xml:"objectReferenceProperty"`
}
type EnumerateResponse ¶
func ParseEnumerateResponse ¶
func ParseEnumerateResponse(soapXML string) (*EnumerateResponse, error)
type EnumerateResponseXML ¶
type Fault ¶
type Fault struct {
Code FaultCode `xml:"Code"`
Reason FaultReason `xml:"Reason"`
Detail *FaultDetail `xml:"Detail,omitempty"`
}
type FaultCode ¶
type FaultCode struct {
Value string `xml:"Value"`
Subcode *FaultSubcode `xml:"Subcode,omitempty"`
}
type FaultDetail ¶
type FaultDetail struct {
Inner string `xml:",innerxml"`
}
FaultDetail holds the raw inner XML of a SOAP Fault/Detail element so that structured sub-elements (e.g. DirectoryError) can be extracted.
type FaultReason ¶
type FaultReason struct {
Text string `xml:"Text"`
}
type FaultSubcode ¶
type FaultSubcode struct {
Value string `xml:"Value"`
}
type FieldValue ¶
type FieldValue struct {
Content string `xml:",chardata"`
}
type GetStatusResponse ¶
type GetStatusResponse struct {
Expires string
}
func ParseGetStatusResponse ¶
func ParseGetStatusResponse(soapXML string) (*GetStatusResponse, error)
type GetStatusResponseXML ¶
type GetStatusResponseXML struct {
Expires string `xml:"Expires"`
}
type IMDAAttributeSpec ¶
IMDAAttributeSpec represents a single attribute for an IMDA AddRequest. Values may contain 1+ entries for multi-valued attributes.
type Items ¶
type Items struct {
Objects []ObjectEntry `xml:",any"`
}
type NameTranslateResult ¶
NameTranslateResult represents the output element for MS-ADCAP TranslateName. Result==0 indicates success; non-zero values correspond to DRS name crack results.
func ParseTranslateNameResponse ¶
func ParseTranslateNameResponse(soapXML string) ([]NameTranslateResult, error)
type ObjectEntry ¶
type ObjectEntry struct {
XMLName xml.Name `xml:""`
Fields []ObjectField `xml:",any"`
}
type ObjectField ¶
type ObjectField struct {
XMLName xml.Name `xml:""`
LdapSyntax string `xml:"LdapSyntax,attr"`
Values []FieldValue `xml:"value"`
}
type ObjectReferencePropertyXML ¶
type ObjectReferencePropertyXML struct {
Values []FieldValue `xml:"value"`
Content string `xml:",chardata"`
}
type PartialAttributeXML ¶
type PartialAttributeXML struct {
Fields []ObjectField `xml:",any"`
}
type PullResponse ¶
func ParsePullResponse ¶
func ParsePullResponse(soapXML string) (*PullResponse, error)
type PullResponseXML ¶
type RenewResponse ¶
type RenewResponse struct {
Expires string
}
func ParseRenewResponse ¶
func ParseRenewResponse(soapXML string) (*RenewResponse, error)
type RenewResponseXML ¶
type RenewResponseXML struct {
Expires string `xml:"Expires"`
}
type ResourceCreatedXML ¶
type ResourceCreatedXML struct {
Address string `xml:"Address"`
}