无法启动 OpenLDAP 服务器守护进程

无法启动 OpenLDAP 服务器守护进程

使用 Centos 7 并按照以下步骤进行 openldap 服务器配置。我面临这个问题

[root@linux1 ~]# systemctl restart slapd
Job for slapd.service failed because the control process exited with error code. See "systemctl status slapd.service" and "journalctl -xe" for details.
[root@linux1 ~]#
[root@linux1 ~]#
[root@linux1 ~]#
[root@linux1 ~]# systemctl status slapd
● slapd.service - OpenLDAP Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/slapd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2018-05-13 03:21:41 EDT; 7min ago
     Docs: man:slapd
           man:slapd-config
           man:slapd-hdb
           man:slapd-mdb
           file:///usr/share/doc/openldap-servers/guide.html
  Process: 2781 ExecStart=/usr/sbin/slapd -u ldap -h ${SLAPD_URLS} $SLAPD_OPTIONS (code=exited, status=1/FAILURE)
  Process: 2767 ExecStartPre=/usr/libexec/openldap/check-config.sh (code=exited, status=0/SUCCESS)

May 13 03:21:40 linux1.learnitguide.net runuser[2770]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
May 13 03:21:40 linux1.learnitguide.net slapd[2781]: @(#) $OpenLDAP: slapd 2.4.44 (Apr 12 2018 19:17:38) $
                                                             [email protected]:/builddir/build/BUILD/openldap-2.4.44/openldap-2.4.44/servers/slapd
May 13 03:21:40 linux1.learnitguide.net slapd[2781]: ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={1}monitor.ldif"
May 13 03:21:40 linux1.learnitguide.net slapd[2781]: ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif"
May 13 03:21:41 linux1.learnitguide.net slapd[2781]: tlsmc_cert_create_hash_symlink: ERROR: OS error: Permission denied
May 13 03:21:41 linux1.learnitguide.net slapd[2781]: Could not get the realpath: No such file or directory
May 13 03:21:41 linux1.learnitguide.net systemd[1]: slapd.service: control process exited, code=exited status=1
May 13 03:21:41 linux1.learnitguide.net systemd[1]: Failed to start OpenLDAP Server Daemon.
May 13 03:21:41 linux1.learnitguide.net systemd[1]: Unit slapd.service entered failed state.
May 13 03:21:41 linux1.learnitguide.net systemd[1]: slapd.service failed.
[root@linux1 ~]#

答案1

我没有“tlsmc_cert_create_hash_symlink:错误:操作系统错误:权限被拒绝”问题,但有相同的错误消息“无法获取真实路径:没有这样的文件或目录”。

这会影响 Centos7 的最新 Openldap 版本

rpm -qa | grep openldap                                                                                
    openldap-clients-2.4.44-13.el7.x86_64                                                                                                  
    openldap-servers-2.4.44-13.el7.x86_64                                                                     
    openldap-2.4.44-13.el7.x86_64

ls /var/lib/ldap/

供您参考,此版本的 /var/lib/ldap 中的 DB_CONFIG 似乎是空的。我无法找到原因。创建自己的 DB_CONFIG 并更改 ldap.conf 并没有解决问题。


所以肮脏的解决方案:降级 OpenLdap。

mkdir /tmp/openldap/
cd /tmp/openldap/
wget https://rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/openldap-clients-2.4.44-5.el7.x86_64.rpm

wget https://www.rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/openldap-2.4.44-5.el7.x86_64.rpm

wget https://rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/openldap-servers-2.4.44-5.el7.x86_64.rpm

yum downgrade ./openldap-*
systemctl start slapd.service

抱歉,我没有测试其他版本,来源有问题。但 LDAP 随即启动。

答案2

我们遇到了同样的问题,我们只是 yum -y 升级,之后 ldap 工作正常。

答案3

如果你是 CentOS 7 只需输入这些命令,一切都会好起来的

    yum update
    cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
    chown ldap:ldap /var/lib/ldap/*

答案4

从中获取提示如何指示 yum 安装特定版本我做了以下事情:

yum --showduplicates list openldap-servers

我得到以下信息:

openldap-servers.x86_64                                           2.4.40-9.el7_2                                            ol7_latest 
openldap-servers.x86_64    2.4.40-13.el7      ol7_latest 
openldap-servers.x86_64    2.4.44-5.el7       ol7_latest  -> Last run version
openldap-servers.x86_64    2.4.44-13.el7      ol7_latest  -> Works
openldap-servers.x86_64    2.4.44-15.el7_5    ol7_latest  -> DOES NOT WORK

我使用旧版本的 openldap-servers 使用:

yum install openldap-servers-2.4.44-13.el7

并且能够避免这个问题。

相关内容