Networking AS/400 Directory Services (LDAP)
Networking AS/400 Directory Services (LDAP)
Copyright International Business Machines Corporation 1998,2000. All rights reserved. US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
Contents
Part 1. Directory Services (LDAP) . . 1
Chapter 1. Whats new for V4R5 . . . . 3 Chapter 2. Print this topic . . . . . . . 5 Chapter 3. Getting started with AS/400 Directory Services . . . . . . . . . . 7
| | | | | |
LDAP basics . . . . . . . . . . . . . . 8 Example of using AS/400 Directory Services . . 11 Considerations for using LDAP V2 with LDAP V3 . . . . . . . . . . . . . . . . 11 Planning your LDAP directory server . . . . . 12 Migrating to V4R5 from an earlier release of AS/400 Directory Services . . . . . . . . . . . . 12 Migrating from V4R3 AS/400 Directory Services to a later release . . . . . . . . . . . . 13 Installing and Configuring AS/400 Directory Services . . . . . . . . . . . . . . . 14 Installing AS/400 Directory Services . . . . . 14 Configuring the LDAP directory server . . . . 14 Uninstalling AS/400 Directory Services . . . . 16 The IBM SecureWay Directory Management Tool . . 16 Working with ACL Groups . . . . . . . . 29 Tracking changes to the LDAP directory . . . . . 29 Adjusting performance of the LDAP directory server 30
. 40 . 41
. 56
. . . .
. 28 28 . 28 . 28
. 60 60
iii
iv
The LDAP server that AS/400 Directory Services provides is an IBM SecureWay Directory .
To view or download the PDF version, select AS/400 Directory Services (LDAP) (about 475 KB or 65 pages). To 1. 2. 3. 4. 5. save a PDF on your workstation for viewing or printing: Open the PDF in your browser (click the link above). In the menu of your browser, click File. Click Save As... Navigate to the directory in which you would like to save the PDF. Click Save.
| | | | | | | |
. v Understanding LDAP v LDAP: Programming Directory-enabled Applications with Lightweight Directory Access Protocol by Tim Howes and Mark Smith. v Understanding and Deploying LDAP Directory Services by Mark C. Smith, Gordon S. Good, and Tim Howes. v
Copyright IBM Corp. 1998,2000
Note: Some of the material contained in this document is a derivative of LDAP documentation provided by the University of Michigan. Copyright 1992-1996, Regents of the University of Michigan, All Rights Reserved.
LDAP basics
The Lightweight Directory Access Protocol (LDAP) is a directory service protocol that runs over Transmission Control Protocol/Internet Protocol (TCP/IP). LDAP version 2 is formally defined in Internet Engineering Task Force (IETF) Request for Comments (RFC) 1777, Lightweight Directory Access Protocol. LDAP version 3 is formally defined in IETF RFC 2251, Lightweight Directory Access Protocol (v3).You can view these RFCs on the Internet at the following URL:
http://www.ietf.org The LDAP directory service follows a client/server model. One or more LDAP servers contain the directory data. An LDAP client connects to an LDAP Server and makes a request. The server responds with a reply, or with a pointer (a referral) to another LDAP server. Uses of LDAP: Because LDAP is a directory service, rather than a database, the information in an LDAP directory is usually descriptive, attribute-based information. LDAP users generally read the information in the directory much more often than they change it. Updates are typically simple all-or-nothing changes. Common uses of LDAP directories include online telephone directories and e-mail directories. LDAP directory structure: The LDAP directory service model is based on entries (which are also referred to as objects). Each entry consists of one or more attributes, such as a name or address, and a type. The types typically consist of mnemonic strings, such as cn for common name or mail for e-mail address. The example directory in Figure 1 on page 10 shows an entry for Tim Jones that includes mail and telephoneNumber attributes. Some other possible attributes include fax, title, sn (for surname), and jpegPhoto. Each directory has a schema, which is a set of rules that determine the structure and contents of the directory. You should use the IBM SecureWay Directory Management Tool (DMT) to edit the schema files for your LDAP server. After you install AS/400 Directory Services, the files are located on your AS/400 at /QIBM/UserData/OS400/DirSrv. Note: Original copies of the default schema files are located at /QIBM/ProdData/OS400/DirSrv. If you need to replace the files in the UserData directory, you can copy these files to that directory. Each directory entry has a special attribute called objectClass. This attribute controls which attributes are required and allowed in an entry. In other words, the values of the objectClass attribute determine the schema rules the entry must obey. Each directory entry also has the following operational attributes, which the LDAP server automatically maintains:
v CreatorsName, which contains the bind DN used when creating the entry. v CreateTimestamp, which contains the time at which the entry was created. v modifiersName, which contains the bind DN used when the entry was last modified (initially this is the same as CreatorsName). v modifyTimestamp, which contains the time at which the entry was last modified (initially this is the same as CreateTimestamp). | | | | | | | | | | Traditionally, LDAP directory entries are arranged in a hierarchical structure that reflects political, geographic, or organizational boundaries (see Figure 1 on page 10). Entries that represent countries appear at the top of the hierarchy. Entries representing states or national organizations occupy the second level down in the hierarchy. The entries below that can then represent people, organizational units, printers, documents, or other items. You are not limited to the traditional hierarchy when structuring your directory. The domain component structure, for example, is gaining popularity. With this structure, entries are composed of the parts of TCP/IP domain names. For example, dc=ibm,dc=com may be preferable to o=ibm,c=us. LDAP refers to entries with Distinguished Names (DNs). Distinguished names consist of the name of the entry itself as well as the names, in order from bottom to top, of the objects above it in the directory. For example, the complete DN for the entry in the bottom left corner of Figure 1 on page 10 is cn=Tim Jones, o=IBM, c=US. Each entry has at least one attribute that is used to name the entry. This naming attribute is called the Relative Distinguished Name (RDN) of the entry. The entry above a given RDN is called its parent Distinguished Name. In the example above, cn=Tim Jones names the entry, so it is the RDN. o=IBM, c=US is the parent DN for the cn=Tim Jones. To give an LDAP server the capability to manage part of an LDAP directory, you specify the highest level parent distinguished names in the configuration of the server. These distinguished names are called suffixes. The server can access all objects in the directory that are below the specified suffix in the directory hierarchy. For example, if an LDAP server contained the directory shown in Figure 1 on page 10, it would need to have the suffix o=ibm, c=us specified in its configuration in order to be able to answer client queries regarding Tim Jones.
| | | | | | | | | |
A few notes about LDAP and AS/400 Directory Services: v Beginning with V4R5, both the OS/400 LDAP server and the OS/400 LDAP client are based on LDAP Version 3. You can use a V2 client with a V3 server. However, you cannot use a V3 client with a V2 server unless you bind as a V2 client and use only V2 APIs. See LDAP V2/V3 considerations for more details. v The Windows LDAP client is also based on LDAP Version 3. v Because LDAP is a standard, all LDAP servers share many basic characteristics. However, due to implementation differences, they are not all completely compatible with each other. The LDAP server provided by AS/400 Directory Services is closely compatible with other LDAP directory servers in the IBM SecureWay product group. However, it may not be as compatible with other LDAP servers. v The data for the LDAP server that AS/400 Directory Services provides resides in an OS/400 database. More information: For examples of using LDAP directories, see Example of using AS/400 Directory Services on page 11.
10
To learn about more LDAP concepts, see Chapter 5. AS/400 Directory Services concepts and reference information on page 31.
11
| | | | | | | |
You can use a V2 client with a V3 server. Be aware that on a search request, however, the V3 server may send back data in the full range of UTF-8 format, while a V2 client may be only able to handle data in the IA5 character set. Note: LDAP version 2 is formally defined in Internet Engineering Task Force (IETF) Request for Comments (RFC) 1777, Lightweight Directory Access Protocol. LDAP version 3 is formally defined in IETF RFC 2251, Lightweight Directory Access Protocol (v3). You can view these RFCs on the Internet at the following URL:
| |
http://www.ietf.org
| | | | | | | | | | | | | | | |
12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
v AS/400 Directory Services migrates directory data to the V4R5 format the first time that you start the server or import an LDIF file. Plan to allow some time for this migration to complete. Also, be aware that the directory data will require approximately twice as much storage space in V4R5 than it required in V4R4. This is because in V4R4 AS/400 Directory Services supported only the IA5 character set and saved data in ccsid 37 (single byte format). AS/400 Directory Services now supports the full ISO 10646 character set.. After you upgrade to V4R5, you should start your server once to migrate existing data before importing new data. If you try to import data before starting the server once and you do not have enough authority, the import may fail. v Previous releases of AS/400 Directory Services did not take time zones into account when creating time stamp entries. Beginning with V4R5, the time zone will be used in all additions and modifications to the directory. Therefore, when you upgrade when you upgrade to V4R5, AS/400 Directory Services adjusts existing createtimestamp and modifytimestamp attributes to reflect the correct time zone. It does this by subtracting the time zone that is currently defined on the AS/400 system from the time stamps that are stored in the directory. Note that if the current timezone is not the same timezone that was active when the entries were originally created or modified, the new time stamp values will not reflect the original timezone. If you are upgrading from V4R3 of AS/400 Directory Services to V4R5, you may need to perform some additional migration tasks.
You do not need to take any action with these files. This is mentioned only so that you are not concerned if you notice that they are no longer present on your system. Also be aware that there may be additional associated with upgrading to the current release from other releases.
Chapter 3. Getting started with AS/400 Directory Services
13
| | | | | | | | | | | |
14
software in the AS/400 Information Center. You must have *ALLOBJ and *IOSYSCFG special authorities to configure the server. To 1. 2. 3. 4. start the Configure Directory Server wizard, take these steps: In Operations Navigator, expand Network. Expand Servers. Click TCP/IP. Right-click Directory and select Configure. Note: If you have already configured the directory server, click Reconfigure rather than Configure. Follow the on-screen instructions that the Configure Directory Server wizard gives to configure your LDAP directory server. Note: You may also want to put the library that stores the directory data in a user auxiliary storage pool (ASP) rather than the system ASP. When the wizard finishes, your LDAP directory server has a basic configuration. If you are running Lotus Domino on your AS/400, port 389, the default port for the LDAP server, is already in use. You must either change the port that Lotus Domino uses or change the port that AS/400 Directory Services uses. If you want to use another port for a different reason, you can change it now as well. If you want to, you can start the server at this point. Before starting the server, however, you may want to do some or all of the following things: v Import data to the server v Enable Secure Sockets Layer (SSL) security v Set up a referral
15
After SSL is enabled, you can change the port that the LDAP directory server uses for secured connections.
16
| | | | | | | | | | | | | | | |
v Adding, editing, viewing, and deleting entries v Editing entry RDNs The DMT is part of the Windows LDAP client that is included with AS/400 Directory Services. The client is shipped in an integrated file system directory. To install the Windows LDAP client, including the DMT, onto a PC, follow these steps: 1. In Operations Navigator, expand File Systems. 2. Expand File Shares. 3. Double-click Qdirsrv. 4. Double-click UserTools. 5. Double-click Windows. 6. Double-click setup.exe to start installing the DMT. Follow the on-screen instructions to complete the installation. Documentation for the IBM SecureWay Directory Management Tool (DMT) is located in the file dparent.htm. This file is copied to the IBM SecureWay Directory folder on your PC when you install the client.
17
18
Note: The directory server can also be started from a 5250 session by entering the command STRTCPSVR *DIRSRV. Additionally, if you have your directory server configured to start when TCP/IP starts, you can also start it by entering the STRTCP command.
19
Note: The directory server can also be stopped from a 5250 session by entering the commands ENDTCPSVR *DIRSRV, ENDTCPSVR *ALL, or ENDTCP. ENDTCPSVR *ALL and ENDTCP also affect any other TCP/IP servers that run on your AS/400. ENDTCP will also end TCP/IP itself.
20
21
Follow these steps to set up a new replica of the directory server: 1. If you have not already done so, install and configure both the master server and the replica server. Note: Make sure that the schema for the suffixes match on both servers for the parts of the directory that will be replicated. Stop the master server. (optional) Set up LDAP data for initial replication. You can skip this step if you do not have any initial data that you want to transfer to the replica server from the master server. (optional) Move LDAP data to the master server. Skip this step if one of the following applies to your replica server: v It is a new LDAP directory server. v It does not contain data that you want to continue to maintain. Set up the new replica server. Set up the master server to have a new replica. Make sure the master server is allowing updates: a. In Operations Navigator, expand the AS/400 on which the master directory server runs. b. Expand Network. c. Expand Servers. d. Click TCP/IP. e. Right-click Directory and select Properties. f. If it is not already checked, check Allow directory updates.
2. 3.
4.
5. 6. 7.
Note: These instructions assume that both the master server and the replica servers are on AS/400 systems that you manage from Operations Navigator on the same PC. If you are managing your AS/400 systems from separate PCs, you can move between two PCs to perform this task. If either the master or replica server is running on an IBM platform other than AS/400, refer to the documentation for that platform to set up that server.
22
| | |
2. Transfer the LDIF file to the AS/400 system on which the replica server will run. After the LDIF file is transferred to the AS/400 system on which the replica server will run, you need to import the data to the replica server: 1. In Operations Navigator, expand the AS/400 on which the replica directory server runs. 2. If the replica server is not already stopped, stop it now. Refresh the status of the servers until the status is Stopped. 3. Expand Network. 4. Expand Servers. 5. Click TCP/IP. 6. Right-click Directory and select Properties. 7. If Allow directory updates is unchecked, check it. This will allow the data to be imported. 8. Click OK. 9. Import the LDIF file that you transferred in step 2. 10. Right-click Directory and select Properties. 11. Uncheck Allow directory updates.
23
| | | | | | | | | | | | | | | |
11.
12. 13.
14.
| | |
24
| |
13. In the Connect as field, enter the name you specified in step 9 on page 24 when you set up the replica server. 14. Click Password and enter the password you specified in step 10 on page 24 when you set up the replica server. 15. If you want to use Secure Sockets Layer (SSL) when replicating, use Digital Certificate Manager to enable SSL for the server. You can start Digital Certificate Manger from the Network tab. For additional information on enabling SSL on a directory server, see Enabling SSL on the LDAP directory server on page 15. 16. If your server does not use the default port, enter the port number in the Port field. 17. If you do not want to update the replica server every time an entry on the master server changes, select Time. Then specify how often you want the master server to update the replica. 18. Click OK. 19. Click the Database/Suffixes tab. If the suffix that you want to replicate is not on the list, add it. 20. Enable directory updates on each replica server: a. In Operations Navigator, expand the AS/400 on which the replica directory server runs. b. Expand Network. c. Expand Servers. d. Click TCP/IP. e. Right-click Directory and select Properties. f. If Allow directory updates is unchecked, check it. g. Click OK. 21. If each replica server is not already started, start it now. Note: A server cannot be both a master server and a replica server.
25
3. You can also publish AS/400 information to an LDAP directory server that is not on an AS/400 if you configure that server to use the IBM schema. To configure AS/400 to automatically publish AS/400 information into an LDAP directory server, take these steps: 1. In Operations Navigator, right-click on your AS/400 and select Properties. 2. Click the Directory Services tab. 3. Click on the types of information that you want to publish. If you plan to publish more than one type of information to the same location, you can save time by selecting multiple information types to configure at one time. Operations Navigator will then use the values you enter when you configure the one information type as default values when you configure subsequent information types. Click Configure. Click the Publish AS/400 information for check box. In the Directory server field, enter the name of the LDAP directory server where you want to publish AS/400 information. In the Under DN field, enter the parent distinguished name (DN) where you want AS/400 information added on the directory server. In the Distinguished name field, enter a DN to use when connecting to the directory server to publish AS/400 information. In the Password field, enter the password for the DN you specified in the previous step. If your directory server uses Secure Sockets Layer (SSL), select Secured, using SSL. If your directory server does not use the default port, enter the correct port number in the Port field. Click Verify to ensure that the parent DN exists on the server. Tip: Note: If your directory server uses SSL, you must have enabled Operations Navigator to use SSL in order to verify the connection. If the directory path does not exist, a dialog will prompt you to create it. Note: If the parent DN does not exist, and you do not create it, then publishing will not be successful. 13. Click OK.
26
QgldLstDirSvrA Use this APIs LSVR0500 format to list what agents are currently available on your AS/400 system. QgldPubDirObj Use this API to do the actual publishing of information. | | For detailed information about these APIs, see the OS/400 Directory Services topic under Programming in the AS/400 Information Center.
| | | | | | | | | |
Note: If the referral server does not use the default port, specify the correct port number as part of the URL, as port 400 is specified in the second example above. 7. Click OK.
27
| | | | |
6. Click on the suffix that you want to remove to select it. 7. Click Remove. Note: You can choose to delete a suffix without deleting the directory objects under it. This makes the data inaccessible from the directory server. However, you can later regain access to the data by re-adding the suffix.
You should also save the files in that directory whenever you change the configuration or apply PTFs.
28
To 1. 2. 3. 4.
work with ACLs, take these steps: In Operations Navigator, expand Network. Expand Servers. Click TCP/IP. Right-click Directory and select Authority. If you are not already connected to the directory server, the Connect to Directory Server dialog appears. Connect as the server administrator or as the owner of the object whose ACL you want to work with. 5. From the directory tree, select the object whose ACL you want to work with, then click OK. 6. Click the ACL tab.
29
To 1. 2. 3. 4. 5. | | | | | | | |
adjust the performance values of the directory server, take these steps: In Operations Navigator, expand Network. Expand Servers. Click TCP/IP. Right-click Directory and select Properties. Click the Performance tab.
You can also adjust the performance of the directory server by changing the number of database connections that the server uses. To change this value, follow these steps: 1. In Operations Navigator, expand Network. 2. Expand Servers. 3. Click TCP/IP. 4. Right-click Directory and select Properties. 5. Click the Database/Suffixes tab.
30
31
presidents telephone number, you would give them read access to the Normal attributes in the presidents directory object. They would still not be able to access Sensitive and Critical information. Special ACL values Initially, all objects in the AS/400 Directory Services directory server have an ACL that contains a special ACL group, CN=Anybody, that includes all directory users. This group has read, search, and compare access to objects. | | | | | | You may want some objects to have the same access permissions for all users who bind to the directory server with a connection that is not anonymous. To do this, use the special access control list (ACL) group cn=Authenticated. To specify what access permissions an object has for itself, you can use the special DN cn=this. This enables child entries who inherit their ACLs to be automatically authorized to perform operations on their own objects. Additional information To administer ACLs through Operations Navigator, you do not need to know the details of how AS/400 Directory Services implements ACLs. However, if you want to specify ACL related attributes when using LDIF files or want to use ACLs with the LDAP command line utilities, you will need to familiarize yourself with the attributes that ACLs use. For information on setting up and changing ACLs and ACL groups, follow these links: Working with the Access Control Lists (ACLs) on page 28 Working with ACL Groups on page 29
32
Scope of protection: The scope of the protection is based on the following two types of privilege attributes: access-Id The distinguished name (DN) of the entity being granted access. group The distinguished name (DN) of the group entity being granted access. Normal groups have an object class of GroupOfNames, GroupOfUniqueNames, or a user-defined group. Access control groups are object class AccessGroup. The AccessGroup object class is a subclass of the GroupOfNames object class. Groups identified in an aclEntry must be of object class AccessGroup. Privilege attributes take the form type:name, where type refers to either access-id or group, and name is the distinguished name. In the following example, the DN type is access-id, and the DN itself is cn=personA, ou=deptXYZ, o=IBM, c=US:
access-id:cn=personA, ou=deptXYZ, o=IBM, c=US
In the following example, the DN type is group, and the DN itself is cn=deptXYZRegs, o=IBM, c=US:
group:cn=deptXYZRegs, o=IBM, c=US
Attribute access classes: Attributes that require similar permission for access are grouped together in classes. Attributes are assigned to attribute classes within the schema files. The three user-modifiable attribute classes are: v Normal v Sensitive v Critical Each of these attribute classes is discrete. That is, access to information in one class does not give access to information in any other class. Attributes have a default attribute class of normal. In the following example attribute definition, userPassword has been assigned membership in the critical access class, while DN has been assigned membership in the normal access class:
attributetypes=( 2.5.4.49 NAME ( 'dn' 'distinguishedName' ) DESC ' ' SYNTAX 1.3.6.1.4.1.1466.115.1
Access permissions: The following access permissions apply to an entire object: Add Add an object.
Delete Delete an object. The following permissions apply to attribute access classes: Read Write Read an attribute value. Write an attribute.
33
Search Search entries with specified attributes. Compare Compare attributes. Each of the LDAP access permissions is discrete. One permission does not imply another permission. If you give a user (access-id) an aclEntry for a particular object, the user receives that permission. If no permission is given to the user, the user receives permission based on the objects ACL, and the bound user receives the combined permissions of all listed access groups. Note: There are two types of LDAP searches. One retrieves both attributes and values, and the other retrieves only attributes. In order to retrieve both attributes and values, a user must have both read and search permission to the corresponding attributes class. If the user is not listed on the ACL, and is not a member of any listed access group, then the user receives permissions listed under the ACL group CN=Anybody. If this group does not exist, the user is denied access to the object. In the following example, members of the group CN=Anybody have the permission to read, search, and compare all attributes within the normal class:
group:cn=Anybody:normal:rsc
In the following example, the user that corresponds to access-id cn=personA, ou=deptXYZ, o=IBM, c=US has permission to do the following: v v v v Add objects below this object. Delete this object. Read, write, search and compare both normal and sensitive attributes. Read, search, and compare critical attributes.
aclSource attribute: Each directory object has an aclSource attribute. This attribute reflects the DN with which the ACL is associated. The server keeps this attribute, but it may be retrieved for administrative purposes. aclPropagate attribute: This true or false object attribute specifies whether or not the objects ACL is propagated to objects below it in the directory hierarchy. An object without an explicit ACL receives its ACL from the first propagating ACL above the object in the directory hierarchy. Propagated ACLs do not accumulate. The scope of a propagated ACL is from the explicitly set propagating ACL down through the directory hierarchy until another propagating ACL is found. Example 1: Propagation The entry ou=deptXYZ, o=IBM, c=US has the following explicit ACL:
aclPropagate: True aclEntry: group:cn=deptXYZRegs, o=IBM, c=US:normal:rcs:sensitive:rsc aclEntry: access-id:cn=personA, ou=deptXYZ, o=IBM, c=US:object:ad:normal:rwsc:sensitive:rsc aclEntry: group:cn=Anybody:normal:rsc aclSource: ou=deptXYZ, o=IBM, c=US
34
The entry cn=personA, ou=deptXYZ, o=IBM, c=US has the following implicit ACL::
aclPropagate: True aclEntry: group:cn=deptXYZRegs, o=IBM, c=US:normal:rcs:sensitive:rsc aclEntry: access-id:cn=personA, ou=deptXYZ, o=IBM, c=US:object:ad:normal:rwsc:sensitive:rsc aclEntry: group:cn=Anybody:normal:rsc aclSource: ou=deptXYZ, o=IBM, c=US
In this example, a propagating ACL has been set on ou=deptXYZ, o=IBM, c=US. On the descendant cn=personA, ou=deptXYZ, o=IBM, c=US, no ACL has been set. Therefore, the descendant inherits its ACL from the first ancestor with a propagating ACL, which in this case is ou=deptXYZ, o=IBM, c=US. This is reflected in the aclSource field. The aclEntry and aclPropagate values are identical to the explicit propagating ACL set at ou=deptXYZ, o=IBM, c=US. Example 2: Overrides The entry o=IBM, c=US has the following explicit ACL:
aclPropagate: TRUE aclEntry: group:cn=IBMRegs, o=IBM, c=US:normal:rcs:sensitive:rsc aclEntry: group:cn=Anybody:normal:rsc aclSource: o=IBM, c=US
The entry ou=deptXYZ, o=IBM, c=US has the following explicit ACL:
aclPropagate: FALSE aclEntry: group:cn=deptXYZRegs, o=IBM, c=US:normal:rcs:sensitive:rsc aclEntry: access-id:cn=personA, ou=deptXYZ, o=IBM, c=US:object:ad:normal:rwsc:sensitive:rwsc aclEntry: group:cn=Anybody:normal:rsc aclSource: ou=deptXYZ, o=IBM, c=US
The entry cn=personA, ou=deptXYZ, o=IBM, c=US has the following implicit ACL:
aclPropagate: TRUE aclEntry: group:cn=IBMRegs, o=IBM, c=US:normal:rcs:sensitive:rsc aclEntry: group:cn=Anybody:normal:rsc aclSource: o=IBM, c=US
In this example, a propagating ACL has been set on o=IBM, c=US. On the descendant ou=deptXYZ, o=IBM, c=US, an explicit ACL has been set which overrides the ACL that would otherwise have been inherited from o=IBM, c=US. The entry cn=personA, ou=deptXYZ, o=IBM, c=US inherits its ACL from the first ancestor with a propagating ACL. Because ou=deptXYZ, o=IBM, c=US has the aclPropagate attribute set to FALSE, cn=personA, ou=deptXYZ, o=IBM, c=US inherits its ACL from o=IBM, c=US. The aclSource attribute reflects this. entryOwner attribute: The entryOwner attribute specifies the owner of a directory object. The user or group specified by entryOwner receives complete access to all of the objects attributes. In essence, they are the administrator for a particular object. ownerSource attribute: The ownerSource attribute reflects the DN with which the owner values are associated. The server keeps this attribute, but it can be retrieved for administrative purposes. ownerPropagate attribute:
Chapter 5. AS/400 Directory Services concepts and reference information
35
Owner propagation works in exactly the same way as ACL propagation works. By default, objects inherit owners through the directory hierarchy, and their ownerPropagate attribute is set to TRUE. If ownerPropagate is set to FALSE, the owner becomes an override that pertains only to that particular object. A typical ACL entry: The following entry shows a typical ACL for the entry cn=personA, ou=deptXYZ, o=IBM, c=US:
entryOwner: access-id:cn=deptXYQMgr, ou=deptXYZ, o=IBM, c=US ownerPropagate: TRUE aclPropagate: TRUE aclEntry: group:cn=deptXYZRegs, o=IBM, c=US:normal:rcs:sensitive:rsc aclEntry: access-id:cn=personA, ou=deptXYZ, o=IBM, c=US:object:ad:normal:rwsc:sensitive:rwsc:critical:rsc aclEntry: group:cn=Anybody:normal:rsc aclSource: ou=deptXYZ, o=IBM, c=US ownerSource: ou=deptXYZ, o=IBM, c=US
The entry inherits both its owner properties and its ACL properties from object ou=deptXYZ, o=IBM, c=US. Members of the group cn=deptXYZRegs, o=IBM, c=US have permission to read, search, and compare objects in both the normal and sensitive attribute classes. They do not have permission to add or delete objects under this object. Nor do they have permission to access any information or change any information on attributes in the critical class. PersonA has add and delete permission on the object, read, write, search, and compare permissions on normal and sensitive attributes. PersonA also has read, search, and compare permission on critical attributes. All other users have permission to read, search, and compare attributes in the normal attribute class only. AS/400 Directory Services ACL defaults: AS/400 Directory Services has the following ACL defaults, assuming that the administrator DN is cn=admin, c=US:
entryOwner: access-id:cn=admin, c=US ownerPropagate: TRUE aclPropagate: TRUE aclEntry: group:cn=Anybody:normal:rsc aclSource: default ownerSource: default
36
| | | | | | | | | | |
where: v version shows the version of the LDIF file format. The version number must be 1. If the version number is absent, LDIF file is considered to be in an older LDIF file format. When the LDIF file is version 1, the content MUST be UTF-8 encoded. v distinguished name is the distinguished name of the directory entry v attrtype1 is an LDAP attribute type (such as cn or ou) v attrvalue1 is value of the attribute Each entry can have several attributes. Each attribute appears on a separate line. If an attribute value is longer than a single line, it may be continued on the next line, and is preceded by a space or tab character. Blank lines separate multiple entries within the same LDIF file. Any line that begins with a pound-sign (#) is a comment line, and must be ignored when parsing an LDIF file.
| | | | | | |
Any distinguished name or attribute value that meets one of the following conditions should be base-64 encoded: v It contains carriage returns or line feeds. v It starts with a colon (:), SPACE, or less-than (<). v It ends with space. Base-64 encoded attributes are designated by using two colons between the attribute name and the value. External references are in the file:// URL format. There should be colon and less than (:<) between the attribute type and the external reference value.
| | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Here are some examples of LDIF files: Example 1: A simple LDAP file with two entries
version: 1 dn: cn=Barbara Jensen, ou=Rochester, o=Big Company, c=US objectclass: top objectclass: person objectclass: organizationalPerson cn: Barbara Jensen cn: Barbara J Jensen cn: Babs Jensen sn: Jensen uid: bjensen telephonenumber: +1 408 555 1212 description: A big sailing fan. dn: cn=Bjorn Jensen, ou=Rochester, o=Big Company, c=US objectclass: top objectclass: person objectclass: organizationalPerson cn: Bjorn Jensen sn: Jensen telephonenumber: +1 408 555 1212 description:Babs is a big sailing fan, and travels extensively in sea rch of perfect sailing conditions. title:Product Manager, Rod and Reel Division
37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
objectclass: person objectclass: organizationalPerson cn: Gern Jensen cn: Gern O Jensen sn: Jensen uid: gernj telephonenumber: +1 408 555 1212 description:: V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvdSBhcmUhICBUaGlzIHZhbHVlIGlzIGJ hc2UtNjQtZW5jb2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdGVyIGluIGl0ICh hIENSKS4NICBCeSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQgb3V0IG1vcmUu
Example 3: A file containing a series of change records and comments Note: LDIF files with change records cannot be imported into the server directly. However, they are supported by the LDAP shell utilities.
version: 1 # Add a new entry dn: cn=Fiona Jensen, ou=Rochester, o=Big Company, c=US changetype: add objectclass: top objectclass: person objectclass: organizationalPerson cn: Fiona Jensen sn: Jensen uid: fiona telephonenumber: +1 408 555 1212 jpegphoto:< file:///usr/local/directory/photos/fiona.jpg # Delete an existing entry dn: cn=Robert Jensen, ou=Rochester, o=Big Company, c=US changetype: delete # Modify an entry's relative distinguished name dn: cn=Paul Jensen, ou=Rochester, o=Big Company, c=US changetype: modrdn newrdn: cn=Paula Jensen deleteoldrdn: 1
The order of entries in the LDIF file is important. To successfully add an entry that is specified in the LDIF file to an LDAP directory, its parent entry must first exist in the directory namespace. In the example above, the second and third entries could not be added if the first entry did not exist. Similarly, to import an LDIF file into a server that supports certain suffixes, the LDIF file must have entries for those suffixes. For example, if your server had the suffix ou=Rochester, o=Big Company, c=US, the LDIF file shown above could be imported. But if your server instead had the suffix o=Big Company, c=US, you must have an entry for that suffix specified first in the LDIF file, as shown here:
dn: o=Big Company, c=US objectclass: organization o: Big Company
The specific format and contents of LDIF files are determined by the schema of the server from which they are exported. You can import an LDIF file to any LDAP server that uses the identical schema as the server from which the file was exported. Different vendors LDAP servers use different schema (with different object classes and attributes). Therefore, you may not be able to import an LDIF file that is created by one server to another server.
38
As of this writing, an Internet Draft of an Internet Engineering Task Force (IETF) Request for Comments (RFC) on LDIF file specifications is available at the following URL:
http://www.ietf.org Related procedures: Importing an LDIF file on page 21 Exporting an LDIF file on page 21
39
AS/400 Directory Services allows you to use two different types of referrals. You can specify default referral servers, where the LDAP server will refer clients whenever any DN is not in the directory. You can also use your LDAP client to add entries to the directory server that have the objectClass referral. This allows you to specify referrals that are based on what specific DN a client requests. Note: With AS/400 Directory Services, referral objects must contain only a distinguished name (dn), an objectClass (objectClass), and a referral (ref) attribute. See ldapsearch utility on page 48 for an example that illustrates this restriction. Referral servers are closely related to replica servers. Because data on replica servers cannot be changed from clients, the replica refers any requests to change directory data to the master server.
Using Secure Sockets Layer (SSL) security with the LDAP directory server
To make communications with your LDAP directory server more secure, AS/400 Directory Services can use Secure Sockets Layer (SSL) security. To use SSL with AS/400 Directory Services, you must have one of the Cryptographic Access Provider products (5769AC1, 5769AC2, OR 5769AC3) installed on your AS/400 system. If you want to use SSL from Operations Navigator, you must also have one of the Client Encryption products (5769CE1, 5769CE2, or 5769CE3) installed on your PC. You need this software if you want to do any of the following: v To configure and administer AS/400 Directory Services from your workstation using an SSL connection. This includes tasks that you perform from Operations Navigator. v To use an SSL connection with applications that you create with the Windows client application program interfaces (APIs). | | | SSL is the standard for Internet security.You can use SSL to communicate with LDAP clients, as well as with replica LDAP servers. Beginning with V4R5, you can use client authentication, in addition to server authentication, to provide additional
40
| | | | | | | | | |
security to your SSL connections. Client authentication requires that the LDAP client present a digital certificate that confirms the clients identity to the server before a connection is established. To use SSL, you must have Digital Certificate Manager (DCM), option 34 of OS/400, installed on your system. DCM provides an interface for you to create and manage digital certificates and certificate stores. See the documentation for Digital Certificate Manager for information on digital certificates and on using DCM. For information about SSL on AS/400, see Securing applications with SSL. For information on enabling SSL on your LDAP directory server, see Enabling SSL on the LDAP directory server on page 15.
Your environment, directory size and structure, or save and restore strategy may dictate some differences, including how these objects are managed and the size threshold used. You can change journaling command parameters if necessary. For information on journaling commands, see OS/400 commands .
41
42
43
Parameters:
-V Specifies the LDAP version that the utility uses to bind to the LDAP server. By default, it uses an LDAP V3 connection. To explictly select LDAP V3, specify -V 3. Specify -V 2 to run as an LDAP V2 application. Only ldapmodify uses this parameter. It indicates that the utility will add entries rather than modifying them. Using this parameter is the same as using ldapadd. Assume that any values that start with a / are binary values and that the actual value is in a file whose path is specified in the place where values normally appear. Continuous operation mode. Errors are reported, but ldapmodify or ldapadd continues with modifications or adds. The default is to exit after reporting an error. Replace existing values by default. Show what would be done, but do not actually modify entries. Useful for debugging in conjunction with -v. Use verbose mode, with many diagnostics written to standard output. Force application of all changes regardless of the contents of input lines that begin with replica: (by default, replica: lines are compared against the LDAP server host and port in use to decide if a replication log record should actually be applied). Specifies that referrals are not to be automatically followed. Specifies that strings supplied as input to the utility are represented in a local character set (charset), and must be converted to UTF-8. Use the -C charset option if the input string codepage is different from the job codepage value. Refer to the documentation for the ldap_set_iconv_local_charset() API to see supported charset values. Sets the debug level to debuglevel. Use binddn to bind to the LDAP directory. binddn should be a string-represented DN. Use passwd as the password for simple authentication. Specify an alternate host on which the LDAP server is running. Specify an alternate Transmission Control Protocol (TCP) port where the LDAP server is listening. The default LDAP port is 389. If not specified and -Z is specified, the default LDAP SSL port 636 is used. Read the entry modification information from an LDIF file instead of from standard input. If an LDIF file is not specified, you must use standard input to specify the update records in LDIF format. Use a secure SSL connection to communicate with the LDAP server. The -Z option is only supported by SSL-enabled versions of this tool. Specify the name of the SSL key database file. If the key database file is not in the current directory, specify the fully-qualified key database filename. If the utility cannot locate a key database, it will use a hard-codced set of default trusted certificate authority roots. The key database file typically contains one or more certificates of certification authorities (CAs) that are trusted by the client. These types of X.509 certificates are also known as trusted roots. This parameter effectively enables the -Z switch.
-a
-b
-c
-r -n -v -F
-R -C charset
-f file
-Z
-K keyfile
44
-P keyfilepw
Specify the key database password. This password is required to access the encrypted information in the key database file (including the private key). If a password stash file is associated with the key database file, the pasword is obtained from the stash file and this parameter is not required. This parameter is ignored if neither -Z nor -K are specified. Specify the label associated with the client certificate in the key database file. Note that if the LDAP server is configured to perform Server Authentication only, a client certificate is not required. If the LDAP server is configured to perform Client and Server Authentication, a client certificate is required. certificatename is not required if a default certificate/private key pair has been designated as the default. Similarly, certificatename is not required if there is a single certificate/private key pair in the designated key database file. This parameter is ignored if neither -Z nor -K are specified.
-N certificatename
Alternative Input Format: ldapmodify supports an alternative input format in order to maintain compatibility with older versions of the utility. This format consists of one or more entries that are separated by blank lines. Each entry has the following format:
Distinguished Name (DN) attr=value [attr=value ...]
where attr is the name of the attribute and value is the value. By default, values are added. If you give the -r command line flag, the default is to replace existing values with the new one. Note that it is permissible for a given attribute to appear more than once (for example, you can add more than one value for an attribute). Also note that you can use a trailing backslash (\) to continue values across lines and to preserve new lines in the value itself. To remove a value, precede the attr value with a dash (-). The equal sign (=) and value should be omitted to remove an entire attribute. attr should be preceded by a plus sign (+) to add a value in the presence of the -r flag.
The command ldapmodify -b -r -f /tmp/entrymods will do the following: v replace the contents of the Modify Me entrys mail attribute with the value [email protected]. v add a title of Grand Poobah.
Chapter 6. LDAP command line utilities
45
v add the contents of the file /tmp/modme.jpeg as a jpegPhoto. v completely remove the description attribute. You can perform the same modifications as above with the older ldapmodify input format:
cn=Modify Me, o=University of Higher Learning, c=US [email protected] +title=Grand Poobah +jpegPhoto=/tmp/modme.jpeg -description
Example 2: Assume that the file /tmp/newentry exists and has the following contents:
dn: cn=John Doe, o=University of Higher Learning, c=US objectClass: person cn: John Doe cn: Johnny sn: Doe title: Manager mail: [email protected] uid: jdoe
The command ldapadd -f /tmp/entrymods will add a new entry for John Doe, using the values from the file /tmp/newentry. Example 3: If the file /tmp/newentry exists and has the contents:
dn: cn=John Doe, o=University of Higher Learning, c=US changetype: delete
The command ldapmodify -f /tmp/entrymods will remove the entry for John Doe.
ldapdelete utility
The ldapdelete utility allows you to delete one or more entries from an LDAP directory server. It runs through the QSH command shell on AS/400. It uses the ldap_delete application program interface (API). Format: ldapdelete [-V] [-n] [-v] [-c] [-R] [-C charset] [-d debuglevel] [-ffile] [-D binddn] [-w passwd] [-m mechanism] [-O hopcount] [-h ldaphost] [-p ldapport] [-Z] [-K keyfile] [-P keyfilepw] [-N certificatename] [dn]... Note: If you do not provide dn arguments, the ldapdelete command will wait to read a list of DNs from standard input. To break out of the wait, press the SysReq key, then choose 2. End previous request. Diagnostics:
46
The exit status is 0 if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error. Click here to see examples of using the ldapdelete utility. Parameters:
-V Specifies the LDAP version that the utility uses to bind to the LDAP server. By default, it uses an LDAP V3 connection. To explictly select LDAP V3, specify -V 3. Specify -V 2 to run as an LDAP V2 application. Show what would be done, but do not actually delete entries. Useful for debugging in conjunction with -v. Use verbose mode, with many diagnostics written to standard output. Continuous operation mode. Errors are reported, but ldapdelete will continue with deletions. The default is to exit after reporting an error. Specifies that referrals are not to be automatically followed. Specifies that the distinguished names (DNs) supplied as input to the ldapdelete utility are represented in a local character set (charset). Use -C charset to override the default, where strings must be supplied in UTF-8. Use the -C charset option if the input string codepage is different from the job codepage value. Refer to the documentation for the ldap_set_iconv_local_charset() API to see supported charset values. Sets the debug level to debuglevel. Read a series of lines from file, performing one LDAP delete for each line in the file. Each line in the file should contain a single distinguished name (DN). Use binddn to bind to the LDAP directory. binddn should be a string-represented DN. Use passwd as the password for simple authentication. Use mechanism specify the SASL mechanism to be used to bind to the server.The ldap_sasl_bind_s() API will be used. The -m parameter is ignored if -V 2 is set. If -m is not specified, simple authentication is used. Specify hopcount to set the maximum number of hops that the client library will take when chasing referrals. The default hopcount is 10. Specify an alternate host on which the LDAP server is running. Specify an alternate Transmission Control Protocol (TCP) port where the LDAP server is listening. The default LDAP port is 389. If not specified and -Z is specified, the default LDAP SSL port 636 is used. Use a secure SSL connection to communicate with the LDAP server. The -Z option is only supported by SSL-enabled versions of this tool.
-n -v -c
-R -C charset
-d debuglevel -f file
-Z
47
-K keyfile
Specify the name of the SSL key database file. If the key database file is not in the current directory, specify the fully-qualified key database filename. If the utility cannot locate a key database, it will use a hard-codced set of default trusted certificate authority roots. The key database file typically contains one or more certificates of certification authorities (CAs) that are trusted by the client. These types of X.509 certificates are also known as trusted roots. This parameter effectively enables the -Z switch. Specify the key database password. This password is required to access the encrypted information in the key database file (including the private key). If a password stash file is associated with the key database file, the pasword is obtained from the stash file and this parameter is not required. This parameter is ignored if neither -Z nor -K are specified. Specify the label associated with the client certificate in the key database file. Note that if the LDAP server is configured to perform Server Authentication only, a client certificate is not required. If the LDAP server is configured to perform Client and Server Authentication, a client certificate is required. certificatename is not required if a default certificate/private key pair has been designated as the default. Similarly, certificatename is not required if there is a single certificate/private key pair in the designated key database file. This parameter is ignored if neither -Z nor -K are specified. Specifies one or more dn arguments. Each dn should be a string-represented DN.
-P keyfilepw
-N certificatename
dn
Example: ldapdelete
The following command will attempt to delete the entry named with commonName Delete Me directly below the University of Life organizational entry :
ldapdelete "cn=Delete Me, o=University of Life, c=US"
It may be necessary to supply a binddn and passwd (see the -D and -w options).
ldapsearch utility
The ldapsearch utility allows you to search for an entry on your LDAP directory server the from the QSH command shell on AS/400. It uses the ldap_search application programming interface (API). The search uses a filter that conforms to the string representation for LDAP filters. For more information on LDAP search filters, see the ldap_search API information in one of the following locations: v In the OS/400 Directory Services topic under Programming in the AS/400 Information Center. v In the IBM Lightweight Directory Access Protocol (LDAP) topic under Client Access Express in the AS/400 Information Center. If the ldapsearch utility finds one or more entries, it retrieves the attributes that are specified by attrs and prints the entries and values to standard output. If you do not list any attributes, it returns all attributes. Format:
| | | | |
48
ldapsearch [-V] [-n] [-v] [-t] [-A] [-B] [-L] [-R] [-C charset] [-d debuglevel] [-F sep] [-f file] [-D binddn] [-w bindpasswd] [-m mechanism] [-O hopcount] [-h ldaphost] [-p ldapport] [-Z] [-K keyfile] [-P keyfilepw] [-N certificatename] [-b searchbase] [-s scope] [-a deref] [-l time limit] [-z size limit] filter [attrs...] Diagnostics: The exit status is 0 if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error. Output Format: If ldapsearch finds one or more entries, it writes each entry to standard output in the form:
Distinguished Name (DN) attributename=value attributename=value attributename=value ...
Multiple entries are separated with a single blank line. If you use the -F option to specify a separator character, the output displays that character instead of the equal (=) character. If you use the -t option, the name of a temporary file replaces the actual value. If you specify the -A option, only the attributename part is written. Click here to see examples of using the ldapsearch utility. Parameters:
-V Specifies the LDAP version that the utility uses to bind to the LDAP server. By default, it uses an LDAP V3 connection. To explictly select LDAP V3, specify -V 3. Specify -V 2 to run as an LDAP V2 application. Show what would be done, but do not actually perform the search. Useful for debugging in conjunction with -v. Use verbose mode, with many diagnostics written to standard output. Write retrieved values to a set of temporary files. This is useful for dealing with binary values such as jpegPhoto or audio. Retrieve attributes only (no values). This is useful when you just want to see if an attribute is present in an entry and are not interested in the specific values. Do not suppress display of binary values. This is useful when dealing with values that appear in alternate characters sets such as ISO-8859.1. This option is implied by -L Display search results in LDIF format. This option also turns on the -B option, and causes the -F option to be ignored. Specifies that referrals are not to be automatically followed.
-n -v -t -A
-B
-L -R
49
-C charset
Specifies that strings supplied as input to the ldapsearch utility are represented in a local character set (charset). String input includes the filter, the bind DN, and the base DN. Similarly, when displaying data, ldapsearch will convert data received from the LDAP server to the specified character sUse the -C charset option if the input string codepage is different from the job codepage value. Refer to the documentation for the ldap_set_iconv_local_charset() API to see supported charset values. Also, if the -C option and the -L option are both specified, input is assumed to be in the specified character set, but output from ldapsearch is always preserved in its UTF-8 representation, or a base 64-encoded representation of the data when non-printable characters are detected. This is the case since standard LDIF files only contain UTF-8 (or base 64-encoded UTF-8) representations of string data. Sets the debug level to debuglevel. Use sepas the field separator between attribute names and values. The default separator is =, unless the -L flag has been specified, in which case this option is ignored. Read a series of lines from file, performing one LDAP search for each line in the file. Each line in the file should contain a single distinguished name (DN). Use binddn to bind to the LDAP directory. binddn should be a string-represented DN. Use passwd as the password for simple authentication. Use mechanism to specify the SASL mechanism to be used to bind to the server.The ldap_sasl_bind_s() API will be used. The -m parameter is ignored if -V 2 is set. If -m is not specified, simple authentication is used. Specify hopcount to set the maximum number of hops that the client library will take when chasing referrals. The default hopcount is 10. Specify an alternate host on which the LDAP server is running. Specify an alternate Transmission Control Protocol (TCP) port where the LDAP server is listening. The default LDAP port is 389. If not specified and -Z is specified, the default LDAP Secure Sockets Layer (SSL) port 636 is used. Use a secure SSL connection to communicate with the LDAP server. The -Z option is only supported by SSL-enabled versions of this tool. Specify the name of the SSL key database file. If the key database file is not in the current directory, specify the fully-qualified key database filename. If the utility cannot locate a key database, it will use a hard-codced set of default trusted certificate authority roots. The key database file typically contains one or more certificates of certification authorities (CAs) that are trusted by the client. These types of X.509 certificates are also known as trusted roots. This parameter effectively enables the -Z switch. Specify the key database password. This password is required to access the encrypted information in the key database file (including the private key). If a password stash file is associated with the key database file, the pasword is obtained from the stash file and this parameter is not required. This parameter is ignored if neither -Z nor -K are specified.
-d debuglevel -F sep
-f file
-Z
-K keyfile
-P keyfilepw
50
-N certificatename
Specify the label associated with the client certificate in the key database file. Note that if the LDAP server is configured to perform Server Authentication only, a client certificate is not required. If the LDAP server is configured to perform Client and Server Authentication, a client certificate is required. certificatename is not required if a default certificate/private key pair has been designated as the default. Similarly, certificatename is not required if there is a single certificate/private key pair in the designated key database file. This parameter is ignored if neither -Z nor -K are specified. Use searchbase as the starting point for the search instead of the default. If -b is not specified, this utility will examine the LDAP_BASEDN environment variable for a searchbase definition. Specify the scope of the search. scope should be one of base, one, or sub to specify a base object, one-level, or subtree search. The default is sub. Specify how aliases dereferencing is done. deref should be one of never, always, search, or find to specify that aliases are never dereferenced, always dereferenced, dereferenced when searching, or dereferenced only when locating the base object for the search. The default is to never dereference aliases. Wait at most timelimit seconds for a search to complete. Limit the results of the search to at most sizelimit entries. This makes it possible to place an upper bound on the number of entries that are returned for a search operation. Specifies the name of the filter that the search uses. Specifies the attributes that the utility retrieves if the search finds one or more entries. If you do not list any values for attrs, the utility returns all attributes.
-b searchbase
-s scope
-a deref
-l timelimit -z sizelimit
filter attrs...
Examples: ldapsearch
Example 1: The command ldapsearch "cn=john doe" cn telephoneNumber performs a subtree search (using the default search base) for entries with a commonName of john doe. The search retrieves the commonName values and the telephoneNumber values, and prints them to standard output. If the search finds two entries, the output looks similar to this:
cn=John E Doe, ou="College of Literature, Science, and the Arts", ou=Students, ou=People, o=University of Higher Learning, c=US cn=John Doe cn=John Edward Doe cn=John E Doe 1 cn=John E Doe telephoneNumber=+1 313 555-5432 cn=John B Doe, ou=Information Technology Division, ou=Faculty and Staff, ou=People, o=University of Higher Learning, c=US cn=John Doe cn=John B Doe 1 cn=John B Doe telephoneNumber=+1 313 555-1111
Example 2: The command ldapsearch -t "uid=jed" jpegPhoto audio performs a subtree search using the default search base for entries with user id of jed. The search
Chapter 6. LDAP command line utilities
51
retrieves the jpegPhoto and audio values and writes them to temporary files. If the search finds one entry with one value for each of the requested attributes, the output looks similar to this:
cn=John E Doe, ou=Information Technology Division, ou=Faculty and Staff, ou=People, o=University of Higher Learning, c=US audio=/tmp/ldapsearch-audio-a19924 jpegPhoto=/tmp/ldapsearch-jpegPhoto-a19924
Example 3: The command ldapsearch -L -s one -b "c=US" "o=university*" o description performs a one-level search at the c=US level . This search looks for all organizations whose organizationName begins with university. The search displays its results in the LDIF format. It retrieves the organizationName attribute value and the description attribute values and prints them to standard output that looks similar to this:
dn: o=University of Alaska Fairbanks, c=US o: University of Alaska Fairbanks description: Preparing Alaska for a brave new tomorrow description: leaf node only dn: o=University of Colorado at Boulder, c=US o: University of Colorado at Boulder description: No personnel information description: Institution of education and research dn: o=University of Colorado at Denver, c=US o: University of Colorado at Denver o: UCD o: CU/Denver o: CU-Denver description: Institute for Higher Learning and Research dn: o=University of Florida, c=US o: University of Florida o: UFl description: Shaper of young minds ...
Example 4: As discussed in LDAP directory referrals on page 39, AS/400 Directory Services LDAP directories may contain referral objects , provided that they contain only the following: v A distinguished name (dn). v An objectClass (objectClass). v A referral (ref) attribute. This example demonstrates searches where a referral object is involved. Assume that System_A holds the referral entry:
dn: cn=Barb Jensen, ou=Rochester, o=Big Company, c=US ref: ldap://System_B:389/cn=Barb Jensen, ou=Rochester, o=Big Company, c=US objectclass: referral
All attributes associated with the entry should reside on System_B. System_B contains an entry:
52
dn: cn=Barb Jensen, ou=Rochester, o=Big Company, c=US cn: Barb Jensen objectclass: organizationalPerson sn: Jensen telephonenumber: (800) 555 1212
When a client issues a request to System_A, the LDAP server on System_A responds to the client with the URL:
ldap://System_B:389/cn=Barb Jensen, ou=Rochester, o=Big Company, c=US
The client uses this information to issue a request to System_B. If the entry on System_A contains attributes in addition to dn, objectclass, and ref, the server ignores those attributes (unless you specify the -R flag to indicate not to chase referrals). When the client receives a referral response from a server, it issues the request again, this time to the server to which the returned URL refers. The new request has the same scope as the original request. The results of this search vary depending on the value you specify for the scope of the search (-b). If you specify -s base, as shown here:
ldapsearch -h System_A -b 'ou=Rochester, o=Big Company, c=US' -s base 'sn=Jensen'
the search returns all attributes for all entries with sn=Jensen that reside in 'ou=Rochester, o=Big Company, c=US' on both System_A and System_B. If you specify -s sub, as shown here:
ldapsearch -h System_A -b 'ou=Rochester, o=Big Company, c=US' -s sub 'sn=Jensen'
the search returns all attributes for all entries with sn=Jensen that reside in or below 'ou=Rochester, o=Big Company, c=US' on both System_A and System_B. If you specify -s one, as shown here:
ldapsearch -h System_A -b 'ou=Rochester, o=Big Company, c=US' -s one 'sn=Jensen'
the search returns no entries on either system. Instead, the server returns the referral URL to the client:
ldap://System_B:389/cn=Barb Jensen, ou=Rochester, o=Big Company, c=US
This does not give any results either, because the entry dn: cn=Barb Jensen, ou=Rochester, o=Big Company, c=US resides at ou=Rochester, o=Big Company, c=US. A search with -s one attempts to find entrie c=US.
53
ldapmodrdn utility
The ldapmodrdn utility allows you to change the Relative Distinguished Name (RDN) of entries on the LDAP directory server. You use it from the QSH command shell on AS/400. It uses the ldap_modrdn application program interface (API). Format: ldapmodrdn [-V] [-r] [-n] [-v] [-c] [-R] [-C charset] [-d debuglevel] [-D binddn] [-w passwd] [-m mechanism] [-O hopcount] [-h ldaphost] [-p ldapport] [-Z] [-K keyfile] [-P keyfilepw] [-N certificatename] [-f file] [dn rdn] Notes: 1. If you give the command-line arguments dn and rdn, rdn will replace the RDN of the entry that is specified by the DN, dn. Otherwise, the contents of the file (or of the standard input if you do not give the -f flag) should consist of one or more entries.
Distinguished Name (DN) Relative Distinguished Name (RDN)
One or more blank lines separate each DN/RDN pair. 2. If do not supply entry information from file through the use of the -f option (or from the command-line pair dn and rdn), the ldapmodrdn command will wait to read entries from standard input. To break out of the wait, press the SysReq key, then choose 2. End previous request. Diagnostics: The exit status is 0 if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error. Click here to see an example of using the ldapmodrdn utility. Parameters:
-V Specifies the LDAP version that the utility uses to bind to the LDAP server. By default, it uses an LDAP V3 connection. To explictly select LDAP V3, specify -V 3. Specify -V 2 to run as an LDAP V2 application. Remove old relative distinguished name (RDN) values from the entry. Default is to keep old values. Show what would be done, but do not actually change entries. Useful for debugging in conjunction with -v. Use verbose mode, with many diagnostics written to standard output. Continuous operation mode. Errors are reported, but ldapmodrdn will continue with modifies. The default is to exit after reporting an error. Specifies that referrals are not to be automatically followed. Specifies that strings supplied as input to the utility are represented in a local character set (charset), and must be converted to UTF-8. Use the -C charset option if the input string codepage is different from the job codepage value. Refer to the documentation for the ldap_set_iconv_local_charset() API to see supported charset values.
-r -n -v -c
-R -C charset
54
Sets the debug level to debuglevel. Use binddn to bind to the LDAP directory. binddn should be a string-represented DN. Use passwd as the password for simple authentication. Use mechanism specify the SASL mechanism to be used to bind to the server.The ldap_sasl_bind_s() API will be used. The -m parameter is ignored if -V 2 is set. If -m is not specified, simple authentication is used. Specify hopcount to set the maximum number of hops that the client library will take when chasing referrals. The default hopcount is 10. Specify an alternate host on which the LDAP server is running. Specify an alternate Transmission Control Protocol (TCP) port where the LDAP server is listening. The default LDAP port is 389. If not specified and -Z is specified, the default LDAP SSL port 636 is used. Use a secure SSL connection to communicate with the LDAP server. The -Z option is only supported by SSL-enabled versions of this tool. Specify the name of the SSL key database file. If the key database file is not in the current directory, specify the fully-qualified key database filename. If the utility cannot locate a key database, it will use a hard-codced set of default trusted certificate authority roots. The key database file typically contains one or more certificates of certification authorities (CAs) that are trusted by the client. These types of X.509 certificates are also known as trusted roots. This parameter effectively enables the -Z switch. Specify the key database password. This password is required to access the encrypted information in the key database file (including the private key). If a password stash file is associated with the key database file, the pasword is obtained from the stash file and this parameter is not required. This parameter is ignored if neither -Z nor -K are specified. Specify the label associated with the client certificate in the key database file. Note that if the LDAP server is configured to perform Server Authentication only, a client certificate is not required. If the LDAP server is configured to perform Client and Server Authentication, a client certificate is required. certificatename is not required if a default certificate/private key pair has been designated as the default. Similarly, certificatename is not required if there is a single certificate/private key pair in the designated key database file. This parameter is ignored if neither -Z nor -K are specified. Read the entry modification information from an LDIF file instead of from standard input or the command-line (by specifying dn and the new rdn). Standard input can also be supplied from a file (< file). Specify the distinguished name of an entry to rename and the new relative distinguished name for the entry.
-Z
-K keyfile
-P keyfilepw
-N certificatename
-f file
dn rdn
Example: ldapmodrdn
Assume that you have already created the text file /tmp/entrymods and that it has the following contents:
cn=Modify Me, o=University of Life, c=US cn=The New Me
Chapter 6. LDAP command line utilities
55
will change the RDN of the Modify Me entry from Modify Me to The New Me. The old cn, Modify Me will be removed.
Notes about using SSL with the LDAP command line utilities
To use the Secure Sockets Layer (SSL) features of the command line utilities, you must have installed Cryptographic Access Provider 40-bit (5769AC1), Cryptographic Access Provider 56-bit (5769AC2), or Cryptographic Access Provider 128-bit (5769AC3) on your AS/400. | | | | | | | | | | | | | | | | | | | Using Secure Sockets Layer (SSL) security with the LDAP directory server on page 40 discusses using SSL with the AS/400 Directory Services LDAP server, including managing and creating trusted Certificate Authorities with Digital Certificate Manager. Some LDAP servers that the client accesses use only server authentication. For these servers, you only need to define one or more trusted root certificates in the certificate store. With server authentication, the client can be assured that the target LDAP server has been issued a certificate by one of the trusted Certificate Authorities (CAs). In addition, all LDAP transactions that flow over the SSL connection with the server are encrypted. This includes the LDAP credentials that are supplied on application program interfaces (APIs) that are used to bind to the directory server. For example, if the LDAP server is using a high-assurance Verisign certificate, you should do the following: 1. Obtain a CA certificate from Verisign. 2. Use DCM to import it into your certificate store. 3. Use DCM to mark it as trusted. If the LDAP server is using a privately issued server certificate, the servers administrator can supply you with a copy of the servers certificate request file. Import the certificate request file into your certificate store and mark it as trusted. If you use the shell utilities to access LDAP servers that use both client authentication and server authentication, you must do the following: v Define one or more trusted root certificates in the system certificate store. This allows the client to be assured that the target LDAP server has been issued a certificate by one of the trusted CAs. In addition, all LDAP transactions that flow over the SSL connection with the server are encrypted. This includes the LDAP credentials that are supplied on application program interfaces (APIs) that are used to bind to the directory server. v Create a key pair and request a client certificate from a CA. After receiving the signed certificate from the CA, receive the certificate into the key ring file on the client.
| | | | | |
56
In these instances the QDIRSRV job log will refer you to the SQL server job logs. However, in some cases QDIRSRV may not contain this message and this referral, even if an SQL server is the cause of the problem. In these instances, it will help you to know what SQL servers should be started, and what AS/400 Directory Services uses them for. When the LDAP directory server starts normally, it generates messages similar to the following: Note: The messages and the number of SQL server jobs started may differ in any of the following cases: v You are starting your server for the first time. v Migration needs to occur. v Your server is using the change log.
Job . . : QDIRSRV User . . : QDIRSRV System: Number . . . : processing. processing. processing. processing. processing. WARMERS 174440
>> CALL PGM(QDIRSRV/QGLDSVR) Job 057448/QUSER/QSQSRVR used for Job 057340/QUSER/QSQSRVR used for Job 057448/QUSER/QSQSRVR used for Job 057166/QUSER/QSQSRVR used for Job 057279/QUSER/QSQSRVR used for Directory Services server started
SQL server mode SQL server mode SQL server mode SQL server mode SQL server mode successfully.
AS/400 Directory Services uses the first SQL server, 057448/QUSER/QSQSRVR, during LDAP server startup. AS/400 Directory Services may start additional SQL servers during LDAP server startup as necessary if you are starting your server for the first time, if migration needs to occur, or if your server is using the change log. After startup, these SQL servers are dropped.
57
| | | | | | | | | | | |
AS/400 Directory Services uses the next SQL server, 057340/QUSER/QSQSRVR, for LDAP adds, deletes, and modifies. Unless you have changed the number of connections in your configurations file, this server is fourth from the end of this list. AS/400 Directory Services uses the next SQL server, 057448/QUSER/QSQSRVR, only for replication. In the example above, the SQL server used during startup has been reclaimed for replication. AS/400 Directory Services uses the remaining SQL servers for LDAP searches. On the directory servers Database/Suffixes Properties page in Operations Navigator you specify the total number of SQL servers that it uses. In the example above there are two SQL servers used for LDAP searches, 057166/QUSER/QSQSRVR and 057279/QUSER/QSQSRVR.
Monitoring errors and access with the AS/400 Directory Services job log
Viewing the job log for your LDAP server can alert you to errors and help you to monitor server access. If your server is started, take these steps to view the QDIRSRV job log: 1. In Operations Navigator, expand Network. 2. Expand Servers. 3. Click TCP/IP. 4. Right-click Directory and select Server Jobs.. 5. From the File menu, choose Job Log. If your server is stopped, take these steps to view the QDIRSRV job log: 1. In Operations Navigator, expand Basic Operations. 2. Click Printer Output. 3. QDIRSRV appears in the User column of Operations Navigators right panel. To view the job log, double-click on Qpjoblog to the left of QDIRSRV in the same row. Note: Operations Navigator may be configured to show only spooled files. If QDIRSRV does not appear on the list, click Printer Output, then choose Include from the Options menu. Specify All in the User field, then click OK. Note: AS/400 Directory Services uses other system resources to perform some tasks. If an error occurs with one of those resources, the job log will indicate where to go for information. In some cases AS/400 Directory Services may not be able to determine where to look. In those cases, look in the Structured Query Language (SQL) servers job log to see if the problem was related to SQL servers.
58
Note: The explanation of these errors assumes that the client is communicating with an LDAP server on OS/400. A client communicating with a server on a different platform might get similar errors, but the causes and resolutions would most likely be different. Common messages include the following: v v v v v v ldap_search: Timelimit exceeded [Failing LDAP operation]: Operations error ldap_bind: No such object ldap_bind: Inappropriate authentication [Failing LDAP operation]: Insufficient access [AS/400 System]: A remote host refused an attempted connect operation on page 60 v [AS/400 System]: Failed to connect to ssl server on page 60
59
information about the error, look at the QDIRSRV job log as described in Basic troubleshooting procedure for AS/400 Directory Services on page 57.
60
Printed in U.S.A.