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