如何通过代理ldap连接到ldap? [英] How to connect to a ldap through a proxy ldap?

查看:132
本文介绍了如何通过代理ldap连接到ldap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小问题.在工作中,我们不久将使用代理ldap连接到我们的ldap.

I've a little issue. At work, we will shortly use a proxy ldap to connect to our ldap.

但是,我的perl脚本曾经直接连接到ldap,但是我找不到通过ldap代理连接到ldap的正确方法.

However, my perl script used to connect directly to the ldap, and I can't find the right way to connect to the ldap through the ldap proxy.

ldap小组告诉我只需通过代理的网址更改"my.local.ldap.org".

The ldap team told me to simply change "my.local.ldap.org" by the url of the proxy.

但是当我这样做时,除了错误无法在myscript.pl第X行,< DATA>第403行与LDAP服务器联系"之外,我什么也没回来.

But when I do that, I get nothing back except the error "Can't contact LDAP server at myscript.pl line X, < DATA> line 403."

由于我对Perl还是很陌生,所以我不知所措.

I'm at my wits end, since I'm pretty new to perl.

我如何通过ldap代理连接到我的ldap并获取我的数据?

How can I connect to my ldap throught the ldap proxy and get my data ?

有我的perl代码:

#!/usr/bin/perl

use warnings;
use strict;
use Net::LDAP;
use Net::SMTP;
use MIME::Lite;
use Getopt::Std;

connect_ldap();

sub connect_ldap {

    my @attributs = qw(uid subsidiary preferredLanguage);

    my $ldap = Net::LDAP->new(
        "my.local.ldap.org",
        port => 389
    ) or die open (STDERR, ">&SDTOUT");

    my $mesg = $ldap->bind (
        "cn=app_readonly,ou=account,ou=security,o=oubase",
        password => "mypassword"
    );

    $mesg = $ldap->search(
        base   => "o=oubase",
        scope => "sub",
        filter => "(&(objectclass=inetOrgPerson)(|(subsidiary=sub1)(subsidiary=sub2))(role=id=app_access,id=APP,*))",
        attrs => [ @attributs ]
    );

 printf "COUNT : %s\n", $mesg->count;
foreach my $entry ($mesg->entries) {
$entry->dump;
 }
print "==========================================\n";

        $mesg = $ldap->unbind;
        $ldap->unbind;

    }

推荐答案

通常,与连接到代理相比,通过代理连接(假设它是 LDAP 代理)应该没有任何区别.只要正确设置了LDAP代理,就可以直接使用LDAP服务器.您是否尝试过远程登录到代理的主机/端口以查看是否获得正确的连接信息?

In general, there should not be any difference connecting through a proxy (provided that it is an LDAP proxy) compared to connecting to an LDAP server directly as long as the LDAP proxy is setup properly. Did you try telnetting to the host/port of the proxy to see if you got the correct connection information?

这篇关于如何通过代理ldap连接到ldap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