LDAP notes

From Noah.org
Revision as of 12:01, 30 October 2008 by Root (talk | contribs)
Jump to navigationJump to search


Ubuntu install

aptitude install slapd python-ldap ldap-utils ldapscripts ldaptor-utils ldaptor-doc libldap2-dev

use LDAP for login

aptitude install libpam-ldap

misc notes

https://help.ubuntu.com/community/OpenLDAPServer

ldapsearch -x -LLL "cn=noah"
dpkg-reconfigure slapd

Simple authentication without SASL:

ldapsearch -x -LLL "cn=admin"

Python LDAP

import sys, os, ldap
options = [(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)]
bind_password = 'XXX'
ldap.set_option(*options[0]) # same as ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
conn=ldap.initialize('ldaps://admin.digg.internal/',trace_level=2, trace_file=sys.stdout)
conn.simple_bind_s("uid=noah,ou=Users,dc=digg,dc=internal", bind_password)
conn.search_s('dc=digg,dc=internal',ldap.SCOPE_SUBTREE,'(uid=noah)') # Dump just Noah's account info
conn.search_s('dc=digg,dc=internal',ldap.SCOPE_SUBTREE,'(uid=*)')    # Dump info on all accounts