Looking at the v5 code I think this has already been addressed (code is different so I can't be certain) but I did not see it listed here as an issue so I thought it was worth reporting.
// Connect to the AD/LDAP server as the username/password
$domainController = $this->randomController();
if ($this->useSSL) {
$this->ldapConnection = ldap_connect("ldaps://" . $domainController, $this->adPort);
} else {
$this->ldapConnection = ldap_connect($domainController, $this->adPort);
}
Basically there is no if statement for it to connect using TLS.
I noticed when looking at logs.
This is when I used TLS and an IP Address:
ldap_bind_s
ldap_simple_bind_s
ldap_sasl_bind_s
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP 10.25.14.51:636
ldap_new_socket: 20
ldap_prepare_socket: 20
ldap_connect_to_host: Trying 10.25.14.51:636
ldap_pvt_connect: fd: 20 tm: -1 async: 0
attempting to connect:
connect success
TLS: certificate [CN=DC01.BOX293.local] is valid
TLS certificate verification: subject: CN=DC01.BOX293.local, issuer: CN=BOX293-DC02-CA,DC=BOX293,DC=local, cipher: AES-256, security level: high, secret key bits: 256, total key bits: 256, cache hits: 0, cache misses: 0, cache not reusable: 0
TLS: hostname (10.25.14.51) does not match common name in certificate (DC01.BOX293.local).
ldap_err2string
I wouldn't have been aware of it if I did not incorrectly try connecting with an IP address and SSL. When I connect with a DNS entry and SSL it works correctly (as it should) however when you use TLS it just connects on 389.
This small change made it work:
// Connect to the AD/LDAP server as the username/password
$domainController = $this->randomController();
if ($this->useSSL) {
$this->ldapConnection = ldap_connect("ldaps://" . $domainController, $this->adPort);
} elseif ($this->useTLS) {
$this->ldapConnection = ldap_connect("ldaps://" . $domainController, $this->adPort);
} else {
$this->ldapConnection = ldap_connect($domainController, $this->adPort);
}
A colleague told me that the TLS connection is slightly different an moves to TLS after the initial connection attempt. Sorry for the incorrect bug report.
Looking at the v5 code I think this has already been addressed (code is different so I can't be certain) but I did not see it listed here as an issue so I thought it was worth reporting.
Basically there is no if statement for it to connect using TLS.
I noticed when looking at logs. This is when I used TLS and an IP Address:
This is when I used SSL and an IP Address:
I wouldn't have been aware of it if I did not incorrectly try connecting with an IP address and SSL. When I connect with a DNS entry and SSL it works correctly (as it should) however when you use TLS it just connects on 389.
This small change made it work: