LDAP Server Installation

Source: Internet
Author: User
Tags install openssl ldap ldapsearch parse error openldap
Install with the source code as the root user
Because OpenLDAP requires the use of Berkeley dB to store data, you must first install the Berkeley dB 4.2.52 database.
1. Install Berkeley DB
To http://dev.sleepycat.com/downloa... ar.gz & prod = Core
Download db-4.2.52.tar.tar
1. decompress the installation package. Tar xvzf db-4.2.52.tar.tar
Generate a directory db-4.2.52.
2 Go To The db-4.2.52/build_unix directory and run the following command to configure the installation
../Dist/configure
Make
Make install
The above is the trilogy of Linux source code installation. By default, the software is installed in the/usr/local/berkeleydb.4.2 directory.
After the installation is complete, add the library path/usr/local/berkeleydb.4.2/lib of the software to/etc/lD. So. conf and execute ldconfig to make the configuration file take effect.
In this way, the library file can be found only when OpenLDAP is compiled. After the database is installed, install OpenLDAP.
LD. So. conf is the configuration file of the System Dynamic Link Library, which contains the directory of the dynamic link library that can be shared by Linux.
Name (except the system directory/lib,/usr/lib). Separate directories by spaces, colons, or commas. Average
The Linux release contains the/usr/x11r6/lib shared library, which is the dynamic link library of the X Window System.
Directory. Ldconfig is his management command.
2. Install prerequisite Software
Follow the installation instructions and readme in the official documentation to install the tool.
Go to the official website http://www.openldap.org/software/download/download openldap-stable-20060227.tgz
1. decompress the installation package. Generate a directory openldap-2.3.20.
2. install required software
1. Install OpenSSL to provide a secure link between the client and the server. If OpenSSL is not installed, the installed LDAP does not support the third version.
Download openssl-0.9.7i.tar.tar from http://www.openssl.org/news/
Unzip tar-xzvf openssl-0.9.7i.tar.tar
Go to the directory and read the install file, which contains the installation instructions.
./Config-D. You can use prefix to specify the installation path. By default, it is in/usr/local/SSL.
An error may occur without all. However, you can ignore
Make. Generate two. A files
Make test, used to test whether the build is successful
Make install
2. Install Kerberos
The OpenLDAP client and server support kderberos-based authentication service. Openldap supports using heimdal or MIT Kerberos v
SASL/gssapi authentication mechanism. If you want to use these authentication mechanisms, install heimdal or MIT Kerberos v. We have installed MIT Kerberos.
We downloaded the source code.
Unzip the gzip krb5-1.4.3-signed.tar first, then tar-xzfv krb5-1.4.3.tar.gz
Generate a folder krb5-1.4.3. Install as per DOC/install-guide.ps.
1 To krb5-1.4.3/src,
./Configure
Make this step build
Make install: Install
Make check. test whether the installation is successful. An error occurs. If the FQDN cannot be found, modify/etc/hosts.
Add the second item to the domain name.
The last three parts have warning information. I don't know if it will affect the subsequent work.
3. Install Cyrus SASL. OpenSSL and kderberos must be installed in advance.
Follow/doc/install. HTML Installation
./Configure
Make
Make install
Ln-S/usr/local/lib/sasl2/usr/lib/sasl2
It is possible that nothing to be done for "" can be ignored in make.
3. Install OpenLDAP
Go to the official website http://www.openldap.org/to download the latest website. I got a openldap-stable-20060227.tgz.
Decompress the tar-xvzf openldap-stable-20060227.tgz to generate a directory openldap-2.3.20
Enter this directory,
A./configure
Error message: Configure: Error: bdb/HDB: berkeleydb version incompatible
Preparations: Add/usr/local/berkeleydb.4.2/include to LD_LIBRARY_PATH,
Set the environment variable: ENV cppflags =/usr/local/berkeleydb.4.2/include ldflags =/usr/local/berkeleydb.4.2/lib
Or that error. The berkerly DB version does not match. It may be because the system has already installed this
Database, it should be uninstalled, but I don't know where it is, so I will put/usr/local/berkeleydb.4.2/include
Copy all files under/usr/include, and copy all files under/usr/local/berkeleydb.4.2/lib to/usr/lib.
./Configure -- enable-ldbm
Easy to use
B Make depend
To build Dependencies
C make: Build the software
Error message:/usr/include/OpenSSL/kssl. h: 134: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 147: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 148: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 149: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 149: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 150: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 151: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 153: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 155: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 157: Parse error before '*' token
/Usr/include/OpenSSL/kssl. h: 165: Parse error before '*' token
In file encoded ded from TLS. C: 41:
/Usr/include/OpenSSL/SSL. h: 909: Parse error before "kssl_ctx"
/Usr/include/OpenSSL/SSL. h: 931: Parse error before '}' token
Make [2]: *** [TLS. Lo] Error 1
Make [2]: Leaving directory/home/ldap/openldap-2.3.20/libraries/libldap'
Make [1]: *** [All-common] Error 1
Make [1]: Leaving directory '/home/ldap/openldap-2.3.20/libraries'
Make: *** [All-common] Error 1
Copy include/OpenSSL in/usr/lcoal/SSL to/usr/include/OpenSSL
Easy to use
D Make Test. Test whether the software is correctly installed
Running defines. Sh
Starting slapd on TCP/IP Port 9011...
Using ldapsearch to retrieve the root DSE...
Waiting 5 seconds for slapd to start...
Waiting 5 seconds for slapd to start...
Waiting 5 seconds for slapd to start...
Waiting 5 seconds for slapd to start...
Waiting 5 seconds for slapd to start...
Waiting 5 seconds for slapd to start...
./Scripts/test000-rootdse: Line 66: Kill: (11146)-No that process
Ldap_bind: Can't contact LDAP Server (-1)
>>>>> Test failed
>>>>>./Scripts/test000-rootdse failed (Exit 1)
Make [2]: *** [bdb-Yes] Error 1
Make [2]: Leaving directory '/home/ldap/openldap-2.3.20/tests'
Make [1]: *** [test] Error 2
Cause of error: Because SASL is installed on the operating system by default and is in version 2.1.10, we
Delete all lib * SASL * So files under/usr/lib, reinstall Cyrus SASL library, and install OpenLDAP again
E su root-C 'make install' install software
F test, CD/usr/local/libexec/
./Slapd-D 1 (some information will appear on the screen, and slapd start will succeed.
CD ../bin
Ldapsearch-X-B '-S base' (objectclass = *) 'namingcontexts
If: DN:
Namingcontexts: DC = example, Dc = com.
The installation is successful.
3. Configure slapd and slurpd.
There are two configuration file types for configuring slapd: The old conf type and the new. D type,
However, if you want to use slurpd, you must use the old one.
Modify the slapd. conf file in/usr/local/etc/OpenLDAP.
Configuration includes three parts: global configuration, backend configuration, and database configuration.
1. Global Configuration;
Access to <What> [by <who> <accesslevel> <control>] +
Access Control of attributes or entities. If this option is not available, it can be accessed by anyone by default.
Attributetype <rfc2252 attribute type description>
Define attribute type
Idletimeout <integer>
Include <FILENAME>
It is usually a schema file used to include other configuration files.
Loglevel <integer>
Log Information
Table 5.1: Debugging levels level description
-1 enable all debugging
0 No debugging
1 trace function CILS
2 debug Packet Handling
4 heavy trace debugging
8 connection management
16 print out packets sent and received
32 search filter processing
64 Configuration File Processing
128 Access Control List Processing
256 stats log connections/Operations/results
512 stats log entries sent
1024 print communication with Shell backends
2048 print entry parsing debugging
Objectclass <rfc2252 object class description>
Referral <URI>
Sizelimit <integer>
Returns the maximum value.
Timelimit <integer>
2 General backend ctictives
Backend <type>
Table 5.2: Database backends types description
Bdb Berkeley dB transactional backend
Dnssrv dns srv backend
HDB hierarchical variant of bdb backend
LDAP Lightweight Directory Access Protocol (proxy) backend
Ldbm lightweight dBm backend
Meta meta directory backend
Monitor backend
Passwd provides read-only access to passwd (5)
Perl programmable backend
Shell shell (extern program) backend
SQL programmable backend
3 General Database directives
Database <type> shocould Be one of the supported backend types listed in Table 5.2.
Readonly {on | off}
Replica uri = LDAP [s]: // [Bindmethod = {simple | SASL}]
["Binddn = <DN>"]
[Saslmech = <mech>]
[Authcid = <identity>]
[Authzid = <identity>]
[Credentials = <password>]
Used to configure the slave during dual-Machine backup
Replogfile <FILENAME>
Rootdn <DN>
Rootpw <password>
Suffix <DN suffix>
Syncrepl
Syncrepl rid = <replica ID>
Provider = LDAP [s]: // [Type = refreshonly | refreshandpersist]
[Interval = DD: hh: mm: SS]
[Retry = [<Retry Interval> <# of retries>] +]
[Searchbase = <base DN>]
[Filter = <filter STR>]
[Scope = sub | one | base]
[Attrs = <ATTR list>]
[Attrsonly]
[Sizelimit = <limit>]
[Timelimit = <limit>]
[Schemachecking = on | Off]
[Bindmethod = simple | SASL]
[Binddn = <DN>]
[Saslmech = <mech>]
[Authcid = <identity>]
[Authzid = <identity>]
[Credentials = <passwd>]
[Realm = <realm>]
[Secprops = <Properties>]
Updatedn <DN>
This directive is only applicable in a slave slapd.
Updateref <URL>
This directive is only applicable in a slave slapd. it
Specifies the URL to return to clients which submit update requests
Upon the replica. If specified multiple times, each URL is provided.
Example:
Updateref LDAP: // master.example.net
4 bdb and HDB database ctictives
Directory <directory>
This directive specifies the directory where the bdb files containing the database and associated indices live.
Default:
Directory/usr/local/var/openldap-Data
5. Index {<attrlist> | default} [Pres, EQ, approx, sub, none]
This directive specifies the indices to maintain for
Given attribute. If only an <attrlist> is given, the default
Indices are maintained.
Example:
Index default Pres, EQ
Index uid
Index CN, Sn Pres, EQ, sub
Index objectclass EQ
The first line sets the default set of indices to maintain
Present and capacity ity. The second line causes the default (Pres, eq) Set
Of indices to be maintained for the UID attribute type. The third line
Causes present, equality, and substring indices to be maintained for CN
And Sn attribute types. The fourth line causes an equality index
The objectclass attribute type.
By default, no indices are maintained. It is generally
Advised that minimally an equality index upon objectclass be maintained.
Index objectclass EQ
6 mode <integer>
This directive specifies the file protection mode that newly created database index files shold have.
Default:
Mode 0600
Example 4:
Finally, our slapd configuration file is:
######################################## ########
######################################## ########
######################################## ###############################
# Global ctictives
######################################## ###############################
Loglevel 256
#
# See slapd. conf (5) for details on configuration options.
# This file shoshould not be world readable.
#
Include/usr/local/etc/OpenLDAP/Schema/CORE. Schema
Include/usr/local/etc/OpenLDAP/Schema/CORBA. Schema
Include/usr/local/etc/OpenLDAP/Schema/cosine. Schema
Include/usr/local/etc/OpenLDAP/Schema/inetorgperson. Schema
Include/usr/local/etc/OpenLDAP/Schema/Misc. Schema
Include/usr/local/etc/OpenLDAP/Schema/OpenLDAP. Schema
Include/usr/local/etc/OpenLDAP/Schema/NIS. Schema
Include/usr/local/etc/OpenLDAP/Schema/samba. Schema
# Define global ACLs to disable default read access.
# Do not enable referrals until after you have a working directory
# Service and an understanding of referrals.
# Referral LDAP: // root.openldap.org
Pidfile/usr/local/var/run/slapd. PID
Argsfile/usr/local/var/run/slapd. ARGs
######################################## ###############################
# Backend directives
######################################## ###############################
# Load dynamic backend modules:
# Modulepath/usr/local/libexec/OpenLDAP
# Moduleload back_bdb.la
# Moduleload back_ldap.la
# Moduleload back_ldbm.la
# Moduleload back_passwd.la
# Moduleload back_shell.la
Backend bdb
# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# Security SSF = 1 update_ssf = 112 Simple_Bind = 64
# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub) entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow Anonymous Users to authenticate
# Directives needed to implement policy:
# Access to DN. base = "" by * read
# Access to DN. base = "cn = subschema" by * read
# Access *
# By self write
# By users read
# By Anonymous auth
#
# If no access controls are present, the Default policy
# Allows anyone and everyone to read anything but restricts
# Updates to rootdn. (e.g., "Access to * by * read ")
#
# Rootdn can always read and write everything!
######################################## ###############################
# Bdb database Definitions
######################################## ###############################
# Database ctictives
######################################## ###############################
Database bdb
Suffix "DC = mlx, Dc = jlu"
Rootdn "cn = manager, Dc = mlx, Dc = jlu"
# Cleartext passwords, especially for the rootdn, shocould
# Be avoid. See slappasswd (8) and slapd. conf (5) for details.
# Use of strong authentication encouraged.
Rootpw secret
# The database directory must exist prior to running slapd and
# Shoshould only be accessible by the slapd and slap tools.
# Mode 700 recommended.
Directory/usr/local/var/openldap-Data
# Indices to maintain
Index objectclass EQ
######################################## #################################
######################################## ##################################

Modify/etc/hosts
The content is:
202.198.31.63 mlx. jlu mlx. jlu mlx
5. Run slapd
1. Configure slapd
Run: CD/usr/local/libexec
./Slapd
Syntax Error for testing config: slapdtest
Restart:./slapd restart
If the operation is successful, the shell status will be returned.
As long as you modify slapd. conf, you must restart it:
Slapd restart
6. Data Input
Two methods: 1. Manual Input
2. Use the ldif File
1 manual input:
Step 1: Create DN
Ldapadd-X-D 'cn = manager, Dc = mlx, Dc = jlu'-W
Next, jump to the next line, but do not exit, and then enter:
DN: DC = mlx, Dc = jlu
Objectclass: dcobject
Objectclass: Organization
DC: mlx
O: Computer
Description: D Corporation
Press enter, CTRL + d save disk
Then ldapsearch-X-B 'Dc = mlx, Dc = jlu' to view the input information
Creates a computer organization.
Step 2: Create rdn
Ldapadd-X-D 'cn = manager, Dc = mlx, Dc = jlu'-W
DN: uid = QQ, Dc = mlx, Dc = jlu
Objectclass: person
Objectclass: organizationalperson
Objectclass: inetorgperson
UID: QQ
CN: QQ
SN: QQ
Telephonenumber: 138888888
Description: OpenLDAP Test
Telexnumber: tex-8888888
Street: My Street
Postofficebox: postofficebox
Displayname: qqdisplay
Homephone: home1111111
Mobile: mobile99999
Mail: qq@qq.com
CTRL + D, save disk
Ldapsearch-X-B 'Dc = mlx, Dc = jlu' can be used to query
Ldapsearch-X-B 'Dc = mlx, Dc = jlu'
-Option B is used to set the directory start point. If the base configuration parameters of the client are set, this option is not required.
2. Use the ldif file for input.
A. Create the ldif file test. ldif.
# Organization for example Corporation
DN: DC = mlx, Dc = jlu
Objectclass: dcobject
Objectclass: Organization
DC: mlx
O: Example Corporation
Description: The Example Corporation

# Organizational role for Directory Manager
DN: Cn = manager, Dc = mlx, Dc = jlu
Objectclass: organizationalrole
CN: Manager
Description: Directory Manager
B. Add ldapadd-F test. ldif-X-d "cn = manager, Dc = mlx, Dc = jlu"-W secret
C error message:
Invalid dn syntax (34)
Additional Info: Invalid DN
Later, I added it directly to the backend.
Invalid certificate: it may be that option D is incorrect or the password is incorrect.
E. The root entry is added to the table, and an auxiliary node is created below.
DN: ou = Mail, Dc = mlx, Dc = jlu
Objectclass: organizationalunit
Ou: Mail
Description: mail directory
Then: ldapadd-F test_ B .ldif-X-d "cn = manager, O = computer, Dc = mlx, Dc = jlu"-W
7. Configure LDAP
Configuration does not matter.
Base Dc = mlx, Dc = jlu
8.
Before inputting data to LDAP, you must first create a directory structure and then enter information.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.