]> git.sur5r.net Git - openldap/blob - clients/mail500/README
Merge in all devel changes since 2.0-alpha2.
[openldap] / clients / mail500 / README
1 This is the README file for mail500, a mailer that does X.500 lookups
2 via LDAP.
3
4 If you are planning to run mail500 at your site, there are several
5 things you will have to tailor in main.c:
6
7         LDAPHOST - The host running an LDAP server
8
9         base[] - The array telling mail500 where/how to search for
10                 things.  See the explanation below.
11
12 *** WHAT mail500 DOES: ***
13
14 mail500 is designed to be invoked as a mailer (e.g., from sendmail),
15 similar to the way /bin/mail works.  It takes a few required arguments
16 and then a list of addresses to deliver to.  It expects to find the
17 message to deliver on its standard input.  It looks up the addresses in
18 X.500 to figure out where to route the mail, and then execs sendmail to
19 do the actual delivery.  It supports simple aliases, groups, and
20 mailing lists, the details of which are given below.
21
22 *** HOW IT WORKS (from the sendmail side): ***
23
24 The idea is that you might have a rule like this in your sendmail.cf
25 file somewhere in rule set 0:
26
27 R$*<@umich.edu>$*       $#mail500$@umich.edu$:<$1>
28
29 This rule says that any address that ends in @umich.edu will cause
30 the mail500 mailer to be called to deliver the mail.  You probably
31 also want to do something to prevent addresses like terminator!tim@umich.edu
32 or tim%terminator.rs.itd.umich.edu@umich.edu from being passed to mail500.
33 At U-M, we do this by adding rules like this to rule set 9 where we
34 strip off our local names:
35
36 R<@umich.edu>$*:$*                 $>10<@>$1:$2
37 R$+%$+<@umich.edu>                 $>10$1%$2<@>
38 R$+!$+<@umich.edu>                 $>10$1!$2<@>
39
40 See the sample sendmail.cf in this directory for more details.
41
42 The mail500 mailer should be defined similar to this in the
43 sendmail.cf file:
44
45 Mmail500, P=/usr/local/etc/mail500, F=DFMSmnXuh, A=mail500 -f $f -h $h -m $n@$w $u
46
47 This defines how mail500 will be treated by sendmail and what
48 arguments it will have when it's called.  The various flags specified
49 by the F=... parameter are explained in your local sendmail book (with
50 any luck).  The arguments to mail500 are as follows:
51
52         -f      Who the mail is from.  This will be used as the address
53                 to which any errors should be sent (unless the address
54                 specifies a mailing list - see below).  Normally, sendmail
55                 defines the $f macro to be the sender.
56
57         -h      The domain for which the mail is destined.  This is passed
58                 in to mail500 via the $h macro, which is set by the
59                 $@ metasymbol in the rule added to rule set 0 above.
60                 It's normally used when searching for groups.
61
62         -m      The mailer-daemon address.  If errors have to be sent,
63                 this is the address they will come from.  $n is normally
64                 set to mailer-daemon and $w is normally the local host
65                 name.
66
67 The final argument $u is used to stand for the addresses to which to
68 deliver the mail.
69
70 *** HOW IT WORKS (from the mail500 side): ***
71
72 When mail500 gets invoked with one or more names to which to
73 deliver mail, it searches for each name in X.500.  Where it searches,
74 and what kind(s) of search(es) it does are compile-time configurable
75 by changing the base array in main.c.  For example, the configuration
76 we use at U-M is like this:
77
78         Base    base[] =
79                 { "ou=People, o=University of Michigan, c=US", 0
80                         "uid=%s", "cn=%s", NULL,
81                   "ou=System Groups, ou=Groups, o=University of Michigan, c=US", 1
82                         "(&(cn=%s)(associatedDomain=%h))", NULL, NULL,
83                   "ou=User Groups, ou=Groups, o=University of Michigan, c=US", 1
84                         "(&(cn=%s)(associatedDomain=%h))", NULL, NULL,
85                   NULL
86                 };
87
88 which means that in delivering mail to "name" mail500 would do the
89 the following searches, stopping if it found anything at any step:
90
91         Search (18) [2]: c=US@o=University of Michigan@ou=People
92         Search subtree (uid=name)
93         Search (18) [3]: c=US@o=University of Michigan@ou=People
94         Search subtree (cn=name)
95
96         Search (18) [4]: c=US@o=University of Michigan@ou=Groups@ou=System Groups
97         Search subtree & ((cn=name)(associatedDomain=umich.edu))
98
99         Search (18) [5]: c=US@o=University of Michigan@ou=Groups@ou=User Groups
100         Search subtree & ((cn=name)(associatedDomain=umich.edu))
101
102 Notice that when specifying a filter %s is replaced by the name,
103 or user portion of the address while %h is replaced by whatever is
104 passed in to mail500 via the -h option (typically the host portion
105 of the address).
106
107 You can also specify whether you want search results that matched
108 because the entry's RDN matched the search to be given preference
109 or not.  At U-M, we only give such preference in the mail group
110 portion of the searches.  Beware with this option:  the algorithm
111 used to decide whether an entry's RDN matched the search is very
112 simple-minded, and may not always be correct.
113
114 There is currently no limit on the number of areas searched (the base
115 array can be as large as you want), and an arbitrary limit of 2 filters
116 for each base.  If you want more than that, simply changing the 3 in
117 the typedef for Base should do the trick.
118
119 *** HOW IT WORKS (from the X.500 side): ***
120
121 In X.500, there are several new attribute types and one new object
122 class defined that mail500 makes use of.  At its most basic, for normal
123 entries mail500 will deliver to the value(s) listed in the
124 rfc822Mailbox attribute of the entry.  For example, at U-M my entry has
125 the attribute
126
127         mail= tim@terminator.rs.itd.umich.edu
128
129 So mail sent to tim@umich.edu will be delivered via mail500 to that
130 address.  If there were multiple values for the mail attribute, multiple
131 copies of the mail would be sent.
132
133 A new object class, rfc822MailGroup, and several new attributes have
134 been defined to handle email groups/mailing lists.  To use this, you
135 will need to add this to your local oidtable.oc:
136
137         # object class for representing rfc 822 mailgroups
138         rfc822MailGroup:        umichObjectClass.2 : \
139                 top : \
140                 cn : \
141                 rfc822Mailbox, member, memberOfGroup, owner, \
142                 errorsTo, rfc822ErrorsTo, requestsTo, rfc822RequestsTo,
143                 joinable, associatedDomain, \
144                 description, multiLineDescription, \
145                 userPassword, krbName, \
146                 telecommunicationAttributeSet, postalAttributeSet
147
148 And you will need to add these to your local oidtable.at:
149
150         # attrs for rfc822mailgroups
151         multiLineDescription:   umichAttributeType.2    : CaseIgnoreList
152         rfc822ErrorsTo:         umichAttributeType.26   : CaseIgnoreIA5String
153         rfc822RequestsTo:       umichAttributeType.27   : CaseIgnoreIA5String
154         joinable:               umichAttributeType.28   : Boolean
155         memberOfGroup:          umichAttributeType.29   : DN
156         errorsTo:               umichAttributeType.30   : DN
157         requestsTo:             umichAttributeType.31   : DN
158
159 The idea was to define a kind of hybrid mail group that could handle
160 people who were in X.500 or not.  So, for example, members of a group
161 can be specified via the member attribute (for X.500 members) or the
162 rfc822MailBox attribute (for non-X.500 members).  Similarly for the
163 errorsTo and rfc822ErrorsTo, and the requestsTo and rfc822RequestsTo
164 attributes.
165
166 To create a real mailing list, with a list maintainer, all you have to
167 do is create an rfc822MailGroup and fill in the errorsTo or
168 rfc822ErrorsTo attributes (or both).  That will cause any errors
169 encountered when delivering mail to the group to go to the addresses
170 listed (or X.500 entry via it's mail attribute).
171
172 If you fill in the requestsTo or rfc822RequestsTo (or both) attributes,
173 mail sent to groupname-request will be sent to the addresses listed
174 there.  mail500 does this automatically, so you don't have to explicitly
175 add the groupname-request alias to your group.
176
177 To allow users to join a group, there is the joinable flag.  If TRUE,
178 mail500 will search for entries that have a memberOfGroup attribute
179 equal to the DN of the group, using the same algorithm it used to find
180 the group in the first place (i.e. the DNs and filters listed in the
181 base array).  This allows people to join (or subscribe to) a group
182 without having to modify the group entry directly.  If joinable is
183 FALSE, the search is not done.
184
185 Finally, keep in mind that this is somewhat experimental at the moment.
186 We are using it in production at U-M, but your mileage may vary...