How-to: AD-Connector - Map Fax-Number (facsimileTelephoneNumber) from AD to LDAP

How to:

If you want to map the the Fax-Number from the Microsoft AD facsimileTelephoneNumber to the UCS LDAP, you have to create an custom Attribute for and the localmapping.py.

You get more informations in the following links about the localmapping.py.

Article: Additional attributes need to be synced by the AD-Connector

Documantation: Active Directory Connection custom mappings

Step 1: Create the custom Attribute

You need the domain name from your system:

hostname -d

Output:

example-ad.org

Now you could create the custom Attribute via UDM and replace your domain name in the DN:

udm settings/extended_attribute create --position "cn=custom attributes,cn=univention,$(ucr get ldap/base)" --set name=facsimileTelephoneNumber --set shortDescription=FaxNumber --set tabName=Contact --set translationTabName="de_DE Kontakt" --set CLIName=facsimileTelephoneNumber --set mayChange=1 --set multivalue=1 --set module="users/user" --set objectClass=organizationalPerson --set ldapMapping=facsimileTelephoneNumber

Check the created object:

udm settings/extended_attribute list --filter cn=facsimileTelephoneNumber

Output:

DN: cn=facsimileTelephoneNumber,cn=custom attributes,cn=univention,dc=example-ad,dc=org
CLIName: facsimileTelephoneNumber
ldapMapping: facsimileTelephoneNumber
name: facsimileTelephoneNumber

Step 2: Create a new localmapping.py to sync the Fax-Number

If you don’t have created a localmapping.py before, you have to create this under the path.
/etc/univention/connector/ad/localmapping.py

Hint

Be carefully with setting the correct tabs and spaces, because Python is a bit sensitive with that, so you don’t run into a failure.

Add this entries to the mapping:

import univention.connector

def mapping_hook(ad_mapping):
	ad_mapping['user'].post_attributes['facsimileTelephoneNumber'] = \
		univention.connector.attribute(
			ucs_attribute='facsimileTelephoneNumber',
			ldap_attribute='facsimileTelephoneNumber',
			con_attribute='facsimileTelephoneNumber'
                )
        return ad_mapping

Now you have restart the service for the AD-Connector with to make the new mapping guilty:
systemctl restart univention-ad-connector.service

Check in the following log File if the new Entries are take over.
/var/log/univention/connector-ad-mapping.log

'facsimileTelephoneNumber': univention.connector.attribute(
                                compare_function = univention.connector.compare_normal,  # function
                                con_attribute = 'facsimileTelephoneNumber',
                                con_attribute_encoding = 'UTF-8',
                                ldap_attribute = 'facsimileTelephoneNumber',
                                single_value = True,
                                sync_mode = 'sync',
                                ucs_attribute = 'facsimileTelephoneNumber'

Step 3: Possible troubleshooting

In the following log File, you could check the AD-Status and will see which issue is happen.
/var/log/univention/connector-ad-status.log

How to map attribute department from S4 to LDAP via S4-Connector

Mastodon