I have an openldap directory with several thousand of accounts.
so when I try to use the ldap authentification in Librenms, it does not work.
After several hours of work, I found this solution (add an ldap filter to limit the number of results) :
I have added $config[‘auth_ldap_Userlist_filter’] = ‘service=informatique’; in the config.php
I have modified the source code of the getUserlist() function in the file librenms/LibreNMS/Authentication/LdapAuthorizer.php like this :
$filter = ‘(’ . Config::get(‘auth_ldap_prefix’) . ‘*)’;
if (Config::get(‘auth_ldap_Userlist_filter’) != NULL) {
$filter = ‘(’ . Config::get(‘auth_ldap_Userlist_filter’) . ‘)’;
}
Now with this modification, the ldap authentification working fine.
So could you add the ‘auth_ldap_Userlist_filter’ in the config.php and proceed of the modification of the source code of the getUserlist() function in the next release of Librenms ?
Thanks a lot
You should submit your code in github as pull requests.
I have done a pull request this morning
librenms:master
← ifred16:add_config_ldap_filter
opened 09:02AM - 01 Jul 19 UTC
I have an openldap directory with several thousand of accounts.
so when I try t… o use the ldap authentification in Librenms, it does not work.
I found this solution (add an ldap filter to limit the number of results) :
I have added $config[‘auth_ldap_Userlist_filter’] = ‘service=informatique’; in the config.php
I have modified the source code of the getUserlist() function in the file librenms/LibreNMS/Authentication/LdapAuthorizer.php like this :
$filter = ‘(’ . Config::get(‘auth_ldap_prefix’) . ‘*)’;
if (Config::get(‘auth_ldap_Userlist_filter’) != NULL) {
$filter = ‘(’ . Config::get(‘auth_ldap_Userlist_filter’) . ‘)’;
}
Now with this modification, the ldap authentification working fine.
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [ ] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
Thanks for your help.
louis
8 November 2019 14:30
4
Hello @Frederic_CREMOUX
I have a pull request about LDAP. Could you test that there is no regression ?
librenms:master
← louis-6wind:ldap
opened 07:23PM - 29 Oct 19 UTC
Related to https://community.librenms.org/t/authentification-with-the-ldab-very-… slow/1836/4
Do not parse all user if fallback of memberof
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [X] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
In order to test the code, assuming app is in /opt/librenms :
cp -p /opt/librenms/LibreNMS/Authentication/LdapAuthorizer.php /opt/librenms/LibreNMS/Authentication/LdapAuthorizer.php.old
wget https://raw.githubusercontent.com/louis-oui/librenms/ldap/LibreNMS/Authentication/LdapAuthorizer.php -O /opt/librenms/LibreNMS/Authentication/LdapAuthorizer.php
To revert change :
cp -p /opt/librenms/LibreNMS/Authentication/LdapAuthorizer.php.old /opt/librenms/LibreNMS/Authentication/LdapAuthorizer.php
1 Like
There are scripts to test PRs: ./scripts/github-apply 10760 and ./scripts/github-remove
louis
12 November 2019 14:27
6
erratum ./scripts/github-apply 10760 to test.
Thanks