chiark / gitweb /
user-spam.m4: Fix indentation in the output.
[exim-config] / README
CommitLineData
185b5456
MW
1The =distorted.org.uk= mail system
2
3* Delivery
4
5The mail delivery agent is Exim. If you don't do anything special, mail
6is delivered into =/var/mail/USER= on stratocaster, in mbox format.
7
8There are a number of ways you can affect mail delivery.
9
10** The =~/.forward= file
11
12In traditional Unix style, you can write delivery instructions into a
13file named =.forward= in your home directory. This file can contain a
14comma-separated list of email address and/or file or directory names to
15which your mail should be sent. Mail is written to files in traditional
16Unix `mbox' format, and to directories in `Maildir' format. The
17=:fail:= and =:defer:= items are permitted, but may not be very useful.
18
19This file can instead be an Exim or Sieve filter file, as marked by a
20special comment on the first line. See the document `Exim's interfaces
21to mail filtering', available via the command =info filter=, for details
22about these files.
23
24** The =~/.mail/forward= file
25
26If you prefer, you can write delivery instructions to =~/.mail/forward=
27instead. If you have lots of mail configuration files, you may find it
de67b50e 28tidier to keep them all together in =~/.mail/=.
185b5456
MW
29
30** The =~/.mail/forward.suffix= file
31
32You will receive mail sent to =USER@distorted.org.uk=. You can also
33receive mail sent to =USER-SUFFIX@distorted.org.uk= or
34=USER+SUFFIX@distorted.org.uk=, for any =SUFFIX= string if you create a
35file =~/.mail/forward.suffix=. While this can be a simple forward file,
36it's probably much more useful to write an Exim filter file to analyse
37the suffix string and take appropriate action.
38
39If this file exists, it should be world-readable, because it will be
40used by the mail server at SMTP time in order to decide whether a
41particular =SUFFIX= string is valid.
42
de67b50e
MW
43** Permissions for filter files
44
45Your various filter files are used by Exim's SMTP server, which runs as
46an unprivileged user =Debian-exim= for security reasons. Therefore your
47filter files must be readable by this user. Currently, the only way to
48do this is to make the filter files world-readable. If this is
49unsatisfactory for some reason I'll try to come up with a way to arrange
50privacy for your filters.
51
185b5456
MW
52
53* Reading mail
54
55** Reading mail locally
56
57The servers =stratocaster= and =jem= have a few mail user agents
58installed, most notably trad BSD =mail=, =mutt=, and Emacs's various
de67b50e
MW
59mail-reading interfaces; more can be added. Your mail is delivered to
60=/var/mail/USER=; any further arrangements, e.g., multiple folders, are
61left to you.
185b5456
MW
62
63** Fetching mail through IMAP
64
de67b50e
MW
65There's an IMAP server running on =mail.distorted.org.uk=. It expects
66your main inbox to be in =/var/mail/USER=, and further folders are put
67in =~/mail/=, in mbox format.
68
69The IMAP server listens on ports 143 (plain IMAP) and 993 (IMAP over
70TLS). In the former case, you'll have to configure your client to send
71=STARTTLS=, because the server simply won't allow non-encrypted
72communication.
73
74The server's certificate is signed by my certificate authority, whose
75own certificate can be fetched from
76https://www.distorted.org.uk/ca/ca.cert. (The web server's certificate
77is signed by the StartCom Class 1 CA, which should be in most browser's
78certificate stores.) I issue new short-term certificates daily, so
79telling your mail client to pin the certificate won't help. (The public
80key doesn't change, though, so if you can do public-key pinning you'll
81be OK.)
185b5456
MW
82
83** Forwarding mail off-site
84
de67b50e
MW
85You can redirect all of your mail to some other site if you prefer to
86consolidate it: just write the destination mailbox to =~/.forward=.
87Everything else is left to you.
88
89
90* Sending mail
91
92** The =sendmail= program
93
94Exim provides a =/usr/sbin/sendmail= program with a plausible interface,
95and most traditional Unix programs will use this by default to send
96mail.
97
98** SMTP to =localhost=
99
100Another traditional way of submitting mail is by connecting to port 25
101on the loopback address 127.0.0.1 and speaking SMTP. This will work on
102most servers, and you will be authenticated automatically using the
103system's =identd=. NB: servers other than stratocaster won't
104understand unusual domains.
105
106** The Submission protocol
107
108The `modern' way to submit mail involves connecting to port 587 on the
109=mail.distorted.org.uk= (the `submission' service) and speaking SMTP.
110If you use this service, then (a) you must tell your client to send
111=STARTTLS=, and (b) you will have to provide a user name and password.
112
113As with IMAP, the SMTP server's certificate is signed by the
114=distorted.org.uk= CA; see above.
115
116** Sender authenticity
117
118It is my intention that it be very hard for one =distorted.org.uk= user
119to impersonate another to a third. To this end, the mail server is
120rather picky about envelope sender addresses.
121
122 + It won't accept an apparently local sender address from an external
123 mail server at all.
124
125 + It will check locally submitted mail against the submitter's user
126 name. The precise details vary according to the submission
127 mechanism: mail submitted through =sendmail= will have additional
128 headers added; mail submitted through SMTP will be rejected unless
129 the envelope sender is acceptable.
130
131If I see something like DKIM catching on then this will also provide
132external users with some kind of (probably fairly weak) sender
133authenticity.
134
135On the other hand, the mail server is aware of vanity domains, extension
136addresses, and so on, and should let you send mail apparently from an
137such an address that you control. If you think the mail server is being
138unnecessarily strict about something then I'm willing to discuss your
139requirements.
140
141If I'm hosting your mail domain for you then you get to decide the
142appropriate policy.
143
144
145* Chopwood, and passwords
146
147Users don't have login passwords on =distorted.org.uk= machines; but the
148SMTP and IMAP services require user names and passwords, which are
149managed using the `Chopwood' service (whose name is `chpwd' -- short for
150`change password' -- with some additional vowels).
151
152You can communicate with Chopwood in three different ways.
153
154 1. Using Userv. On stratocaster, run =userv chpwd help= for a list
155 of commands.
156
157 2. Using SSH. You will need to send me an SSH public key (or
158 several), which I'll install for you. Then you'll be able to run
159 =ssh chpwd@stratocaster.distorted.org.uk help= for a list of
160 commands, as for Userv. (This is mainly intended for people who
161 don't have login accounts.)
162
163 3. Using the web interface. Point your browser at
164 =https://www.distorted.org.uk/chpwd/=. For this, you'll need a
165 user name and password for Chopwood itself: if you have a local
166 login, you can set this up yourself using Userv (say); otherwise
167 I'll generate a password for you and send it to you.
168
169If you're using Userv or SSH, you can list which password-using services
170you have accounts with the =list= command, and request new passwords
171with =reset=, which prints the new password to stdout; the =clear=
172command will disable a service's password, preventing you from logging
173in at all. There is a command =set= for setting a password that you
174choose, but that's disabled as a matter of local policy: it's possible
175that I can be persuaded to enable it, but not very likely. Note that
176you can reset several services' passwords with the same command, and
177this will use the same (freshly generated) password for all of them.
178For example,
179
180: userv chpwd reset smtp imap
181
182will generate a new password which will work both with the SMTP
183submission service and the IMAP server.
184
185Similar functionality is available through the web interface.
186
185b5456
MW
187
188* Spam filtering
189
190The mail server checks incoming mail using SpamAssassin at SMTP time.
191Suspected spam is rejected immediately. There are no `junk' mail
192folders. Legitimate senders will likely receive bounces; spammers will
193probably ignore the error and continue.
194
195** SpamAssassin
196
197SpamAssassin works by having a large collection of rules: it tests an
198incoming message against these rules, and adds up the /scores/ for the
199rules that match. If the total score is above a given threshold then
200the message is declared to be probably spam, and rejected.
201
202If the mail server accepts a message, it adds two headers to it.
203
204 + =X-SpamAssassin-Score= has the form =SCORE/LIMIT (BAR)=, where
205 =SCORE= is the actual score for the message, =LIMIT= is the maximum
206 score allowed, and =BAR= is a little bar chart showing the score in
207 a way which can be matched easily using regular expressions. The
208 bar chart uses =+= or =-= signs, depending on whether the score is
209 positive or negative, or consists of a single =/= sign if it's close
210 to zero.
211
212 + =X-SpamAssassin-Status= consists of space-separated =KEY=VAUE=
213 pairs. The keys currently are: =score= and =limit=, which are the
214 message's score and limit again; and =tests=, which lists the rules
215 which matched the message and their individual scores, as a
216 comma-separated list of items of the form =RULE:SCORE=.
217
218** Custom spam limits
219
220The default spam limit is currently 5 points. However, you can override
221this limit for mail sent to you by creating a world-readable file
222=~/.mail/spam-limit= in your home directory on stratocaster. This file
223should contain lines of the form
224
225: PATTERN: LIMIT
226
227where =PATTERN= is an Exim =nwildlsearch= pattern matched against a
228string of the form =RECIPIENT/SENDER=, and the =LIMIT= is ten times the
229maximum SpamAssassin score you're willing to tolerate for this message.
230See the Exim manual for full details; in short, the pattern may be a
231literal string, a string beginning with a =*= to match a particular
232suffix (usually a sender address or domain, which is why the sender is
233on the right), or a Perl-style regular expression starting with =^=.
234
235You may not want information about who is sending you spam (or honest
236but spamlike mail) to be public knowledge, so instead you can make a
237file =~/.mail/spam-limit.userv= of the same format. This file need not
238be readable by anyone other than you.
239
240Be careful with this facility: if a single incoming message has multiple
241recipients, and they assign it different spam score limits (either
242explicitly, or implicitly by accepting the system default) then the
243sender will be told to defer delivery to some recipients. It's
244therefore probably a bad idea to apply custom spam score limits for mail
245for popular mailing lists, for example.
246
247** SAUCE
248
249I'm not currently running SAUCE, but I'm giving it some consideration.
250If you have comments on the matter, either way, I'm interested.
185b5456
MW
251
252
253* Mail hosting and custom domains
254
255I think I have a fairly sane way to set up stratocaster (or some other
256server, but strat is the obvious choice) to receive mail for domains
257other than =distorted.org.uk=. I can easily arrange to accept mail for
258such domains and deliver them locally or to other hosts. Pester me if
259this sounds useful to you.
260
cf699684
MW
261
262* Technical documentation
263
264** =auth-sender.conf=
265
266This file is an =lsearch=-format map from user names to address lists
267that the users are allowed to claim as envelope senders. (For domains
268hosted locally, the *users* and *locals* options of =domains.conf= works
269better: this mechanism is intended to allow users to send mail
270apparently from their Gmail addresses, for example.)
271
272** =domains.conf=
273
274Most of the special knowledge for the mail configuration is in
275=/etc/mail/domains.conf=. This contains a number of stanzas, each
276headed by a domain pattern, and containing a sequence of /key/ = /value/
277pairs. If a /value/ contains whitespace then it must be quoted. In
278terms of Exim syntax, this is a `partial0-wildlsearch' file where the
279values are =${extract ...}= strings.
280
281The following keys are recognized. Nothing will save you if you spell
282the name of a key wrongly.
283
284 + errors_to :: Sets =errors_to= for deliveries to a virtual domain --
285 see [[info:spec:Generic%20options%20for%20routers][Generic options for routers]]. The default is to send errors to
286 the sender, as usual.
287
288 + filter :: Specifies the name (subject to expansion) of a filter file
289 to use for routing mail to a virtual domain. The filter file may
290 use full the Exim filtering language, and may cause deferrals,
291 failures, or blackholing. This is one of a number of mutually
292 exclusive router options: see also *redirect* and *route*.
293
294 + final :: If true (the default, if there is an entry for the
295 receiving domain), then recipients not routed through the
296 =domains.conf= file are assumed not to exist. (As a last ditch
297 measure, mail to the special local-parts =postmaster= and =abuse= is
298 redirected to the global administrator.) If false, local parts not
299 routed using the =domains.conf= machinery are handled as for the
300 main system domain.
301
302 + home :: The home directory for the virtual domain administrator.
303 This is available to other expansions as =$home=.
304
305 + hosts :: A list of host names and/or addresses which are permitted
306 to send mail from this domain. If this key is omitted, but there is
307 a matching =domains.conf= entry for the domain, then the default is
308 the list of known networks =+allnets=; otherwise the default is all
309 external networks.
310
311 + locals :: A list (expanded) of those local-parts which the
312 authenticated user (named by =$acl_c_user=) is permitted to use as
313 the sender on outgoing messages.
314
315 + owner :: The name of the user who should perform local deliveries to
316 this virtual domain.
317
318 + redirect :: Redirection data (expanded) for deliveries to this
319 virtual domain. This is one of a number of mutually exclusive
320 router options: see also *filter* and *route*.
321
322 + require-auth :: If true, then the recipient domain requires us to
323 perform SMTP authentication to it. The necessary credentials are in
324 =/etc/mail/client-secrets=, which is in =partial0-lsearch= format,
325 keyed by either the recipient domain or host, and the values are
326 =${extract ...}=-format key/value pairs which depend on the
327 authenticator to use. For PLAIN authentication, set *plain* to the
328 string to send (using =^= to stand for NUL bytes, e.g.,
329 =^user^passwd=). For LOGIN, set *login-name* and *login-passwd*.
330 For CRAM-MD5, set *cram-md5-name* and *cram-md5-secret*.
331
332 + route :: Routing data (=route_data= for Exim's =manualroute=
333 transport) for sending mail to the domain. This is one of a number
334 of mutually exclusive router options: see also *filter* and
335 *redirect*.
336
337 + senders :: A list of sender addresses (not local-parts) which are
338 known to be valid from the sending domain: the usual sender
339 verification is skipped for such addresses. This is a hack for
340 sending domains which have misconfigured MX records.
341
342 + service :: If true (the default if an entry is found) , then we
343 provide main mail service for this domain.
344
345 + spam-check :: If true, then check incoming mail to this domain for
346 spam. Only overridden for special effects.
347
348 + spam-limit-file :: The name of a file in =nwildlsearch= format in
349 which to look up RECIPIENT/SENDER to find a spam-score limit for a
350 message sent to the virtual domain.
351
352 + spam-limit-userv :: The name of a user whose =exim-spam-limit= Userv
353 service should be invoked to find the spam-score limit for a message
354 sent to the virtual domain.
355
356 + tls-certificate :: The name (subject to expansion) of a file
357 containing the TLS client certificate list to present when sending
358 mail to this domain. Requires a *route* entry for the target
359 domain.
360
361 + tls-ciphers :: A list (subject to expansion) of permitted
362 ciphersuite names when delivering mail to this domain.
363 Alternatively, this can be one of the special keywords *good* or
364 *any*, for the preconfigured known-strong and any-acceptable lists.
365 Requires a *route* entry for the target domain.
366
367 + tls-min-dh-bits :: When routing to this domain, ensure that the
368 order of the Diffie--Hellman group used for forward-secure key
369 exchange has at least this many bits. Because the Exim
370 =tls_dh_min_bits= option doesn't actually allow expansion, only
371 *1024* and *2048* are valid values for this option. Requires a
372 *route* entry for the target domain.
373
374 + tls-peer-ca :: The name (subject to expansion) of a file containing
375 acceptable trust anchors for verifying the server's certificate when
376 delivering to this domain (and to require TLS for the
377 communication). The default is to not worry about TLS. Requires a
378 *route* entry for the target domain.
379
380 + tls-private-key :: The name (subject to expansion) of a file
381 containing the private key to use to authenticate to a server when
382 delivering to this domain. Requires a *route* entry for the domain.
383
384 + users :: A list (subject to expansion) of user names (matched as
385 local parts) of users who are permitted to send mail from this
386 domain.
387
388
389** =helo.conf=
390
391This file is a =partial0-lsearch=-format map from HELO names to
392=match_ip= lists of IP addresses which are permitted to claim that name.
393This is intended to deal with hosts whose DNS configuration doesn't
394match their HELO announcement.
395
185b5456
MW
396* COMMENT Emacs cruft
397
de67b50e
MW
398#+LaTeX_CLASS: strayman
399
185b5456
MW
400### Local variables:
401### mode: org
402### End: