LDAP Inventory Breaking UMC

Hello!

I was working on trying to make a utility to leverage Univention’s LDAP backend for DNS, and noticed that there was also a LDAP object for computers and Inventory. Can someone help me understand why when I update the inventory information I get an error in the UMC? The code is here and the error is about the object type being computers/linux


	req.Replace("univentionObjectType", []string{fmt.Sprintf("computers/%s", runtime.GOOS)})

Hey,

while the LDAP is the low-level backend the Univention Directory Manager (UDM) offers the object model for computers and such and should be used to administrate instead of writing to the LDAP itself.
In your case this could be done via CLI (univention-directory-manager or udm) or via the Python API: univention.udm.modules package — Univention Corporate Server Python API 5.0 documentation

As you have not provided what error you get I can only assume that there is something wrong or missing in your request.

Best regards
Jan-Luca

It was my understanding that UDM only runs on Univention hosts, and not actual Domain workstations. If there is a way to access UDM from Arch/Debian/Windows/macOS I’d gladly use that instead, since I have the collection code already in Go, I could just rewrite the ldap query to query UDM.

I thought I had included the error in my original post, but here’s the expanded message. The steps taken are opening the computer in the UMC, expecting to see the updated info (note this only happens for some computers, others seem uneffected even after I run the inventory updater multiple times)

Please take a second to provide the following information:

1) steps to reproduce the failure
2) expected result
3) actual result

----------
UCS Version: 5.0-1 errata317

Internal server error during "udm/get (computers/computer)".
univention.management.console.modules.udm.udm_ldap.UDM_Error: The object type of this object differs from the specified object type. cn=Skellington,cn=computers,dc=nightmare,dc=haus is not recognized as computers/linux.
    raise univention.admin.uexceptions.wrongObjectType('%s is not recognized as %s.' % (self.dn, self.module))
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 223, in __init__
    simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes)
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 1889, in __init__
    univention.admin.handlers.simpleComputer.__init__(self, co, lo, position, dn, superordinate, attributes)
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/computers/__base.py", line 68, in __init__
    obj = self.module.object(None, ldap_connection, None, ldap_dn, superordinate, attributes=attributes)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/udm/udm_ldap.py", line 718, in get
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise
    six.reraise(self.__class__, self, self.exc_info[2])
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/udm/udm_ldap.py", line 365, in reraise
    UDM_Error(exc).reraise()
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/udm/udm_ldap.py", line 730, in get
    obj = module.get(ldap_dn)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/udm/__init__.py", line 521, in _get
    return self._function(*tmp, **self._kwargs)
  File "/usr/lib/python3/dist-packages/notifier/__init__.py", line 105, in __call__
    result = self._function()
  File "/usr/lib/python3/dist-packages/notifier/threads.py", line 80, in _run
Traceback (most recent call last):

Request: udm/get (computers/computer)
Internal server error during "udm/get (computers/computer)".

You are right, I misread this - UDM is something bundled with UCS installations, but there are several ways to query UDM from a remote machine:

  1. You could write a shell or Python script at the host and call it via RPC or SSH
  2. You could use Ansible: https://help.univention.com/t/best-practice-using-ansible-ucs-collections/19108
  3. But as you are already using Go the evident solution would be to use the UDM REST API

As the error is a Internal server error you have to look at the UMC module log for the called UMC module, my guess is that the computer object has some attributes missing or misconfigured and therefore cannot be handled by the module.

1 Like

To provide context in case anyone else has a similar issue- this was the answer, I had a univention/Ubuntu computer that was changed in LDAP and ONLY LDAP to univention/linux, which caused UDM to seize up because univention/ubuntu != univention/linux. Not sure if this is a bug or not, but I’ll be attempting to use the UDM REST API moving forward. Currently writing a support library in Go that wraps the objects from UDM, and makes it easier to manipulate programmatically.

1 Like
Mastodon