summaryrefslogtreecommitdiff
path: root/doc/texinfo/programs/imap4d.texi
blob: 43217328abe1e9a3a61fd8dc0d7813897fa598c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
@c This is part of the GNU Mailutils manual.
@c Copyright (C) 1999-2020 Free Software Foundation, Inc.
@c See file mailutils.texi for copying conditions.
@comment *******************************************************************
@pindex imap4d

GNU @command{imap4d} is a daemon implementing @sc{imap4} rev1 protocol
for accessing and handling electronic mail messages on a server.  It can
be run either as a standalone program or from @file{inetd.conf} file.

@menu
* Namespace::       Namespace.
* Conf-imap4d::     Configuration.
* Starting imap4d:: Invocation Options.
@end menu

@node Namespace
@subsection Namespace
@cindex namespace
@cindex IMAP4 namespace

GNU @command{imap4d} supports a notion of @dfn{namespaces} defined
in RFC 2342.  A namespace can be regarded as a list of entities,
defining locations to which the user has certain access rights.  Each
entity includes the @dfn{prefix}, under which the mailboxes can be
found, @dfn{hierarchy delimiter}, a character used to delimit parts of
a path to a mailbox, and a @dfn{directory} on the file system on the
server, which actually holds the mailboxes.  Among these three values,
only first two are visible to the client using the IMAP
@samp{NAMESPACE} command.

There are three namespaces:

@table @asis
@item Personal Namespace
A namespace that is within the personal scope of the authenticated user
on a particular connection.  The user has all permissions on this
namespace.

By default, this namespace contains a single prefix:

@example
prefix: ""
delimiter: /
directory: home directory of the user
@end example

@item Other Users' Namespace
A namespace that consists of mailboxes from the ``Personal Namespaces''
of other users.  The user can read and list mailboxes from this
namespace.  However, he is not allowed to use @samp{%} and @samp{*}
wildcards with @command{LIST} command, that is he can access a
mailbox only if he knows exactly its location.

By default, this namespace is empty.

@item Shared Namespace
A namespace that consists of mailboxes that are intended to be shared
amongst users and do not exist within a user's Personal Namespace.
The user has all permissions on this namespace.

By default, this namespace is empty.
@end table

The default values ensure that each user is able to
see or otherwise access mailboxes residing in the directories other than
his own home.

These defaults can be changed using the @code{namespace} block
statement:

@example
namespace @var{name} @{
    mailbox-mode @var{mode};
    prefix @var{pfx} @{
      directory @var{path};
      delimiter @var{chr};
      mailbox-type @var{type};
    @}
@}
@end example

The @var{name} argument to the @code{namespace} statement declares
which namespace is being configured.  Allowed values are:
@samp{personal}, @samp{other}, and @samp{shared}.

The @code{mailbox-mode} statement configures the file mode for the
mailboxes created within that namespace (provided that the directory
permissions allow the user to create mailboxes).  The @var{mode}
argument is a comma-delimited list of symbolic mode settings, similar
to that used by @command{chmod}.  Each setting begins with a
letter @samp{g}, which means set mode bits for file group, or
@samp{o}, which means set mode bits for other users (note, that there
is no @samp{u} specifier, since user ownership of his mailbox cannot
be changed).  This letter is followed by an @samp{=} (or @samp{+}), and
a list of modes to be set.  This list can contain only two letters:
@samp{r} to set read permission, and @samp{w} to set write permission.

For example, the following statement sets read and write permissions
for the group:

@example
mailbox-mode g=rw;
@end example

The @code{prefix} statement configures available prefixes and
determines their mappings to the server's file system.  The @var{pfx}
argument defines the prefix which will be visible to the IMAP client.

The @code{directory} statement defines the directory in the file
system to which @var{pfx} is mapped.  Exactly one @code{directory}
statement must be present in each @code{prefix} block.  The
inerpretation of its argument depends on the namespace in which it
occurs.

When used in the @samp{namespace shared} block, the argument to this
statement is interpreted verbatim, as an absolute pathname.

When used in @samp{namespace personal} the argument to 
@code{directory} statement can contain references to the following
variables (@pxref{Variables}):

@table @asis
@item user
Login name of the user.

@item home
Home directory of the user.
@end table

For example, the following statement maps the default personal
namespace to the directory @samp{imap} in the user's home directory:

@example
@group
namespace personal @{
  prefix "";
  directory "$home/imap";
@}
@end group
@end example

