简体   繁体   English

用于OpenLdap配置的PHP证书SSL

[英]Php Certificate SSL for OpenLdap configuration

i work in local with LinuxMint and have in virtualbox installed UbuntuServer with openldap. 我在本地使用LinuxMint工作,并在virtualbox中使用openldap安装了UbuntuServer。 Now i configure follow this guide http://help.ubuntu-it.org/12.04/server/serverguide/it/ubuntu-1204-server.pdf TLS/SSL auth. 现在,我按照以下指南进行配置: http://help.ubuntu-it.org/12.04/server/serverguide/it/ubuntu-1204-server.pdf TLS / SSL身份验证。 I have installed in the client (linuxmint) Xampp and i configure /etc/ldap/ldap.conf with: 我已经安装在客户端(linuxmint)Xampp中,并使用以下命令配置/etc/ldap/ldap.conf:

TLS_CACERT      /etc/ssl/certs/192.168.1.46_slapd_cert.pem
TLS_REQCERT never

I try to connect with php function: 我尝试用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");
}
?>

but not works.. 但不行..

if i try in my terminal: 如果我在终端中尝试:

ldapsearch -x -H ldaps://192.168.1.46 -b "cn=company,cn=com"

it works!! 有用!! but via php why?..i try to configure the ldap.conf in /opt/lampp/etc/openldap but no result.. 但是通过php为什么呢?.. i尝试在/ opt / lampp / etc / openldap中配置ldap.conf但没有结果。

I work with openldap an apache/php in centos . 我在centos中使用openldap一个apache / php。 Maybe it's similar. 也许是相似的。

  1. My ldap.conf is in /etc/ldap.conf 我的ldap.conf/etc/ldap.conf中
  2. I configured *TLS_REQCERT allow* 我配置了* TLS_REQCERT允许*
  3. I have to generate a hash of the Certificate as symlink in the same Directory: 我必须在同一目录中生成证书的哈希作为符号链接:
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

On my Ubuntu (without ldapsupport) exists the function c_rehash . 在我的Ubuntu (无ldapsupport)上,存在函数c_rehash If I install a revoke-list there, i have to rehash all revokelists with this function in this way: 如果我在那里安装了撤消清单,则必须以这种方式重新散列所有撤消清单:

cd /etc/ssl/certs/
c_rehash /etc/ssl/certs/

Maybe it creates the correct hashes for your CAs. 也许它为您的CA创建了正确的哈希。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM