active_directory

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneralizedTimeToTime

func GeneralizedTimeToTime(val string) (time.Time, error)

func Integer8ToTime

func Integer8ToTime(val int64) time.Time

Types

type Ad struct {
	Name                 string    `ldap:"name"`
	DistinguishedName    string    `ldap:"distinguishedName"`
	DnsName              string    `ldap:"dNSHostName"`
	Created              time.Time `ldap:"whenCreated"`
	LastLogon            time.Time `ldap:"lastLogon"`
	LastPassword         time.Time `ldap:"pwdLastSet"`
	Description          []string  `ldap:"description"`
	Location             string    `ldap:"location"`
	ManagedBy            string    `ldap:"managedBy"`   // This is returned by the computer object and used to query the related user
	ManagedByCn          string    `ldap:"cn"`          // This is obtained by a second query for the managedBy user
	ManagedByGid         string    `ldap:"siemens-gid"` // This is obtained by a second query for the managedBy user
	ManagedByDepartment  string    `ldap:"department"`  // This is obtained by a second query for the managedBy user
	Os                   string    `ldap:"operatingSystem"`
	OsVersion            string    `ldap:"operatingSystemVersion"`
	ServicePrincipalName []string  `ldap:"servicePrincipalName"`
	CriticalObject       bool      `ldap:"isCriticalSystemObject"`
}

func AdodbQuery

func AdodbQuery(logger utils.Logger, searchCn string, searchDomain string) *Ad

AdodbQuery queries the given Active Directory service with implicit Windows authentication and returns a pointer to a populated Ad struct. ATTENTION: Make sure searchCn / ldapAddress are sanitized if taken from user input, to avoid SQL injection attacks!

func LdapQuery

func LdapQuery(
	logger utils.Logger,
	searchCn string,
	ldapAddress string,
	ldapPort int,
	ldapUser string,
	ldapPassword string,
	dialTimeout time.Duration,
) *Ad

LdapQuery queries the given Active Directory service with explicit authentication and returns a pointer to a populated Ad struct. ATTENTION: Make sure searchCn / ldapAddress are sanitized if taken from user input, to avoid SQL injection attacks!

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL