Documentation
¶
Overview ¶
Package adclient interacts with AD domain controllers
Index ¶
- func AssignTemporaryPassword(s Client, args PasswordArgs) (*string, error)
- func GetADUserGroups(s Client, user *User) (*[]UserGroup, error)
- func IsAccountLocked(s Client, args UnlockArgs) (*bool, error)
- func UnlockAccount(s Client, args UnlockArgs) error
- type ADGroup
- type ADGroups
- type Client
- type Domain
- type GetADGroupArgs
- type GetADUserArgs
- type ListADUsersArgs
- type MockClient
- type PasswordArgs
- type PasswordPolicy
- type PowershellClient
- type Response
- type UnlockArgs
- type User
- type UserGroup
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignTemporaryPassword ¶
func AssignTemporaryPassword(s Client, args PasswordArgs) (*string, error)
AssignTemporaryPassword will reset a users password with a temporary password that will be required to reset on login. There is no native way to have AD generate and reset with a password. It must be supplied by the admin during reset time. We figure out what password policy applies to the user and make a password according to the policy. We always operate on the assumption that `ComplexityEnabled` is true. This means the password has to have at least 3 out of Uppercase, Lowercase, Number, Special Characters.
func GetADUserGroups ¶
GetADUserGroups returns AD user groups from the domain
func IsAccountLocked ¶
func IsAccountLocked(s Client, args UnlockArgs) (*bool, error)
IsAccountLocked will return a boolean indicating account lockout status
func UnlockAccount ¶
func UnlockAccount(s Client, args UnlockArgs) error
UnlockAccount will unlock a user account
Types ¶
type ADGroups ¶
type ADGroups []*ADGroup
ADGroups is a list of ADGroup
func GetADGroups ¶
func GetADGroups(s Client, args GetADGroupArgs) (*ADGroups, *string, error)
GetADGroups retrieves groups from AD.
type Domain ¶
type Domain struct {
Forest string `json:"Forest"`
NetBIOSName string `json:"NetBIOSName"`
DNSRoot string `json:"DNSRoot"`
Name string `json:"Name"`
}
Domain represents the domain response
func GetADDomain ¶
GetADDomain returns domain information
type GetADGroupArgs ¶
GetADGroupArgs is a struct of request args
type GetADUserArgs ¶
type GetADUserArgs struct {
Identity string
}
GetADUserArgs is an requests args to user functions
type ListADUsersArgs ¶
ListADUsersArgs is request args to user functions
type MockClient ¶
MockClient is used for test cases. You can define the response for a query to powershell here.
type PasswordArgs ¶
type PasswordArgs struct {
UserImmutableID string
}
PasswordArgs is the args to password functions
type PasswordPolicy ¶
type PasswordPolicy struct {
MinPasswordLength *int `json:"MinPasswordLength,omitempty"`
}
PasswordPolicy is the representation of the policy in the system
func GetPasswordPolicy ¶
func GetPasswordPolicy(s Client, immutableID string) (*PasswordPolicy, error)
GetPasswordPolicy gets a password policy that applies to the given user. It checks if the user is a member of any password policy groups and returns the one with the lowest precedence. If there are no groups the user is a member one then the default password policy is retrieved.
type PowershellClient ¶
type PowershellClient struct {
// contains filtered or unexported fields
}
PowershellClient is used for invoking commands in an underlying powershell process.
func (*PowershellClient) Close ¶
func (s *PowershellClient) Close() error
Close terminates the connection
type UnlockArgs ¶
type UnlockArgs struct {
UserImmutableID string
}
UnlockArgs is request arguments to unlock functions
type User ¶
type User struct {
SamAccountName string `json:"SamAccountName"`
DistinguishedName string `json:"DistinguishedName"`
Name string `json:"Name"`
EmailAddress string `json:"EmailAddress"`
EmployeeID interface{} `json:"EmployeeID"`
ObjectGUID string `json:"ObjectGUID"`
MemberOf []string `json:"MemberOf"`
LockedOut bool `json:"LockedOut"`
WhenChanged string `json:"whenChanged"`
}
User is info from AD on a certain user
type Users ¶
type Users []*User
Users is a list os User
func GetADUser ¶
func GetADUser(s Client, args GetADUserArgs) (*Users, error)
GetADUser retrieved user information form AD
func ListADUsers ¶
func ListADUsers(s Client, args ListADUsersArgs) (*Users, *string, error)
ListADUsers lists ad users according to specified args