Open lorenzschmid opened 5 years ago
Hi @lorenzschmid ,
thanks for the work! I modified a bit your script and finally work the authetication by active directory!!
I ran into this same issue, and generalized the solution a bit more.
The updated code is in my fork: https://github.com/joshuaboniface/ldap-auth-sh
Currently, authentication is only possible via the
uid
of the user. Thereby, theuid
of the user as well as his password are used to make an authentication call to the LDAP server.For my setup I wanted authentication to work with the user's
mail
attribute instead. Thereby, two authentication calls are necessary:uid
based on the givenmail
uid
I modified the script accordingly but since I am not fluent in bash I prefer to write it down in this issue instead of a PR. Maybe there is a way to merge it with the existing code? Following my modifications:
In the
ldap_auth_curl()
andldap_auth_ldapsearch()
I replaced the variable$password
with$PW
Since two authentication calls are now necessary, I wrapped the code in question in a function
The single authentication call now becomes:
You can find my update script here (breaking the original functionality of direct authentication). Following an example of the configuration file for the updated script: