Topic: OpenLDAP Python

When I go to https://mydoma/iredadmin, i get the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/web/application.py", line 239, in process
    return self.handle()
  File "/usr/local/lib/python2.7/site-packages/web/application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
  File "/usr/local/lib/python2.7/site-packages/web/application.py", line 416, in _delegate
    mod = __import__(mod, None, None, [''])
  File "/var/www/iredadmin/controllers/ldap/basic.py", line 5, in <module>
    import ldap
  File "/usr/local/lib/python2.7/site-packages/ldap/__init__.py", line 23, in <module>
    from _ldap import *
ImportError: Cannot load specified object

I have no idea with this error. Anyone with an idea will be appreciated.
OS: OpenBSD 5.3
Mailbackend: OpenLDAP
iRedMail: 0.8.5


==== Required information ====
- iRedMail version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Linux/BSD distribution name and version:
- Related log if you're reporting an issue:


Re: OpenLDAP Python

*) Is Apache chrooted?
*) Do you have Python module py-ldap and py-mysql installed?


Re: OpenLDAP Python

Thanks for the reply.
Here is the response to the question.

*) Is Apache chrooted? Yes
*) Do you have Python module py-ldap and py-mysql installed? Yes


Re: OpenLDAP Python

djbahati1 wrote:

*) Is Apache chrooted? Yes

That's the problem.
if you chroot Apache, you should make Python work under chroot too. For example, copy necessary libs (check with command 'ldd /usr/local/bin/python'), etc.

Does it work without chroot?


Re: OpenLDAP Python

Sorry, I have used iRedmail to install apache. Does iRedmail install a chrooted apache or not?  I have no idea for this and how to check if apache is chrooted or not.


Re: OpenLDAP Python

The result of  ldd /usr/local/bin/python is

        Start            End              Type Open Ref GrpRef Name
        000003c5f1900000 000003c5f1d02000 exe  1    0   0      /usr/local/bin/python
        000003c7f5761000 000003c7f5d0d000 rlib 0    1   0      /usr/local/lib/libpython2.7.so.0.0
        000003c7f6f52000 000003c7f735d000 rlib 0    1   0      /usr/lib/libutil.so.11.4
        000003c7f65bc000 000003c7f6acb000 rlib 0    1   0      /usr/lib/libstdc++.so.55.0
        000003c7fbe95000 000003c7fc2bd000 rlib 0    2   0      /usr/lib/libm.so.7.1
        000003c7f22d7000 000003c7f26e9000 rlib 0    3   0      /usr/lib/libpthread.so.17.0
        000003c7f85d9000 000003c7f8ac1000 rlib 0    1   0      /usr/lib/libc.so.66.2
        000003c7fd500000 000003c7fd500000 rtld 0    1   0      /usr/libexec/ld.so

What does it mean?


Re: OpenLDAP Python

I tested the latest iRedMail with OpenBSD 5.3, i can reproduce this issue. Will try to debug it and come back to you later.


Re: OpenLDAP Python

Thank you. Waiting for feedback while trying to debug as well.


Re: OpenLDAP Python

Tried moment ago, really no idea about how to fix it. Currently, you can run iRedAdmin this way:

1) Open port 8080 in PF.
2) Run iRedAdmin on command line, it listens on port 8080 by default.

# cd /var/www/iredadmin/
# python iredadmin.py

You can force it to listen on another port like below:

# python iredadmin.py 1000

So sorry about this trouble.

P.S. OpenBSD-5.3 ships py-ldap-2.3.1, the latest version of python-ldap is 2.4.13.


Re: OpenLDAP Python

Thank you, it works now. Does it mean that i will always be running my server through the command line?


Re: OpenLDAP Python

Unfortunately, yes, until we got it solved. But i have no idea yet.


Re: OpenLDAP Python

Hi djbahati1,

You can now solve this issue with below command:

# chmod +r /usr/local/lib/libsasl2.so*

Author of python-ldap project told me there maybe a permission issue, so i trace it with 'ktrace' on OpenBSD and got it fixed.
Here's discussion in python-ldap mailing list if you're interested:
http://mail.python.org/pipermail/python … 03273.html

I reported this permission issue in OpenBSD mailing list 'ports-bug@' moment ago, hope we can get it fixed in ports tree soon. (Seems no public mailing list archive for this mailing list, so i cannot paste you a link as reference, sorry)


Re: OpenLDAP Python

UPDATE: OpenBSD port maintainer Antoine Jacoutot replied my report email, this issue has been fixed more than 2 months ago.


Re: OpenLDAP Python

In which release of OpenBSD works fine? Will this fix be available on the next OpenBSD release? Thank you.


Re: OpenLDAP Python

Hi djbahati1,

*) OpenBSD 5.3 has this issue, and you have to fix it manually by executing command i mentioned in my reply #16.

*) OpenBSD doesn't update binary packages of ports tree for -release or -stable branch, so you cannot expect OpenBSD 5.3 to fix this issue. Next release of OpenBSD, 5.4, will have this issue fixed.


Re: OpenLDAP Python

Thanks again.