Penguin
Blame: AutoConfiguringThunderbird
EditPageHistoryDiffInfoLikePages
Annotated edit history of AutoConfiguringThunderbird version 1, including all changes. View license author blame.
Rev Author # Line
1 PerryLorier 1 I've recently been experimenting with getting all users on a machine to automatically pick up AD Directory services.
2
3 The first thing is how to connect to AD from Thunderbird:
4
5 Add an LDAP server with:
6 <verbatim>
7 Server name: AD.example.com
8 Base DN: ou=users, dc=example, dc=com
9 Bind DN: user@example.com
10 </verbatim>
11 The Base DN varies from Installation to Installation, but is usually "ou=<something>" followed by the name of the "domain" split with "dc" (domain components). The interesting thing about Active Directory is that you can authenticate with your user@domain as the BindDN, which means you don't need to be able to find the proper DN to bind as -- which you normally can't do because Active Directory doesn't allow anonymous binds.
12
13
14 To get Thunderbird to set this up by default for all users on a box you have a lovely Rube Goldberg style setup.
15
16 First you need to edit grepref/all.js (normally /usr/share/thunderbird/greprefs/all.js) and add to the end:
17
18 <verbatim>
19 * Perry 2010-03-04 -- Add auto configuration */
20 pref("general.config.obscure_value", 0); // disable rot13 .cfg obfuscation
21 pref("general.config.filename", "example.cfg");
22 </verbatim>
23
24 example.cfg can't be a full path, otherwise you get a NS_INSECURE_PATH style error message. It needs to be in the toplevel thunderbird directory which appaers to be /usr/lib/thunderbird/example.cfg.
25
26 This file MUST start with a // otherwise mozilla won't recognise it. (sigh).
27
28 <verbatim>
29 // vim: set filetype=javascript
30 //
31 // (C) Copyright 2010, Perry Lorier
32 //
33 // 2010-03-04 Perry Lorier
34 // * Setup test url for autoconfiguring thunderbird
35 //
36
37 try {
38
39 pref("autoadmin.global_config_url", "http://example.com/thunderbird-prefs.js");
40 pref("autoadmin.append_mailaddr", false);
41
42 } catch(e) {
43 displayError("Error setting autoconfig file", e);
44 }
45 </verbatim>
46
47 This then fetches the actual config you care about using any of the protocols that mozilla can understand. The contents of this file is something like:
48
49 <verbatim>
50 * Default configuration for LDAP Directory services using an AD server.
51 * (C) Copyright 2010, Perry Lorier.
52 *
53 * See https://developer.mozilla.org/en/MCD for more information.
54 *
55 * 2010-03-04 Perry Lorier
56 * * Created initial system for doing directory lookups out of LDAP.
57 */
58
59 if (getenv("USER") != "") {
60 // Unix
61 var env_user = getenv("USER");
62 } else {
63 // Windows
64 var env_user = getenv("USERNAME");
65 }
66
67 /* Misc settings */
68 defaultPref("ldap_2.prefs_migrated",true);
69
70 /* Configure the Users Directory */
71 defaultPref("ldap_2.servers.ExampleDirectory.auth.dn", env_user + "@example.com");
72 defaultPref("ldap_2.servers.ExampleDirectory.auth.savePassword", true);
73 defaultPref("ldap_2.servers.ExampleDirectory.description","Example Directory");
74 defaultPref("ldap_2.servers.ExampleDirectory.uri", "ldap://ad.example.com:389/ou=users,dc=example,dc=com??sub");
75
76 /* Set the default ldap auto completion to the Example Directory */
77 defaultPref("ldap_2.autoComplete.directoryServer", "ldap_2.servers.ExampleDirectory");
78 defaultPref("ldap_2.autoComplete.useDirectory", true);
79
80 /* Other possible things here? We could autoconfigure IMAPS/SMTP for instance? */
81 /* Enable image loading from *.example.com in message bodies? */
82 /* You can look up attributes in ldap to configure email etc from that */
83 </verbatim>
84
85 -----
86 To debug this set:
87 <verbatim>
88 export NSPR_LOG_MODULES=MCD:5
89 export NSPR_LOG_FILE=/tmp/thunderbird-log.txt
90 </verbatim>
91 -----
92 See also:
93 * https://developer.mozilla.org/en/MCD
94 * http://mit.edu/~thunderbird/www/maintainers/config.html
95
96 Part of CategoryMailNotes