[Twisted-Python] ldaptor based LDAP server

Tommi Virtanen tv at twistedmatrix.com
Thu May 19 15:15:09 EDT 2005

Andrzej Leszczynski wrote:
> I am looking for a Python barebones for a simple LDAP
> server project. It does not have to be Twisted based,
> but it would be wonderful if it is. I need a very
> simple server which is listening on some port and
> accepts following LDAP messages:
> 	-bind
> 	-search
> 	-unbind

Well, ldaptor/protocols/ldap/ldapserver.py is for you then.

> There are not going to be a actual LDAP database
> backend. All what happens is parsing above and reply
> with some simple content based on the some parameters
> from the request.
> I am just wondering with using ldaptor's protocol
> components I could easily come up with such a server?
> What do you think, would it be feasible with that?

If you want to reuse ldaptor search logic, search filter
handling, etc, subclass LDAPServer and provide an
IConnectedLDAPEntry adapter from the subclass to something
that implements the actual data storage. That way, you get
to use ldaptor's implementation of search etc; you just
provide a tree-like data structure of LDAP entries.

If you want full control of everything, and are willing
to really implement bind,search&unbind yourself pretty
much from scratch, subclass BaseLDAPServer and provide
see LDAPServer for hints on that.

More information about the Twisted-Python mailing list