[英]Php Certificate SSL for OpenLdap configuration
我在本地使用LinuxMint工作,並在virtualbox中使用openldap安裝了UbuntuServer。 現在,我按照以下指南進行配置: http://help.ubuntu-it.org/12.04/server/serverguide/it/ubuntu-1204-server.pdf TLS / SSL身份驗證。 我已經安裝在客戶端(linuxmint)Xampp中,並使用以下命令配置/etc/ldap/ldap.conf:
TLS_CACERT /etc/ssl/certs/192.168.1.46_slapd_cert.pem
TLS_REQCERT never
我嘗試用php函數連接:
<?php
// This code goes directly to the 636 SSL port
$ldaphost = "ldaps://192.168.1.46";
$ldapUsername = "cn=admin,dc=company,dc=com";
$ldapPassword = "secret";
$ds = ldap_connect($ldaphost);
if(!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)){
print "Could not set LDAPv3\r\n";
}
else {
// now we need to bind to the ldap server
$bth = ldap_bind($ds, $ldapUsername, $ldapPassword) or die("\r\nCould not connect to LDAP server\r\n");
}
?>
但不行..
如果我在終端中嘗試:
ldapsearch -x -H ldaps://192.168.1.46 -b "cn=company,cn=com"
有用!! 但是通過php為什么呢?.. i嘗試在/ opt / lampp / etc / openldap中配置ldap.conf但沒有結果。
我在centos中使用openldap一個apache / php。 也許是相似的。
ln -s /etc/ssl/certs/192.168.1.46_slapd_cert.pem `openssl x509 -hash -noout -in /etc/ssl/certs/192.168.1.46_slapd_cert.pem`.0
在我的Ubuntu (無ldapsupport)上,存在函數c_rehash 。 如果我在那里安裝了撤消清單,則必須以這種方式重新散列所有撤消清單:
cd /etc/ssl/certs/
c_rehash /etc/ssl/certs/
也許它為您的CA創建了正確的哈希。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.