Bug #80405 [Opn]: LDAPCONF=/etc/ldap/ldap.conf not respected
Edit report at https://bugs.php.net/bug.php?id=80405&edit=1
ID: 80405
Updated by: cmb@php.net
Reported by: alisun at shitmail dot de
Summary: LDAPCONF=/etc/ldap/ldap.conf not respected
Status: Open
Type: Bug
Package: LDAP related
Operating System: linux
PHP Version: 7.4.12
-Assigned To:
+Assigned To: mcmic
Block user comment: N
Private report: N
New Comment:
Maybe Côme can clarify?
Previous Comments:
------------------------------------------------------------------------
[2020-11-23 10:29:57] alisun at shitmail dot de
Description:
------------
Problem: $LDAPCONF is not read properly.
cat /etc/ldap/ldap.conf
TLS_CACERT=/some/path
TLS_KEY=/some/other/path
TLS_CERT=/some/otherpath
TLS_REQCERT=demand
Ex 1: no explicit environment variables, should respect /etc/ldap/ldap.conf?
Does not :D
sudo -u www-data php -a<<eof
\$dn="someDN";
\$p="somePw";
\$ldaphost = "someHost";
\$ldapport = somePort;
\$ldapconn = ldap_connect(\$ldaphost, \$ldapport);
ldap_set_option(\$ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_start_tls(\$ldapconn);
eof
PHP Warning: ldap_start_tls(): Unable to start TLS: Connect error in php shell code on line 1
Ex 2: set LDAPCONF explicity, should respect /etc/ldap/ldap.conf?
Does not either
export LDAPCONF=/etc/ldap/ldap.conf
sudo -Eu www-data php -a<<eof
\$dn="someDN";
\$p="somePw";
\$ldaphost = "someHost";
\$ldapport = somePort;
\$ldapconn = ldap_connect(\$ldaphost, \$ldapport);
ldap_set_option(\$ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_start_tls(\$ldapconn);
eof
PHP Warning: ldap_start_tls(): Unable to start TLS: Connect error in php shell code on line 1
Ex 3: use $LDAPCONF content via environment variables
Works
export LDAPTLS_CACERT=/some/path
export LDAPTLS_KEY=/some/other/path
export LDAPTLS_CERT=/some/otherpath
export LDAPTLS_REQCERT=demand
sudo -Eu wwwcloud php -a<<eof
\$dn="uid=nextcloud,ou=people,dc=physsolutions,dc=org";
\$p=">.D+c'k_]^F4F8(d";
\$ldaphost = "ldap.physsolutions.org";
\$ldapport = 389;
\$ldapconn = ldap_connect(\$ldaphost, \$ldapport);
ldap_set_option(\$ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_start_tls(\$ldapconn);
eof
# no error
Ex 4: use $HOME/.ldaprc
Works
cp /etc/ldap/ldap.conf ~www-data/.ldaprc
sudo --set-home -u www-data php -a<<eof
\$dn="someDN";
\$p="somePw";
\$ldaphost = "someHost";
\$ldapport = somePort;
\$ldapconn = ldap_connect(\$ldaphost, \$ldapport);
ldap_set_option(\$ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_start_tls(\$ldapconn);
eof
# no error
Ex 5: use $CWD/ldaprc
Works
cp /etc/ldap/ldap.conf ldaprc
sudo -u www-data php -a<<eof
\$dn="someDN";
\$p="somePw";
\$ldaphost = "someHost";
\$ldapport = somePort;
\$ldapconn = ldap_connect(\$ldaphost, \$ldapport);
ldap_set_option(\$ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_start_tls(\$ldapconn);
eof
# no error
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80405&edit=1
Thread (3 messages)