Before You Begin
This 15-minute tutorial shows you how to configure and verify identity mappers with Oracle Unified Directory 12c. These provide a replacement for UPNBind Plugin functionality previously provided by Oracle Virtual Directory 11g.
This tutorial is part of the Oracle Virtual Directory 11g to Oracle Unified Directory 12c Transition Series.
Background
Identity Mappers are responsible for establishing a mapping
between an identifier string provided by a client, and the entry
for the user that corresponds to that identifier. Oracle Unified
Directory 12c provides support, via Identity Mappers, to allow simple binds using any configured username attribute, such as cn, SamAccountName, sn, and uid.
What Do You Need?
- An environment with:
- At least 16 GB of physical memory
- Oracle Enterprise Linux 6.6 or later with access to the Internet
oracleuser credentials- A basic understanding of Linux
This tutorial assumes that you have already installed and configured the following:
- Oracle Unified Directory (OUD) 12c
- The identitymappersdata.ldif sample data should be loaded to this OUD instance.
- These two OBEs assumes that the following environment
variables are defined:
OUD_ORACLE_HOME=/u01/app/oracle/product/oud/oudOUD_INSTANCES=/u01/app/oracle/config/oud_instances
Configure a Directory Server Instance
In this section, you'll use the oud-setup utility to set up an Oracle Unified Directory 12c server instance.
- Navigate to the
OUD_ORACLE_HOMEdirectory, where the Oracle Unified Directory 12c software is installed. Run theoud-setuputility from the command line to setup an Oracle Unified Directory server instance.
The output should look similar to this:# $OUD_ORACLE_HOME/oud-setup \ --cli \ --no-prompt \ --hostname oud.example.com --ldapPort 1389 \ --rootUserDN "cn=Directory Manager" \ --rootUserPasswordFile ~/pwd.txt \ --baseDN dc=example,dc=com \ --adminConnectorPort 4444 \ --instancePath /u01/app/oracle/config/oud_instances/idmap \ --ldifFile ~/identitymappersdata.ldif
Note: TheOracle Unified Directory Please wait while the setup program initializes... Creating instance directory /u01/app/oracle/config/oud_instances/idmap/.....Done. See /u01/app/oracle/config/oud_instances/idmap/logs/oud-setup for a detailed log of this operation. Configuring Directory Server ..... Done. Importing LDIF file /home/oracle/identitymappersdata.ldif ........ Processed 15 entries, imported 15, skipped 0, rejected 0 and migrated 0 in 0 seconds (average rate 15.8/sec) Starting Directory Server ........ Done. To see basic server configuration status and configuration you can launch /u01/app/oracle/config/oud_instances/idmap/bin/status~/pwd.txtshould contain the password that you want to assign to your OUD Administrator.
Configure an Exact Match Identity Mapper at Global Level
In this section, you'll use the dsconfig utility to set up an Exact Match Identity Mapper that allows users to bind using their uid.
- Configure the
Exact Matchidentity mapper at global level using thedsconfigcommand with the following parameters. Make sure the propertynon-dn-simple-bind-allowedvalue is set totrueto enable simple binds fornon-dnatributes.
# cd $OUD_INSTANCES/idmap/bin # ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-global-configuration-prop --add "generic-identity-mapper:Exact Match" \ --set "non-dn-simple-bind-allowed:true" \ --trustAll \ --no-prompt - Use the
dsconfigcommand to see the default configured match attribute value,uidfor theExact MatchIdentity Mapper you configured in Step 1.
The output should look similar to this:# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ get-identity-mapper-prop --mapper-name "Exact Match" \ --trustAll \ --no-prompt
Property : Value(s) ----------------:--------- enabled : true match-attribute : uid match-base-dn : - match-pattern : (.)* priority : 1 - Execute the
ldapsearchcommand to confirm that you can bind to the directory with the default configured bind user attributeuid.# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "asales" \ --baseDN "dc=example,dc=com" \ --searchScope sub \ --bindPasswordFile ~/pwd.txt \ "(uid=asales)" dn cn uid mailThe output should look similar to this:
dn: uid=asales,ou=People,dc=example,dc=com mail: asales@example.com cn: Anthony Sales uid: asales
Configure an
Additional Match Attribute for the Exact Match Identity Mapper at
Global Level
In this section, you will use the dsconfig utility to set up an additional match-attribute that allows users to bind using their mail attribute in addition to uid.
- Configure an additional match-attribute
mailfor yourExact Matchgeneric identity mapper.
# cd $OUD_INSTANCES/idmap/bin # ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-identity-mapper-prop --mapper-name "Exact Match" \ --add "match-attribute:mail" \ --trustAll \ --no-prompt - Execute the
dsconfigcommand to see the configured match attributes valuesmail, anduidforExact Matchgeneric identity mapper configured in the previous step.
The output should look similar to this:# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ get-identity-mapper-prop --mapper-name "Exact Match" \ --trustAll \ --no-promptProperty : Value(s) ----------------:---------- enabled : true match-attribute : mail, uid match-base-dn : - match-pattern : (.)* priority : 1 - Execute the
ldapsearchcommand to test binding with the default configured match-attributeuid.
The output should look similar to this:# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "jjones" \ --baseDN "dc=example,dc=com" \ --searchScope sub \ --bindPasswordFile ~/pwd.txt \ "(uid=jjones)" dn cn uid maildn: uid=jjones,ou=People,dc=example,dc=com mail: jjones@example.com cn: Jim Jones uid: jjones - Now execute the
ldapsearchcommand to test binding with the same user, but using the other configured match-attributemail.# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "jjones@example.com" \ --baseDN "dc=example,dc=com" \ --searchScope sub \ --bindPasswordFile ~/pwd.txt \ "(mail=jjones@example.com)" dn cn uid mailThe output should look similar to this:
The ldap bind is successful with both user attributesdn: uid=jjones,ou=People,dc=example,dc=com mail: jjones@example.com cn: Jim Jones uid: jjonesuid, andmail. This demonstrates how you can configure multiple user attributes as identity strings in OUD 12c
Configure
Match and Replace Identity Mapper at Global Level
In this section you will configure the Match and Replace Identity Mapper. This allows you to use a regular expression to translate your provided identifier in binds.
- Configure the Match and Replace Identity Mapper at global level using the
dsconfigcommand.
# cd $OUD_INSTANCES/idmap/bin # ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-global-configuration-prop \ --add "generic-identity-mapper:Match And Replace" \ --trustAll \ --no-prompt - Execute the
dsconfigcommand to configure the match-attribute value to thesnattribute.
# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-identity-mapper-prop --mapper-name "Match And Replace" \ --set "match-attribute:sn" \ --trustAll \ --no-prompt - Execute the
dsconfigcommand to see the configured match-attribute valuesnfor the Identity Mapper configured in the previous step
The output should look similar to this:# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ get-identity-mapper-prop --mapper-name "Match And Replace" \ --trustAll \ --no-prompt
Property : Value(s) ----------------:------------- enabled : true match-attribute : sn match-base-dn : - match-pattern : ^([^@]+)@.+$ priority : 1 replace-pattern : $1 - Execute the
ldapsearchcommand to test binding against the configured bind user attributesn.
# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "Kral@example.com" \ --baseDN "dc=example,dc=com" \ --searchScope sub \ --bindPasswordFile ~/pwd.txt \ "(uid=ikral)" dn cn uid mail snThe output should look similar to this:
dn: uid=ikral,ou=People,dc=example,dc=com mail: ikral@example.com sn: Kral cn: Ivan Kral uid: ikralIn this example, the Identity Mapper has mapped the username from the mail address (the part before the '@'), 'Kral', to the
snattribute. - You can try the
ldapsearchcommand with another value, for exampleAndrews@example.com.# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "Andrews@example.com" \ --baseDN "dc=example,dc=com" \ --searchScope sub \ --bindPasswordFile ~/pwd.txt \ "(uid=bandrews)" dn cn uid mail snIn this case the username 'Andrews' is mapped to the
snattribute.dn: uid=bandrews,ou=People,dc=example,dc=com mail: bandrews@example.com sn: Andrews cn: Barry Andrews uid: bandrews
Verify Simple Bind for Duplicated Attributes
In this section you will perfom a simple bind on an attribute which has a duplicate value in more than one entry to see how the Exact Match Identity Mapper handles this scenario.
- Execute the
ldapsearchcommand to show entries which have asnattribute value of 'Jones'.
The output should look similar to this:# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ --baseDN "dc=example,dc=com" \ --searchScope sub \ "(sn=Jones)" dn sndn: uid=jjones,ou=People,dc=example,dc=com sn: Jones dn: uid=sjones,ou=People,dc=example,dc=com sn: Jones - Execute the
dsconfigcommand to add the match-attributesnto the Exact Match Identity Mapper.
# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-identity-mapper-prop --mapper-name "Exact Match" \ --set "match-attribute:sn" \ --trustAll \ --no-prompt - Execute the
dsconfigcommand to see the configured match attributes valuesmail,uidandsnfor the Exact Match Identity Mapper.
The output should look similar to this:# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ get-identity-mapper-prop --mapper-name "Exact Match" \ --trustAll \ --no-prompt
Property : Value(s) ----------------:---------- enabled : true match-attribute : sn match-base-dn : - match-pattern : (.)* priority : 1 - Execute the
ldapsearchcommand to test a simple bind using thesnattribute.
# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "Jones" \ --baseDN "dc=example,dc=com" \ --searchScope sub \ --bindPasswordFile ~/pwd.txt \ "(sn=Jones)" dn cn uid mailThe output should look similar to this:
The ldap bind fails if more than one entry has the same value for the configured attribute. Here the configured attribute isThe simple bind attempt failed Result Code: 49 (Invalid Credentials)sn. The entries foruid=jjonesanduid=sjoneshave the same value ofsni.e.,Jones.
Configure
Identity Mapper at Network Group Level
In this section you will configure Identity Mappers at the network group and global levels. This will demonstrate how network group level Identity Mappers take priority over global level Identity Mappers.
- Configure an Exact Match Identity Mapper at the
network group level using the
dsconfigcommand.
# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-network-group-prop --group-name network-group \ --add "generic-identity-mapper:Exact Match" \ --trustAll \ --no-prompt -
Set the priority for this Identity Mapper using the
dsconfigcommand.
# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-identity-mapper-prop --mapper-name "Exact Match" \ --set "priority:2" \ --trustAll \ --no-prompt - Set the match-attribute for this Identity Mapper to
sn.
# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-identity-mapper-prop --mapper-name "Exact Match" \ --set "match-attribute:sn" \ --trustAll \ --no-prompt - Configure a Match and Replace Identity Mapper at the global level using the
dsconfigcommand.
# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-identity-mapper-prop --mapper-name "Match and Replace" \ --set "priority:1" \ --trustAll \ --no-prompt - Set the match-attribute for this Identity Mapper to
uid.
# ./dsconfig \ --hostname oud.example.com \ --port 4444 \ --bindDN "cn=Directory Manager" \ --bindPasswordFile ~/pwd.txt \ set-identity-mapper-prop --mapper-name "Match and Replace" \ --set "match-attribute:uid" \ --trustAll \ --no-prompt - Execute the
ldapsearchcommand to test a simple bind using the configured bind user attributeuid. In this case the Match and Replace Identity Mapper extracts 'ikral' from the mail address provided and attempts to match against theuidattribute.
The output should look similar to this:# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "ikral@example.com" \ --baseDN "dc=example,dc=com" \ --searchScope sub \ --bindPasswordFile ~/pwd.txt \ "(uid=ikral)" dn cn uid mailThe simple bind attempt failed. Result Code: 49 (Invalid Credentials)This bind fails even though the string passed matches
uid. This is because the network group level Identity Mapper takes precedence over the global level Identity Mapper.
- Execute the
ldapsearchcommand to test a simple bind using thesnattribute.
The output should look similar to this:# ./ldapsearch \ --hostname oud.example.com \ --port 1389 \ --bindDN "Kral" \ --baseDN "dc=example,dc=com" \ --searchScope sub \ --bindPasswordFile ~/pwd.txt \ "(uid=ikral)" dn cn uid mail sndn: uid=ikral,ou=People,dc=example,dc=com mail: ikral@example.com sn: Kral cn: Ivan Kral uid: ikralIn this example, the bind is successful as it meets the requirements of the network group level Identity Mapper.
Want
to Learn More?
Feedback
To provide feedback on this tutorial, please contact Identity Management User Assistance.
Configure the Identity Mapper With Oracle Unified Directory 12c