auth.m4, base.m4, exchange.m4: Make sender-address checking universal.
[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
185b5456
MW
261* COMMENT Emacs cruft
262
de67b50e
MW
263#+LaTeX_CLASS: strayman
264
185b5456
MW
265### Local variables:
266### mode: org
267### End: