# LDAP module installation

**URL:** <https://discuss.tryton.org/t/ldap-module-installation/4047>\
**Category:** System Administrator\
**Created:** [April 12, 2021, 5:22pm UTC](https://discuss.tryton.org/t/ldap-module-installation/4047 "2021-04-12T17:22:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![andileni](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andileni/32/1401_2.png) [@andileni](https://discuss.tryton.org/u/andileni)\
**Post date:** [April 12, 2021, 5:22pm UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/1 "2021-04-12T17:22:23Z")

</div>

Hello,

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:

```auto
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>
    admin.run(options)
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/admin.py", line 54, in run
    activatedeps=options.activatedeps)
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/pool.py", line 149, in init
    self.start()
  File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.34/trytond/pool.py", line 102, in start
    register_classes()
  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  
Andreas

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [April 12, 2021, 5:39pm UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/2 "2021-04-12T17:39:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![German](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/german/32/143_2.png) [@German](https://discuss.tryton.org/u/German)\
**Post date:** [April 12, 2021, 7:00pm UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/3 "2021-04-12T19:00:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andileni](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andileni/32/1401_2.png) [@andileni](https://discuss.tryton.org/u/andileni)\
**Post date:** [April 13, 2021, 9:18am UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/5 "2021-04-13T09:18:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [April 13, 2021, 9:24am UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/6 "2021-04-13T09:24:24Z")

</div>

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/](https://docs.tryton.org/projects/modules-ldap-authentication/).

---

<div class="post-metadata">

**Author:** ![andileni](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andileni/32/1401_2.png) [@andileni](https://discuss.tryton.org/u/andileni)\
**Post date:** [April 13, 2021, 9:27am UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/7 "2021-04-13T09:27:22Z")

</div>

Oh I see.  
I was following this guide [GNU Health/Central Authentication - Wikibooks, open books for an open world](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.

---

<div class="post-metadata">

**Author:** ![andileni](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andileni/32/1401_2.png) [@andileni](https://discuss.tryton.org/u/andileni)\
**Post date:** [April 13, 2021, 11:44am UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/8 "2021-04-13T11:44:33Z")

</div>

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

```auto
[session]
authentications = password,ldap

[ldap_authentication]
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?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [April 13, 2021, 11:50am UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/9 "2021-04-13T11:50:51Z")

</div>

> [@andileni](#):
>
> In which way to I need to add users for using the ldap authentication?

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

> [@andileni](#):
>
> But the password field gets automatically filled when I save.

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

> [@andileni](#):
>
> I can then not login supplying the login name and the ldap password.

I guess the ldap module is not correctly configured.

---

<div class="post-metadata">

**Author:** ![andileni](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andileni/32/1401_2.png) [@andileni](https://discuss.tryton.org/u/andileni)\
**Post date:** [April 13, 2021, 12:31pm UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/10 "2021-04-13T12:31:21Z")

</div>

> [@ced](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![andileni](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andileni/32/1401_2.png) [@andileni](https://discuss.tryton.org/u/andileni)\
**Post date:** [April 13, 2021, 1:47pm UTC](https://discuss.tryton.org/t/ldap-module-installation/4047/11 "2021-04-13T13:47:19Z")

</div>

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