Difference between revisions of "LDAP notes"
From Noah.org
Jump to navigationJump to search(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
aptitude install slapd python-ldap ldap-utils ldapscripts ldaptor-utils ldaptor-doc libldap2-dev | aptitude install slapd python-ldap ldap-utils ldapscripts ldaptor-utils ldaptor-doc libldap2-dev | ||
+ | |||
+ | === use LDAP for login === | ||
+ | |||
aptitude install libpam-ldap | aptitude install libpam-ldap | ||
Line 22: | Line 25: | ||
<pre> | <pre> | ||
ldapsearch -x -LLL "cn=admin" | ldapsearch -x -LLL "cn=admin" | ||
+ | </pre> | ||
+ | |||
+ | == /etc/ldap/ldap.conf == | ||
+ | |||
+ | <pre> | ||
+ | BASE dc=digg,dc=internal | ||
+ | URI ldaps://admin.digg.internal | ||
+ | TLS_REQCERT never | ||
</pre> | </pre> | ||
Revision as of 15:20, 30 October 2008
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"
/etc/ldap/ldap.conf
BASE dc=digg,dc=internal URI ldaps://admin.digg.internal TLS_REQCERT never
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