(这是ldap_modify的后续操作:在更改密码时访问不足(50),因为我们在诊断过程中发现了一个单独的问题。)
在修改cn = config LDAP数据库之前,我试图访问它。 但是,我得到一个ldap_sasl_interactive_bind_s: Can't contact LDAP server (-1)错误。
# ldapsearch -H ldapi:/// -Y EXTERNAL -b 'cn=config' -d1 ldap_url_parse_ext(ldapi:///) ldap_create ldap_url_parse_ext(ldapi:///??base) ldap_sasl_interactive_bind: user selected: EXTERNAL ldap_int_sasl_bind: EXTERNAL ldap_new_connection 1 1 0 ldap_int_open_connection ldap_connect_to_path ldap_new_socket: 3 ldap_connect_to_path: Trying /var/run/ldapi ldap_connect_timeout: fd: 3 tm: -1 async: 0 ldap_ndelay_on: 3 ldap_close_socket: 3 ldap_msgfree ldap_err2string ldap_sasl_interactive_bind_s: Can't contact LDAP server (-1)
ldapi:// (但不是ldapi:/// ?)在/etc/openldap/ldap.conf定义:
# # LDAP Defaults # # See ldap.conf(5) for details # This file should be world readable but not world writable. BASE dc=my_domain,dc=com #URI ldap://ldap.example.com ldap://ldap-master.example.com:666 URI ldap:// ldapi:// ldaps:// #SIZELIMIT 12 #TIMELIMIT 15 #DEREF never TLS_CACERTDIR /etc/openldap/certs
我得到相同的ldap_sasl_interactive_bind_s:停止防火墙( service iptables stop )后,无法联系LDAP服务器(-1)错误,所以防火墙不是问题。
ldapi的套接字文件看起来没有定义:
ls:不能访问/ var / run / ldapi:没有这样的文件或目录
以下是/ var / run中的其他文件:
[root@my_hostname ~]# ls -la /var/run/ total 128 drwxr-xr-x. 19 root root 4096 Oct 30 13:13 . drwxr-xr-x. 20 root root 4096 Oct 20 09:23 .. drwxr-xr-x. 2 root root 4096 Oct 23 23:11 abrt -rw-r--r-- 1 root root 5 Oct 23 23:11 abrtd.pid -rw-r--r-- 1 root root 5 Oct 23 23:11 atd.pid -rw-r--r-- 1 root root 4 Oct 23 23:11 auditd.pid drwxr-xr-x. 2 root root 4096 Aug 18 09:26 console drwxr-xr-x. 2 root root 4096 Nov 10 2010 ConsoleKit -rw-r--r-- 1 root root 5 Oct 23 23:11 crond.pid ---------- 1 root root 0 Oct 23 23:11 cron.reboot drwxr-xr-x. 2 root root 4096 Oct 23 23:11 dbus drwxr-xr-x 2 root root 4096 Oct 23 23:11 fail2ban drwxr-xr-x. 2 root root 4096 Aug 18 09:26 faillock drwx------. 2 haldaemon haldaemon 4096 Oct 15 2014 hald -rw-r--r-- 1 root root 5 Oct 23 23:11 haldaemon.pid -rw-r--r-- 1 root root 5 Oct 23 23:11 irqbalance.pid drwx------. 2 root root 4096 Sep 22 09:15 lvm drwx------. 2 root root 4096 Jul 24 03:23 mdadm -rw-r--r-- 1 root root 5 Oct 23 23:11 messagebus.pid drwxrwxr-x. 2 root root 4096 Sep 22 11:47 netreport drwxr-xr-x 2 ldap ldap 4096 Oct 30 13:13 openldap drwxr-xr-x. 2 root root 4096 Aug 11 2014 plymouth drwxr-xr-x. 4 root root 4096 Oct 15 2014 pm-utils drwxr-xr-x 2 root root 4096 Oct 23 23:11 portreserve drwxr-xr-x. 2 root root 4096 Mar 25 2015 saslauthd drwxr-xr-x. 2 root root 4096 Aug 18 09:26 sepermit drwxr-xr-x. 2 root root 4096 Oct 15 2014 setrans -rw-r--r-- 2 ldap ldap 6 Oct 30 13:13 slapd.pid -rw-r--r-- 1 root root 5 Oct 23 23:11 sshd.pid -rw------- 1 root root 5 Oct 23 23:11 syslogd.pid -rw-rw-r-- 1 root utmp 5376 Nov 3 11:16 utmp -rw-r--r-- 1 root root 5 Oct 23 23:11 xe-daemon.pid [root@my_hostname ~]# ls -la /var/run/openldap/ total 16 drwxr-xr-x 2 ldap ldap 4096 Oct 30 13:13 . drwxr-xr-x. 19 root root 4096 Oct 30 13:13 .. -rw-r--r-- 1 ldap ldap 39 Oct 30 13:13 slapd.args -rw-r--r-- 2 ldap ldap 6 Oct 30 13:13 slapd.pid
slapd看起来像是用ldaps开始的,但不是ldapi:
# ps auxf | grep slapd root 28776 0.0 0.0 103308 836 pts/0 S+ 11:23 0:00 \_ grep slapd ldap 29398 0.0 1.0 370152 20348 ? Ssl Oct30 0:00 /usr/sbin/slapd -h ldaps:/// -u ldap
只提及ldaps:在/ etc / openldap中也提到了ldapi:
# grep -R 'ldaps:' /etc/openldap/ /etc/openldap/ldap.conf:URI ldap:// ldapi:// ldaps://
我如何确保ldapi:///可用?
根据@ 84104的评论,/ /etc/openldap/ldap.conf是客户端configuration。
CentOS6上的服务器configuration位于/etc/sysconfig/ldap (不是slapd )。 我确定它包含以下行:
# Run slapd with -h "... ldapi:/// ..." # yes/no, default: yes SLAPD_LDAPI=yes
然后重新启动LDAP服务器:
service slapd restart
在此之后, ldapi:///可用,并且ldapsearch -H ldapi:/// -Y EXTERNAL -b 'cn=config'成功。