douren5898 2017-04-26 18:56 采纳率: 100%
浏览 82
已采纳

PHP - 在ldapadd上获取错误代码13

I have a .ldif file and want to import it using php script to my ldap. So, i'm using that code:

$comm = "ldapadd -h 'localhost' -p 389 -D 'cn=admin,dc=example,dc=com' -w 'password' -f /var/www/html/test/ldap.ldif";
system($comm,$return);
echo $return;

I'm always getting error code 13 which is:

LDAP_CONFIDENTIALITY_REQUIRED: Indicates that the session is not protected by a protocol such as Transport Layer Security (TLS), which provides session confidentiality.

Looking at ldapadd sintax found these options

-W: Wallet location for one- or two-way SSL authentication

-P Wallet password

-U SSL authentication mode: 1 for no authentication; 2 for one-way authentication; 3 for two-way authentication

But I don't know how or when I have to use them. My .ldif file contain a lot of new entrys and through php code I couldn't use the:

$info["dn"] = $test;

Always getting errors about that $info["dn"] syntax, so then I gave up and start trying with terminal command.

Would really appreciate some help about it and sorry about my english. Thank you.

  • 写回答

1条回答 默认 最新

  • dongwen7380 2017-05-08 16:13
    关注

    A friend of mine found the answer. About the code 13 error was missing an option at the end of the command which allows the TLS connection, so, the correct command line is:

    ldapadd -h 'localhost' -p 389 -D 'cn=admin,dc=example,dc=com' -w 'password' -f /var/www/html/test/ldap.ldif -Z
    

    So, the option -Z or -ZZ at the end enables the TLS and the error is gone, so it's working the input on ldap with my .ldif file

    Thank you all.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何将下列的“无限压缩存储器”设计出来
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