LDAP module installation


I have some trouble installing modules for my gnuhealth installation.
Specifically, I want to install the trytond-ldap-authentication module for my gnuhealth 3.8 server.

Unfortunately I can not find any hints if this requires a specific procedure.

What I did was:

pip3 install trytond-ldap-authentication

Afterwords I took a look into the gui client and tried to activate the ldap module, but it was not listed there.

Afterwards I tried using the trytond-admin cli, but all commands fail with the following error:

gnuhealth@linux:~/gnuhealth/tryton/server/trytond-5.0.34/bin $ ./trytond-admin -m -d=health --config /home/gnuhealth/gnuhealth/tryton/server/config/trytond.conf
Traceback (most recent call last):
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/modules/__init__.py", line 53, in import_module
    module = importlib.import_module(fullname)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'trytond.modules.ldap_authentication'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./trytond-admin", line 21, in <module>
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/admin.py", line 54, in run
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/pool.py", line 149, in init
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/pool.py", line 102, in start
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/modules/__init__.py", line 331, in register_classes
    the_module = import_module(module)
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/modules/__init__.py", line 77, in import_module
    module = spec.loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 823, in load_module
  File "<frozen importlib._bootstrap_external>", line 682, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/gnuhealth/.local/lib/python3.6/site-packages/trytond/modules/ldap_authentication/__init__.py", line 5, in <module>
    from . import res
  File "/home/gnuhealth/.local/lib/python3.6/site-packages/trytond/modules/ldap_authentication/res.py", line 9, in <module>
    from trytond.i18n import gettext
ModuleNotFoundError: No module named 'trytond.i18n'

I can not figure out why this fails, so if somone has an idea I’d be very happy for any hints.

Kind regards

You must install modules from the same series (two first release number) as trytond package installed.

In order to complement the answer:
pip3 install trytond-ldap-authentication==5.0.3 should do the trick.

Okay, I managed to install the ldap module. It seems like a restart of the server was needed.

Unfortunately I still can not see an ldap entry in the sidebar menu, altough the module appears as “activated”.

Any ideas why this is not showing up?

There is no menu entry for ldap module. Everything must be configured in the trytond configuration. See https://docs.tryton.org/projects/modules-ldap-authentication/.

Oh I see.
I was following this guide https://en.wikibooks.org/wiki/GNU_Health/Central_Authentication which says otherwise.

Thanks for the hint, I will see if I can get it to work.

Okay, I think I managed to add the ldap configuration to my config like this:

authentications = password,ldap

uri = ldap://ldap2.xy.z.de:389/ou=users,dc=xyz,dc=de

In which way to I need to add users for using the ldap authentication?
I tried adding the ldap username as the “Login” parameter when I create a user.
But the password field gets automatically filled when I save.
I can then not login supplying the login name and the ldap password.

Is there a way to check wether tryton actually tries to use ldap?

In no way, the users are created on first login. Or you can create them in advance with the right login.

It is not filled automatically. It is just the display of hidden password no matter the data.

I guess the ldap module is not correctly configured.

In which way? Do you think the url is malformatted, or something else?
Is there an example config file, where I might have a look at? To see how it should be configured properly.

I added ?objectClass?onelevel at the end of my uri and gnuhealth/tryton now successfully logs me in.