Documentation ¶
Overview ¶
package authorization implements win32 authorization functions that don't seem to exist in other libraries see https://msdn.microsoft.com/en-us/library/windows/desktop/aa375742(v=vs.85).aspx
Index ¶
- func AddAccessRule(handle syscall.Handle, objectType ObjectType, replace, inherit bool, ...) error
- func GetLogonSid(token syscall.Token) (*syscall.SID, error)
- func GetSecurityInfo(handle syscall.Handle, objectType ObjectType, ...) error
- func IsValidSid(sid *syscall.SID) error
- func SetEntriesInAcl(entries []ExplicitAccess, oldAcl *ACL, newAcl **ACL) error
- func SetSecurityInfo(handle syscall.Handle, objectType ObjectType, ...) error
- func SetTokenInformation(tokenHandle syscall.Token, tokenInformationClass uint32, ...) error
- func SetTokenSessionId(token syscall.Token, sessionID uint32) error
- type ACL
- type AccessMode
- type ExplicitAccess
- type InheritanceMode
- type MultipleTrusteeOperation
- type ObjectType
- type SecurityDescriptor
- type SecurityInformation
- type TokenGroups
- type Trustee
- type TrusteeForm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAccessRule ¶
func AddAccessRule(handle syscall.Handle, objectType ObjectType, replace, inherit bool, entries ...ExplicitAccess) error
AddAccessRule modifies the access list for the given object This function and some struct/const above borrowed with thanks from https://github.com/hectane/go-acl
func GetSecurityInfo ¶
func GetSecurityInfo(handle syscall.Handle, objectType ObjectType, securityInformation SecurityInformation, sidOwner **syscall.SID, sidGroup **syscall.SID, dacl **ACL, sacl **ACL, securityDescriptor **SecurityDescriptor) error
GetSecurityInfo - see https://msdn.microsoft.com/en-us/library/windows/desktop/aa446654(v=vs.85).aspx
func IsValidSid ¶
func SetEntriesInAcl ¶
func SetEntriesInAcl(entries []ExplicitAccess, oldAcl *ACL, newAcl **ACL) error
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379576(v=vs.85).aspx
func SetSecurityInfo ¶
func SetSecurityInfo(handle syscall.Handle, objectType ObjectType, securityInformation SecurityInformation, sidOwner **syscall.SID, sidGroup **syscall.SID, dacl *ACL, sacl *ACL) error
SetSecurityInfo - see https://msdn.microsoft.com/en-us/library/windows/desktop/aa379588(v=vs.85).aspx
Types ¶
type ACL ¶
ACL is defined at https://msdn.microsoft.com/en-us/library/windows/desktop/aa374931(v=vs.85).aspx
type AccessMode ¶
type AccessMode uint32
const ( NotUsedAccess AccessMode = iota GrantAccess SetAccess DenyAccess RevokeAccess SetAuditSuccess SetAuditFailure )
https://msdn.microsoft.com/en-us/library/windows/desktop/aa374899.aspx
type ExplicitAccess ¶
type ExplicitAccess struct { AccessPermissions uint32 AccessMode AccessMode Inheritance InheritanceMode Trustee Trustee }
https://msdn.microsoft.com/en-us/library/windows/desktop/aa446627(v=vs.85).aspx
func GrantSid ¶
func GrantSid(accessPermissions uint32, inheritance InheritanceMode, sid *syscall.SID) ExplicitAccess
Create an ExplicitAccess instance granting permissions to the provided SID
type InheritanceMode ¶
type InheritanceMode uint32
const ( NoInheritance InheritanceMode = 0x0 SubObjectsOnlyInherit InheritanceMode = 0x1 SubContainersOnlyInherit InheritanceMode = 0x2 SubContainersAndObjectsInherit InheritanceMode = 0x3 InheritNoPropagate InheritanceMode = 0x4 InheritOnly InheritanceMode = 0x8 ObjectInheritAce InheritanceMode = 0x1 ContainerInheritAce InheritanceMode = 0x2 NoPropagateInheritAce InheritanceMode = 0x4 InheritOnlyAce InheritanceMode = 0x8 )
https://msdn.microsoft.com/en-us/library/windows/desktop/aa446627.aspx https://msdn.microsoft.com/en-us/library/aa392711(v=vs.85).aspx
type MultipleTrusteeOperation ¶
type MultipleTrusteeOperation uint32
const ( NoMultipleTrustee MultipleTrusteeOperation = iota TrusteeIsImpersonate )
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379284.aspx
type ObjectType ¶
type ObjectType uint32
ObjectType is win32 SE_OBJECT_TYPE - see https://msdn.microsoft.com/en-us/library/windows/desktop/aa379593(v=vs.85).aspx
const ( UnknownObjectType ObjectType = iota FileObject Service Printer RegistryKey KernelObject WindowObject DSObject DSObjectAll ProviderDefinedObject WmiGuidObject RegistryWow64_32Key )
type SecurityDescriptor ¶
type SecurityDescriptor struct{}
SecurityDescriptor is win32 SECURITY_DESCRIPTOR - see https://msdn.microsoft.com/en-us/library/windows/desktop/aa379561(v=vs.85).aspx
type SecurityInformation ¶
type SecurityInformation uint32
SecurityInformation is win32 SECURITY_INFORMATION - https://msdn.microsoft.com/en-us/library/windows/desktop/aa379573(v=vs.85).aspx see also https://msdn.microsoft.com/en-us/library/windows/desktop/aa379573(v=vs.85).aspx
const ( OwnerSecurityInformation SecurityInformation = 0x00000001 GroupSecurityInformation SecurityInformation = 0x00000002 DaclSecurityInformation SecurityInformation = 0x00000004 SaclSecurityInformation SecurityInformation = 0x00000008 LabelSecurityInformation SecurityInformation = 0x00000010 AttributeSecurityInformation SecurityInformation = 0x00000020 ScopeSecurityInformation SecurityInformation = 0x00000040 ProcessTrustLabelSecurityInformation SecurityInformation = 0x00000080 BackupSecurityInformation SecurityInformation = 0x00010000 ProtectedDaclSecurityInformation SecurityInformation = 0x80000000 ProtectedSaclSecurityInformation SecurityInformation = 0x40000000 UnprotectedDaclSecurityInformation SecurityInformation = 0x20000000 UnprotectedSaclSecurityInformation SecurityInformation = 0x10000000 )
type TokenGroups ¶
type TokenGroups []syscall.SIDAndAttributes
func GetTokenGroups ¶
func GetTokenGroups(token syscall.Token) (TokenGroups, error)
GetTokenGroups invokes GetTokenInformation, requesting TOKEN_GROUPS https://msdn.microsoft.com/en-us/library/windows/desktop/aa379624(v=vs.85).aspx
type Trustee ¶
type Trustee struct { MultipleTrustee *Trustee MultipleTrusteeOperation MultipleTrusteeOperation TrusteeForm TrusteeForm TrusteeType int32 Name *uint16 }
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379636(v=vs.85).aspx
type TrusteeForm ¶
type TrusteeForm uint32
const ( TrusteeIsSid TrusteeForm = iota TrusteeIsName TrusteeBadForm TrusteeIsObjectsAndSid TrusteeIsObjectsAndName )
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379638.aspx