02-OpenLDAP配置

OpenLDAP配置

在OpenLDAP 2.4版本中,配置OpenLDAP的方法有两种:一种通过修改配置文件实现配置,另一种通过修改数据库的形式完成配置。

通过配置数据库完成各种配置,属于动态配置且不需要重新启动slapd进程服务。此配置数据库(cn=config)包含一个基于文本的集合LDIF文件(位于/etc/openldap/slapd.d目录下)。当前仍然可以使用传统的配置文件(slapd.conf)方式进行配置,通过配置文件来实现slapd的配置方式。slapd.conf可以通过编辑器进行配置,但cn=config不建议直接编辑修改,而是采用ldap命令进行修改。

openldap相关信息

配置文件路径包含以下几个。

  • /etc/openldap/slapd.conf :openldap主配置文件,记录根域名称、管理员名称、密码、日志、权限等相关信息。
  • /var/lib/ldap/* :openldap数据文件存储位置,可以根据需求进行调准。但为了保证数据的安全。建议放到存储设备或独立的分区上 。
  • /etc/openldap/slapd.d/*
  • /usr/share/openldap-servers/slapd.conf.obsolete :模板配置文件
  • /usr/share/openldap-servers/DB_CONFIG.example :模板数据库配置文件schema路径
  • /etc/openldap/schema/* :openldap schema规范存放位置

OpenLDAP监听的端口有以下两个。

  • 监听端口:389 明文数据传输
  • 监听端口:636 密文数据传输

slapd.conf配置文件参数

OpenLDAP主配置文件为/etc/openldap/slapd.conf。此文件默认不存在,需要复制安装OpenLDAP软件包安装所产生的配置文件模版并重命名它为slapd.conf文件,这同样可以通过修改数据库文件实现配置。

  • include /etc/openldap/schema/corba.schema :include行代表当前OpenLDAP服务包含的schema文件。schema是整个OpenLDAP目录树的标准规范,标识数据和类型的关系。

  • allow bind_v2 :OpenLDAP服务允许连接的客户端版本

  • pidfile /var/run/openldap/slapd.pid :OpenLDAP进程启动时,PID文件存放的路径

  • argsfile /var/run/openldap/slapd.args :OpenLDAP参数文件存放的路径

  • moduleload ppolicy.la :OpenLDAP指定需要加载额外的模块

  • modulepath /usr/lib/openldap :32bit的模块文件路径
    modulepath /usr/lib64/openldap :64bit的模块文件路径

  • OpenLDAP加密传输所加载的配置文件

    • TLSCACertificatePath /etc/openldap/certs
    • TLSCertificateFile ""OpenLDAP Server""
    • TLSCertificateKeyFile /etc/openldap/certs/password
  • database bdb :OpenLDAP数据库类型

  • suffix "dc=example,dc=com" :指定OpenLDAP服务域名(DN)

  • rootdn "cn=Manager,dc=example,dc=com" :指定OpenLDAP服务管理员信息

  • 密码添加

    • 明文密码添加:root password
    • 密文添加,建议使用:rootpw {SSHA}dXWd........XW
  • directory /var/lib/ldap :指定OpenLDAP数据库文件的存放目录

  • OpenLDAP索引:index objectClass eq,pres

  • loglevel -1 :OpenLDAP日志配置

原文地址:https://www.cnblogs.com/cishi/p/9081754.html