If the @samp{directory} statement is used within the @samp{namespace
other} block, its value can contain the @samp{$user} and
@samp{$home} variables as well, but their meaning is different.  For
the @samp{other} namespace, the @samp{$user} variable is expanded
to the part of the actual reference contained between the prefix and
first hierarchy delimiter (or the end of the reference, if no
delimiter occurs to the right of the prefix).  Correspondingly,
@samp{$home} expands to the home directory of that user.  Consider,
for example, the following statement:

@example
@group
namespace other @{
  prefix "~";
  directory "/var/imap/$user";
@}  
@end group
@end example

If the client issues the following statement:

@example
1 LIST "~smith" "%"
@end example

@noindent
then @samp{$user} will expand to the string @samp{smith} and the
server will look for all mailboxes in the directory 
@file{/var/imap/smith}.

The @code{delimiter} statement defines the folder hierarchy delimiter
for that prefix.  It is optional, the default value being @samp{"/"}.

The @code{mailbox-type} statement declares the type of the mailboxes
within that prefix.   If present, its argument must be a valid mailbox
type (e.g. @samp{mailbox}, @samp{maildir}, or @samp{mh}).  The IMAP
@code{LIST} command will display only mailboxes of that type.  The
@code{CREATE} command will create mailboxes of that type.

In the absence of the @code{mailbox-type} statement, the IMAP
@code{LIST} command will display mailboxes of any type supported by
Mailutils.  The type of newly-created mailboxes is then determined by
the @code{mailbox-type} statement (@pxref{mailbox-type}).

Any number of @code{prefix} blocks can be present.  

Consider, for example, the following configuration:

@example
@group
namespace personal @{
   prefix "" @{
      directory "$home/mailfolder";
   @}   
   prefix "#MH:" @{
      directory "$home/Mail";
      delimiter "/";
      mailbox-type "mh";
   @}
@}
@end group
@end example

It defines the personal namespace containing two prefixes.  The empty
prefix is mapped to the directory @file{mailfolder} in the home
directory of the currently authenticated user.  Any type of mailboxes
is supported within that prefix.

