fix layout problems
[mirror/userdir-ldap-cgi.git] / html / doc-direct.wml
1 #use wml::db.d.o title="Direct LDAP Access"
2
3 <dsatoc/>
4
5 <p>Since the
6 <a href="http://lists.debian.org/debian-announce/debian-announce-2003/msg00001.html">compromise</a>,
7 the information available to non-developers via the LDAP interface has been
8 limited a great deal. However, as always, the full database is accessible from
9 any .debian.org machine. If you wish relatively unfettered access to the LDAP
10 database, connect to it from a .debian.org machine, such as ravel.debian.org
11 (which is recommended for general shell usage anyhow).
12 </p>
13
14 <p>
15 The LDAP utilities package (<a href="http://packages.debian.org/ldap-utils">\
16 ldap-utils</a>) provides an utility called ldapsearch that can be used
17 to execute direct queries to the database. This is done by supplying
18 the following arguments to ldapsearch: <strong>-x -H
19 ldap://db.debian.org -b dc=debian,dc=org</strong>. Alternatively, the
20 <strong>-H</strong> and <strong>-b</strong> options can be put in
21 one's ~/.ldaprc, in the following form:
22 </p><pre>
23 [ dbharris@ravel: ~/ ]$ cat ~/.ldaprc
24 HOST db.debian.org
25 BASE dc=debian,dc=org
26 </pre>
27
28 <p>
29 <strong>-x</strong> tells ldapsearch to use "simple" (non-SASL, non-Kerberos)
30 authentication. There appears to be no ~/.ldaprc option which does the same as
31 <strong>-x</strong>. With these parameters specified, we're ready to begin
32 searching. Here's an example:
33 </p><pre>
34 [ dbharris@ravel: ~/ ]$ ldapsearch -x uid=dbharris keyfingerprint
35 &lt;snip&gt;
36 # dbharris, users, debian, org
37 dn: uid=dbharris,ou=users,dc=debian,dc=org
38 keyFingerPrint: CC53F12435C07BC258FE7A3C157DDFD959DDCB9F
39 &lt;snip&gt;
40 </pre>
41
42 <p>
43 The first non-option argument (<strong>uid=dbharris</strong> in this case) is
44 the query to perform, and the rest of the arguments are the attributes to
45 return. If you only specify the query, but don't provide any attributes to
46 return, all readable attributes are returned. While the example was quite
47 simple, complex queries can be performed as well:
48 </p><pre>
49 [ dbharris@ravel: ~/ ]$ ldapsearch -x -H ldap://db.debian.org -b dc=debian,dc=org '(&amp;(!(loginshell=/bin/bash))(uid=*))' loginshell
50 </pre>
51
52 <p>
53 That query shows users that do not use bash as their shell. Some other
54 interesting queries are:</p>
55 <ul>
56 <li>Count the number of developers
57 <tt>(&amp;(keyfingerprint=*)(gidnumber=800))</tt></li>
58 <li>Show people in a certain group <tt>gidmembership=adm</tt></li>
59 <li>People named james <tt>cn=james</tt></li>
60 <li>Someone whos last name phonetically sounds like 'Ackerma'
61 <tt>sn~=ackerm</tt></li>
62 <li>All the sparcs <tt>host=sparc</tt></li>
63 </ul>
64
65 <p><a href="http://www.faqs.org/rfcs/rfc2254.html">RFC 2254</a>
66 has more information about the filter expressions.</p>
67
68
69 <h1>Other LDAP Browsers</h1>
70 <p>
71 The GQ package has a graphical LDAP browser that can browse the debian.org
72 tree. It is somewhat ungainly with the large number of entries in our
73 directory, but it does work nonetheless. Configuration is similar, use the
74 preferences dialog to add a new host with the information given above.
75 <p>
76 Netscape has a browser for their mailer, but I have never been able to get
77 it to work, please email if you have any luck.
78 <p>
79 To my knowledge there are no interfaces for popular mailers like mutt and
80 gnus. Such an interface would allow using the directory as an enhanced address
81 book.