Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Ldaptor - Python LDAP library using Twisted
Python Shell
Failed to load latest commit information.
admin Cleanup traces of BitKeeper.
bin Handle additional records in DNS response
debian Move dependencies from obsolete python-pyopenssl to python-openssl.
doc Cleanup traces of BitKeeper.
po Update l10n.
.gitignore Tell git to ignore generated files.
COPYING Clarify that license is LGPL Import version 0.0.16 Clarify that license is LGPL
TODO Add TODO note.
demo-webui-fi.tac Use to make ldaptor webui skinnable.
ldaptor.schema Add our own LDAP schema file. To use in slapd, add line "include /etc… Include ldaptor-ldifdiff and ldaptor-ldifpatch in scripts to install.
test-ldapserver.tac Move the test LDAP server used in web tests from port 10389 to port 3…
test-webui.tac Clean up. Deprecations, twill API changes, pyflakes, general bitrot, …


Ldaptor is a pure-Python library that implements:

  • LDAP client logic
  • separately-accessible LDAP and BER protocol message generation/parsing
  • ASCII-format LDAP filter generation and parsing
  • LDIF format data generation
  • Samba password changing logic

Also included is a web-based user interface to search and edit information in an LDAP directory and a set of LDAP utilities for use from the command line.

Ldaptor is distributed under the GNU Lesser General Public License. See the accompanying COPYING file for more details.

Quick Usage Example

from twisted.internet import reactor, defer
from ldaptor.protocols.ldap import ldapclient, ldapsyntax, ldapconnector

def example():
    serverip = ''
    basedn = 'dc=example,dc=com'
    binddn = ''
    bindpw = 'secret'
    query = '(cn=Babs*)'
    c = ldapconnector.LDAPClientCreator(reactor, ldapclient.LDAPClient)
    overrides = {basedn: (serverip, 389)}
    client = yield c.connect(basedn, overrides=overrides)
    yield client.bind(binddn, bindpw)
    o = ldapsyntax.LDAPEntry(client, basedn)
    results = yield
    for entry in results:
        print entry

if __name__ == '__main__':
    df = example()
    df.addErrback(lambda err: err.printTraceback())
    df.addCallback(lambda _: reactor.stop())


Ldaptor can be installed using the standard command line method:

python install

Your maintainer recommends virtualenv so you don't need to be root and so you can update to the latest Twisted libraries without disturbing other Python programs.

Linux distributions may also have ready packaged versions of Ldaptor and Twisted. Debian and Ubuntu have quality Ldaptor packages that can be installed e.g., by:

apt-get install python-ldaptor

To run the LDAP server (runs on port 38942):

twistd -ny --logfile=ldapserver.log \

To run the web interface (runs on port 38980):

twistd -ny --logfile=webui.log test-webui.tac


Additional dependencies for the web UI:

Status and History

Ldaptor was created by Tommi Virtanen who developed it during the years 2001-2008. From 2007 onwards mainly bug fixes were added, many contributed by Debian maintainers. The original author is however no longer developing or actively using Ldaptor. The currently maintained code directly descends from the original author's code repository available at:

The LDAP client library functionality is in active use. It is stable and works very well. Current focus is on fixing bugs and maintaining compatibility with new, stable Python and Twisted releases.

The web UI is not maintained and, to the maintainer's knowledge, not actively used. It can be made to run, but relies on deprecated functionality in Twisted.

Something went wrong with that request. Please try again.