diff --git a/lib/srv/desktop/discovery.go b/lib/srv/desktop/discovery.go index 03d1b45c114b2..663b4e74347fa 100644 --- a/lib/srv/desktop/discovery.go +++ b/lib/srv/desktop/discovery.go @@ -45,6 +45,10 @@ const ( // attrName is the name of an LDAP object. attrName = "name" + // description is a description of an LDAP object. + attrDescription = "description" + attrDescriptionMaxLength = 1024 // https://learn.microsoft.com/en-us/windows/win32/adschema/a-description + // attrCommonName is the common name of an LDAP object, or "CN". attrCommonName = "cn" @@ -366,6 +370,10 @@ func (s *WindowsService) ldapEntryToWindowsDesktop( // purge them if they stop being detected, and discovery of large Windows fleets can // take a long time. desktop.SetExpiry(s.cfg.Clock.Now().UTC().Add(apidefaults.ServerAnnounceTTL * 3)) + + description := entry.GetAttributeValue(attrDescription) + desktop.Metadata.Description = description[:min(len(description), attrDescriptionMaxLength)] + return desktop, nil } diff --git a/lib/srv/desktop/windows_server.go b/lib/srv/desktop/windows_server.go index e36bc85a79707..0ee0de0f77d7f 100644 --- a/lib/srv/desktop/windows_server.go +++ b/lib/srv/desktop/windows_server.go @@ -108,6 +108,7 @@ const ( // see: https://docs.microsoft.com/en-us/windows/win32/adschema/c-computer#windows-server-2012-attributes var computerAttributes = []string{ attrName, + attrDescription, attrCommonName, attrDistinguishedName, attrDNSHostName,