The prefix @samp{#MH:} is mapped to the directory @file{Mail} in the
home directory of the user, and is limited to contain only mailboxes
in MH format.

Note that if the prefixes @samp{""} is not defined in the personal
namespace, the following default will be automatically created:

@example
@group
prefix "" @{
  directory "$home";
@}
@end group
@end example

@node Conf-imap4d
@subsection Configuration of @command{imap4d}.

The behavior of @command{imap4d} is altered by the following
configuration statements:

@multitable @columnfractions 0.3 0.6
@headitem Statement @tab Reference
@item debug         @tab @xref{debug statement}.
@item tls           @tab @xref{tls statement}.
@item tls-file-checks @tab @xref{tls-file-checks statement}.
@item mailbox       @tab @xref{mailbox statement}.
@item locking       @tab @xref{locking statement}.
@item logging       @tab @xref{logging statement}.
@item pam           @tab @xref{pam statement}.
@item sql           @tab @xref{sql statement}.
@item virtdomain    @tab @xref{virtdomain statement}.
@item radius        @tab @xref{radius statement}.
@item ldap          @tab @xref{ldap statement}.
@item auth          @tab @xref{auth statement}.
@item server        @tab @xref{Server Settings}.
@item acl           @tab @xref{acl statement}.
@item tcp-wrappers  @tab @xref{tcp-wrappers statement}.
@end multitable

@deffn {Imap4d Conf} namespace @var{name} @{ ... @}
Configures namespace.  The argument is one of: @samp{personal},
@samp{other}, @samp{shared}.  The following statements (described
below) are allowed within curly braces: @code{mailbox-mode} and
@code{prefix}.

@xref{Namespace}.
@end deffn

@deffn {Imap4d namespace} mailbox-mode @var{mode}
Configures the file mode for the mailboxes created within that
namespace.  The syntax for @var{mode} is:

@example
g(+|=)[wr]+,o(+|=)[wr]+
@end example

@xref{Namespace,mailbox-mode}.
@end deffn

@deffn {Imap4d namespace} prefix @var{pfx} @{ ... @}
Configures a prefix and determines its mapping to the server's file
system.  The @var{pfx} argument is the prefix which will be
visible to the IMAP client.  Available sub-statements are:
@code{directory}, @code{delimiter}, and @code{mailbox-type}.

@xref{Namespace,prefix}.
@end deffn

@deffn {Imap4d namespace.prefix} directory @var{path}
Defines the directory in the file system to which the prefix is
mapped.

@xref{Namespace,directory}.
@end deffn

@deffn {Imap4d namespace.prefix} delimiter @var{chr}
Defines the folder hierarchy delimiter for the prefix.  Argument must
be a single character.

@xref{Namespace,delimiter}.
@end deffn

@deffn {Imap4d namespace.prefix} mailbox-type @var{type}
Defines the type of the mailboxes inside that prefix.

@xref{Namespace,mailbox-type}.
@end deffn

@deffn {Imap4d Conf} login-disabled @var{bool}
Disable @code{LOGIN} command, if @var{bool} is @samp{true}.
@end deffn

@deffn {Imap4d Conf} create-home-dir @var{bool}
Create nonexistent user home directories.  See also home-dir-mode, below.
@end deffn

@deffn {Imap4d Conf} home-dir-mode @var{mode}
Set file mode for created user home directories.  Mode is specified in
octal.

The default value for @var{mode} is @samp{700} (@samp{drwx------} in
@code{ls} terms).  
@end deffn

@deffn {Imap4d Conf} preauth @var{mode}
Configure PREAUTH mode.  Valid arguments are:

@table @asis
@item prog:///@var{program-name}
@command{Imap4d} invokes an external program to authenticate the
connection.  The command line is obtained from the supplied string,
by expanding the following meta-variables:

@table @code
@item $@{client_address@}
Remote IP address in dotted-quad notation;

@item $@{client_port@}
Remote port number;

@item $@{server_address@}
Local IP address;

@item $@{server_port@}
Local port number.
@end table

If the connection is authenticated, the program should print the
user name, followed by a newline character, on its standard
output and exit with code @samp{0}.

Otherwise, it should exit with a non-zero exit code.

@item ident[://:@var{port}]
The remote machine is asked about the requester identity
using the identification protocol (RFC 1413).  Both plaintext and
DES encrypted replies are understood.  Optional @var{port} specifies
the port to use, if it differs from the default @samp{113}.  It can be
either a decimal port number or a symbolic name of a service, listed
in @file{/etc/services}.

@item stdio
PREAUTH mode is enabled automatically if imap4d is started
from command line in interactive mode (@option{-i} command line
option).  The current login name is used as the user name.
@end table
@end deffn

@deffn {Imap4d Conf} preauth-only @var{bool}
If @var{bool} is @samp{true}, use only preauth mode.  If unable to
setup it, disconnect immediately.
@end deffn

@deffn {Imap4d Conf} ident-keyfile @var{file}
Set DES keyfile for decoding encrypted ident responses.  Used with
@samp{ident://} preauth mode.
@end deffn

@deffn {Imap4d Conf} ident-encrypt-only @var{bool}
Use only encrypted IDENT responses.
@end deffn

@deffn {Imap4d Conf} id-fields @var{list}
Set list of fields to return in response to ID command.

Valid field names are:

@table @asis
@item name
Package name (@samp{GNU Mailutils}).

@item version
Package version (@samp{@value{VERSION}}).

@item vendor
Vendor name (@samp{GNU}).

@item support-url
The string @samp{http://www.gnu.org/software/mailutils}

@item address
The string @samp{51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA}.

@item os
OS name.

@item os-version
OS version number.

@item command
Name of the @command{imap4d} binary.

@item arguments
Invocation command line.

@item environment
List of environment variables with their values.
@end table

@end deffn

@node Starting imap4d
@subsection Starting @command{imap4d}

@command{imap4d} may run either in @dfn{standalone} or in @dfn{inetd}
operation modes.  When run in ``standalone'' mode, the server disconnects
from the terminal and runs as a daemon, forking a child for each new
connection.

The ``inetd'' mode allows to start the server from
@file{/etc/inetd.conf} file.  This is the default operation mode. 

@example
imap4  stream tcp nowait  root  /usr/local/sbin/imap4d imap4d
@end example

@subheading Command Line Options

@table @option
@item -d[@var{number}]
@itemx --daemon[=@var{number}]
Run in standalone mode.  An optional @var{number} specifies the maximum number
of child processes the daemon is allowed to fork.  When it is omitted,
it defaults to 20 processes.
@emph{Please note}, that there should be no whitespace between the
@option{-d} and its parameter.

@item -i
@itemx --inetd
Run in inetd mode.

@item --foreground
Run in foreground.

@item --preauth
Start in preauth mode

@item --test
Run in test mode.
@end table

See also @ref{Common Options}.

Return to:

Send suggestions and report system problems to the System administrator.