I'm trying to configure OpenLDAP client on SLED10 host and faced with some problems. I've specified URI field in config like URI ldap://172.16.8.103:7323
but ldapsearch bails that it Can't contact LDAP server
. With ldapsearch -H ldap://172.168.8.103:7323
it works fine. Setting
host 172.16.8.103
开发者_运维技巧port 7323
instead of URI returns the same error message. Moreover, tcpdump
tells that no LDAP requests are performed at all in this case. Other settings in config like BASE work fine. What can cause such problem and how to solve it?
Clearly ldapsearch isn't finding the ldap.conf file.
To know, what configuration file does ldapsearch consults, you may use one of this commands:
1) strings $(ldd $(readlink -e $(which ldapsearch)) | awk -F'(=>|[[:space:]]\\()' '$2 ~ /ldap/ {print $2}') | fgrep .conf
2) strace ldapsearch -x 2>&1 | fgrep .conf | grep -v '\(resolv\|nsswitch\|host\).conf'
In some unlikely cases you may need to install binutils package (by default it is installed on most distributives) or strace package first to run appropriate commands.
And yes you can use ".ldaprc" in your home directory and forget about searching of theoretically unpredictable system-wide path to ldap.conf at all.
I'm not sure that the version of openldap in SLES 10 supports this, but in SLES 11 you may specify the config file thru a env variable.
# LDAPCONF=/etc/ldap.conf ldapsearch
精彩评论