-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LDAP authentication failed with 'Unknown User' #179
Comments
Hello. If you could share what type of LDAP system your are pointing to that may help in getting this resolved. Also if you could share the contents of your Based on the error that it can not bind anonymously. Depending on your setup, it may not be sending credentials and trying the anonymous bind which your LDAP server does not seem to allow. I would assume you need to set something like Since I based my code off of Docuwikis LDAP plugin, you may find their documentation helpful: https://www.dokuwiki.org/plugin:authldap |
Hello, |
Understood. You share what you are willing to share. If it is possible to share at least the kind of server you are using, that would help. For instance is it Active Directory, FreeIPA etc? First of, make sure you make your configuration changes in And for a reference, here is my config file. My ldap server is a freeIPA based server in this case. Note that it begins with the
|
I have discovered that ONA can't retrieve the data from the auth_ldap.config.php file. Therefore I have made a solution and it works pretty well, there it is : if ($user!='admin'){
global $base;
$ldap_conf="{$base}/local/config/auth_ldap.config.php";
//Opening of the LDAP conf file
$confFile=fopen($ldap_conf,"r") or die("Unable to open the file !");
//=======================VALUES TO RETRIEVE FOR LDAP CONNECTION==============================//
//Edit this list depending on the values of the LDAP conf file you want to retrieve //
//Pay attention : the order of the values in the list and in the conf file must be the same //
$var=['debug','version','server','usertree','grouptree','groupfilter']; //
//===========================================================================================//
//Repeat this step for each values to retrieve
for ($i=0;$i<count($var);$i++){
//Read the first line in the conf file
$reading=fgets($confFile);
//if there are some commentary lines, don't take them
while($reading[0]!="$"){
$reading=fgets($confFile);
};
//Only take the part between " = '" and "';" of the line
$string=explode(" = '",$reading);
$this->cnf[$var[$i]]=explode("';",$string[1])[0];
};
//close the LDAP conf file
fclose($confFile); I have added this code just at the begining of the checkPass function in ldap.class.php (before the "reject empty password" commentary line). |
This feels like there is something else going on here if you are seeing xajax errors. Xajax has nothing to do with the authentication/ldap portion of code. Ajax is all about the GUI and javascript side of things. The fact that your php environment is unable to open up the auth_ldap.config.php also makes me wonder about your php context as a whole. There are too many other things that could be happening at that level to provide any real suggestions beyond this speculation. It sounds like we need to figure out why it is unable to open the config file. Does the user that your web server runs as have access to the www/local/config directory? Do you have any web server configurations that may be preventing access to some of these files? Also you might try updating the config in Setting Another hack would be to add the values into the Clearly there are a lot of thoughts and ideas as to what could be happening here. But bottom line is that there should be no need to make changes to the code. It would be best to focus on finding out why the configuration is not being processed. Once that is addressed, then the code should function properly. Also in looking at the history of the ldap class, it does not have any real changes to it since it was first introduced. https://github.com/opennetadmin/ona/commits/master/www/include/auth/ldap.class.php Hope that gets us somewhere. |
Hello, $this->cnf['groupkey']='cn'; just before these lines (around line 250) : if ($this->cnf['grouptree'] && $this->cnf['groupfilter']) {
$g = 0;
$base = $this->_makeFilter($this->cnf['grouptree'], $user_result);
$filter = $this->_makeFilter($this->cnf['groupfilter'], $user_result);
$sr = @ldap_search($this->con, $base, $filter, array($this->cnf['groupkey']));
//le programme rentre ici
if(!$sr){
printmsg("ERROR => auth_ldap: Reading group memberships failed",0);
if($this->cnf['debug']){
printmsg('DEBUG => auth_ldap: LDAP group search: '.htmlspecialchars(ldap_error($this->con)),1);
printmsg('DEBUG => auth_ldap: LDAP search at: '.htmlspecialchars($base.' '.$filter),1);
}
return false;
}
... because I saw that $this->cnf['groupkey'] was always NULL so I gave it the 'cn' value that I could see when I print the value of this variable on my actual working server. |
By the way, I have noticed a problem in your index.php (line 19) : for the default guest authentication, you've written this : if (!$_SESSION['ona']['auth']['user']['username'] and !$conf['disable_guest']) {
$_SESSION['ona']['auth']['user']['username'] = 'guest';
list($status, $js) = get_authentication('guest','guest');
get_perms('guest');
} However, the guest password isn't "guest" but "test" (as we can check it through its md5 hash in the MySQL autogenerated database and reverse it to retrieve the password). if (!$_SESSION['ona']['auth']['user']['username'] and !$conf['disable_guest']) {
$_SESSION['ona']['auth']['user']['username'] = 'guest';
list($status, $js) = get_authentication('guest','test');
get_perms('guest');
} This problem doesn't affect the behaviour of OpenNetAdmin, but just display this error message in my log file every time a user logs out :
|
Hi, Prior to PHP 8.0.0, classes in the global namespace will interpret a method named the same as the class as an old-style constructor. That syntax is deprecated, and will result in an E_DEPRECATED error but still call that function as a constructor. If both __construct() and a same-name method are defined, __construct() will be called. In namespaced classes, or any class as of PHP 8.0.0, a method named the same as the class never has any special meaning. Always use __construct() in new code. |
Hi,
I have an ONA server (v17.12.22) which is running on a Debian 7.11 wheezy server using LDAP authentication.
I wanted to upgrade it to the v19.0.1 release on a Debian 10 buster server so I made any changes in my MySQL database and in the ona folder, except that I kept the same 'auth_ldap.config.php' file as the v17.12.22 release one. Through these changes, my server works well except for the LDAP authentication part which returns me an 'Unknown User' and 'auth_ldap: can not bind anonymously' errors, even if my username and my password are correct.
Have you an idea if I need to make some modifications in the 'auth_ldap.config.php' file due to the new release, or other actions that could help me ?
Regards
The text was updated successfully, but these errors were encountered: