LDAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesLDAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 9 votes, 5.00 average. Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #16  
Old June 4th, 2004, 11:27 AM
gcleaves gcleaves is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 gcleaves User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No SSL

Quote:
Originally Posted by MatthewClark
I can verify that I have a secure connection to LDAP and everything.


Matt,

Did you need to do anything special to set up the SSL connection? I can't bind over SSL. I have verified that my DLLs are in the right place.

PHP 4.3.6
Apache/2.0.49
Windows 2000
OpenSSL 0.9.7c 30 Sep 2003

Geoff

Reply With Quote
  #17  
Old June 4th, 2004, 12:40 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,739 Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 25 m 16 sec
Reputation Power: 384
what errors do you get?

Reply With Quote
  #18  
Old June 7th, 2004, 08:59 AM
KuRcZaK KuRcZaK is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Poland
Posts: 6 KuRcZaK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Still not working for me.

Has anyone got it to work properly ?

I'm also working on user administration panel in PHP, when users are stored on an AD server.

Everything works fine except setting and changing the unicodePwd field.

I've lost several days to find out how to made it to work and still nothing. I'm really angry about that.

Reply With Quote
  #19  
Old June 7th, 2004, 09:32 AM
bwhaley bwhaley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 9 bwhaley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Did you see my recent post?

Quote:
Originally Posted by KuRcZaK
Everything works fine except setting and changing the unicodePwd field.


Did you see the recent posts using the perl script and/or the php converted perl script? That has worked for me, I'd be interested to know if others are having luck with it.

- Ben

Reply With Quote
  #20  
Old June 7th, 2004, 10:26 AM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,739 Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 25 m 16 sec
Reputation Power: 384
Quote:
Originally Posted by bwhaley
Did you see the recent posts using the perl script and/or the php converted perl script? That has worked for me, I'd be interested to know if others are having luck with it.

- Ben


Any chance you can test the PHP script? I don't have AD so can't test it here.

Reply With Quote
  #21  
Old June 7th, 2004, 12:24 PM
bwhaley bwhaley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 9 bwhaley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No luck...

Quote:
Originally Posted by Viper_SB
Any chance you can test the PHP script? I don't have AD so can't test it here.


I first made the following minor modification (possibly specific for my environment; I'm no PHP/Active Directory expert). The last line is the change:

PHP Code:
if (!ldap_set_option($ldapLDAP_OPT_PROTOCOL_VERSION$protocolVersion))
{
    exit(
'Failed to set protocol version to '.$protocolVersion);

ldap_set_option($ldapLDAP_OPT_REFERRALS0); 


Alas, no luck. I still received the "Server unwilling to perform" error that I was getting before. Son of a....


- Ben

Reply With Quote
  #22  
Old June 8th, 2004, 02:58 AM
KuRcZaK KuRcZaK is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Poland
Posts: 6 KuRcZaK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm still having problem to connect via SSL

I've read that if I want to change password via LDAP I have to connect via SSL to LDAP server.

And that's my problem right now.

$ldap=ldap_connect("myserver",636);
returns Success
and $ldap gets "Resource #1", so I suppose, that the connection is made, but when I try to bind using this connection I receive an error:
"Could not connect to LDAP server"
I tried also to bind annonymously mysql_bind($ldap), but it also reutrns the same error.

I've checked my php configuration and OpenSSL is configured. Our networ administrator says, that also AD server is configured to use SSL.

I have no idea where the problem could be right now.

The connection without SSL is possible and works fine.

Reply With Quote
  #23  
Old June 8th, 2004, 06:42 AM
KuRcZaK KuRcZaK is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Poland
Posts: 6 KuRcZaK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb How to check the connection type ?

OK - I think I'm one next step to the solution.

Surprisingly what helped to make a SSL connection with LDAP server was creating C:\OpenLDAP\sysconf\ (as described in one of the threads on the net) and putting there ldap.conf file which contains in its first line:
TLS_REQCERT never

Why on C drive and in this concrete directory - people says that its coded deep in the php_ldap.dll.

So now my script seems to be runnig fine:
PHP Code:
 $ldap_server "ldaps://mscrmsvr/";
$auth_user "Admin";
$auth_pass "P@ssw0rd77";
 
// connect to server

if (!($connect=@ldap_connect($ldap_server,636))) {
     die(
"Could not connect to ldap server");
}
echo 
"connect result is: ".$connect."<BR>";

ldap_set_option($connectLDAP_OPT_PROTOCOL_VERSION3);

// bind to server


if (!($bind=ldap_bind($connect$auth_user$auth_pass))) {
     die(
"Unable to bind to server");  
}

echo 
"bind result is: ".$bind."<BR>";


if (!(
$search=@ldap_search($connect$base_dn$filter))) {
     die(
"Unable to search ldap server"); 


,but when I try to change unicodePwd field I get the same message as in non SSL connection "Warning: ldap_modify(): Modify: Server is unwilling to perform".

Do you know if and how can I check if my connection to the LDAP server is encoded with SSL ?

Reply With Quote
  #24  
Old June 8th, 2004, 08:55 AM
bwhaley bwhaley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 9 bwhaley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by KuRcZaK
Do you know if and how can I check if my connection to the LDAP server is encoded with SSL ?


I battled with the very same thing, as described earlier in this thread. I think we've determined that it is not an SSL problem. I am certain that I have a secure connection and I get the "Server unwilling to perform" error message as well. You can try the perl script shown earlier in the thread. That has worked for me. The direct translation to php, however, does NOT work. We aren't sure why that is...

Reply With Quote
  #25  
Old June 8th, 2004, 10:44 AM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,739 Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 25 m 16 sec
Reputation Power: 384
Ya if the PHP script isn't working then it's something with PHP, if anyone has an active directory server I could test stuff on I'd be willing to track down the problem and report it to PHP. All I'd need is a user account that could change my own password nothing else would be needed.

Also just so everyone is aware of this, ldap_connect() (in PHP) ALWAYS returns true. You can put in any IP or host and it'll be sucessfully, this IS a feature and is working correctly. ldap_bind() is what really connects so that is where you should check for connection. Here is how I do it.

PHP Code:
<?php
$link 
ldap_connect($host);
if (!
ldap_set_option($linkLDAP_OPT_PROTOCOL_VERSION3))
{
    exit(
'Failed to set protocol version to 3');
}
// just do an anoymous bind and this makes sure the ldap server exists
ldap_bind($link);
// 0 is successful thus it was able to connect
if (ldap_errno($link) !== 0)
{
    exit(
'Could not connect to LDAP server');
}
// this is your real bind
ldap_bind($link$user$password);
?>

Reply With Quote
  #26  
Old June 8th, 2004, 10:50 AM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,739 Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 25 m 16 sec
Reputation Power: 384
BTW what version of PHP are you trying this with?

Reply With Quote
  #27  
Old June 8th, 2004, 02:24 PM
bwhaley bwhaley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 9 bwhaley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Version

Quote:
Originally Posted by Viper_SB
BTW what version of PHP are you trying this with?


I'm using PHP v 4.2.2.

Sorry, can't give you an account at my location...

Reply With Quote
  #28  
Old June 8th, 2004, 05:04 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,739 Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level)Viper_SB User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 25 m 16 sec
Reputation Power: 384
any chance you can try with PHP 5 rc3? Because it could be a bug that was already fixed.

Reply With Quote
  #29  
Old June 9th, 2004, 02:34 AM
KuRcZaK KuRcZaK is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Poland
Posts: 6 KuRcZaK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
...and what about user authentication

OK - I'll try version 5 RC 3 of PHP.