Univention Bugzilla – Bug 56000
Network module ignores predefined values for computer objects
Last modified: 2023-05-22 13:54:44 CEST
UCS: 5.0-3 errata642 If an administrator wants to create a computer object with a json file via the import of the RestAPI, predefined values of the json file are not considered and overwritten, because when selecting a predefined network, the network mapping module is triggered. Thus the computer object gets a free IP from the network and among other things, "dnsEntryZoneForward" and "dnsEntryZoneReverse" entries are overwritten. The same applies, of course, if the computer object is created via the UMC. The assignment of a computer object to a network is used in various places for administrators, for example, to clearly determine which subnet a device is assigned to. Leaving the assignment of the IP address, DNS and DHCP entries to the automation behind the assignment to a network is not a good option for some administrators, because the expectation at this point would be that the automatic assignment of IP address, DNS and DHCP entries does not take effect if they are already defined in the JSON object. The same is true for 'fqdn' and 'domain' by the way.
Workaround which allows to set the network during the windows computer creation: ## Create Network API Hook cat <<_EOL_ > /usr/local/share/network-api-udm-hook.py # -*- coding: utf-8 -*- import univention.debug from univention.admin.hook import simpleHook class NetworkAPIHook(simpleHook): def hook_ldap_addlist(self, module, al=[]): for a in al: if a[0] == 'univentionFreeAttribute18': al.append(('univentionNetworkLink', a[1], a[2])) return al _EOL_ ## Register Network API Hook . /usr/share/univention-lib/ldap.sh ucs_registerLDAPExtension \ --packagename network-api \ --packageversion 1.0 \ --udm_hook /usr/local/share/network-api-udm-hook.py \ --ucsversionstart 5.0-0 \ --ucsversionend 5.9-99 ## Create Extended Attribut udm settings/extended_attribute create \ --position "cn=custom attributes,cn=univention,$(ucr get ldap/base)" \ --set name=network-api \ --set CLIName=network-api \ --set copyable=0 \ --set disableUDMWeb=1 \ --set doNotSearch=1 \ --set hook=NetworkAPIHook \ --set ldapMapping=univentionFreeAttribute18 \ --set mayChange=1 \ --set module=computers/windows \ --set multivalue=0 \ --set notEditable=0 \ --set objectClass=univentionFreeAttributes \ --set shortDescription=Network-API \ --set syntax=network \ --set valueRequired=0