EyesOfNetworkCommunity / EyesOfNetworkCommunity/eonweb

Unable to add ldap user and workaround

Open
#113 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
9
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm managing eyesofnetwork solution on production (~1000 hosts, 4 nagios backend). For several months i'm unable to add a new ldap user. Our system uses a openldap directory.

The problem appears after 5.3-11 eonweb update.

LDAP configuration and filters are OK (tested with ldapsearch).

On the auth setting page, when I use the update button, all is OK, entries are correctly found :

![eoonauthupdate](https://user-images.githubusercontent.com/98389336/150957309-38ec16af-c2b3-4447-a6ae-7f4c34d00cbe.JPG)

But when using add user page, i can't found recent ldap users. Only old ones.

In eonweb database, recent ldap users are not present in ldap_users_extended table. I can also see that "user" column is empty for all row. I think this is not new and was not a problem for our usage before but I may be wrong here.

After investigation, I found on authentification setting page ( file module/admin_auth/index.php ) , a variable initialisation which explain this behaviour.

On line 175 , file module/admin_auth/index.php :

`$username=$info[$i]["name"][0];`

**Our ldap user entries doesn't have a attribute "name". So this variable is NULL on my case**

This variable is then used for sql query below. I have activate query log on mariadb. Query generated for insertion is :

`INSERT INTO ldap_users_extended VALUES( 'uid=xxxxxxx,ou=users,ou=xxxxx,o=xxxxxxxxxx,c=xxxxxx', 'xxxxxxx', NULL, 1)`

And causes the error :

`Error Code: 1048. Column 'user' cannot be null`

**Workarounds I use :**

1. Change on line 175 , file module/admin_auth/index.php :

`$username=$info[$i][$ldap_rdn]][0];`

login and user name are the same for us, this is sufficient for our usage but may not be adequate for everbody.
With this modification i have now the user column correctly set.

2. Add double quotes when using $username variable , lines 179 and 188

Exemple for lines 185-189
```
$datas2 = array(
$dn,
$info[$i][$ldap_rdn]["0"],
"$username"
);
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.