Sue D. Nymme has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to bind to a Windows Active Directory LDAP server on the domain controller, via Net::LDAP. Everything works fine, I can retrieve and update values, etc.
But is there a way to invoke the Net::LDAP bind() method without supplying the user's password? I'm not talking about an anonymous bind; I want to bind with the current user's credentials and permissions, but I don't want to have to prompt the user for their password every time they run the program.
I don't know much about authentication methods, but I found some references to Authen::SASL, and various authentication mechanisms. I looked on my AD server and saw that it supports GSSAPI, so I thought I'd try that:
use Net::LDAP; use Authen::SASL; #-----------------------------------------------# # connect and authenticate #-----------------------------------------------# my $dc = 'brbdc1'; my $dn = "OU=OurDept,dc=OurDomain,dc=com"; # Create LDAP object; check auth capabilities. my $ldap = Net::LDAP->new($dc) or die; my $dse = $ldap->root_dse; die "Can't support GSSAPI" unless $dse->supported_sasl_mechanism('GSSA +PI'); # Create auth object; use it to bind to LDAP server. my $sasl = Authen::SASL->new(mechanism => 'GSSAPI') or die; my $rc = $ldap->bind(sasl => $sasl); die 'Error ' . $rc->code . ': ' . $rc->error if $rc->code;
This dies on the last line with
No SASL mechanism found at //Summ2/Perl/site/lib/Authen/SASL.pm line 77 at //Summ2/Perl/site/lib/Net/LDAP.pm line 392
I feel that I'm very close here—can anyone help?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bind to LDAP without password
by Khen1950fx (Canon) on Jul 30, 2010 at 00:40 UTC | |
by Sue D. Nymme (Monk) on Jul 30, 2010 at 18:47 UTC | |
by Khen1950fx (Canon) on Jul 31, 2010 at 01:38 UTC | |
by Sue D. Nymme (Monk) on Aug 06, 2010 at 21:42 UTC |