chiark / gitweb /
Up to halfway down rhs p.12, inc builtin services, but not working yet.
[userv.git] / spec.sgml
1 <!doctype debiandoc system>
2 <book>
3 <title>User service daemon and client specification
4 <author>Ian Jackson <email>ian@chiark.greenend.org.uk
5 <version>draft 0.17
6
7 <abstract>
8 This is a specification for a Unix system facility to allow one
9 program to invoke another when only limited trust exists
10 between them.
11
12 <copyright>
13 Copyright 1996-1997 Ian Jackson.
14 <p>
15
16 <prgn/userv/ is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or (at
19 your option) any later version.
20 <p>
21
22 This program is distributed in the hope that it will be useful, but
23 <em/without any warranty/; without even the implied warranty of
24 <em/merchantability/ or <em/fitness for a particular purpose/.  See
25 the GNU General Public License for more details.
26 <p>
27
28 You should have received a copy of the GNU General Public License
29 along with <prgn/userv/; if not, write to the Free Software
30 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31
32 <toc sect>
33
34 <chapt id="intro">Introduction
35 <p>
36 There is a daemon which invokes user service programs (henceforth
37 `services') in response to requests by callers of a companion client
38 program (henceforth the `client') and according to rules set forth in
39 system-wide and user-specific configuration files.  The companion
40 client program is setuid root, and negotiates with the daemon through
41 an <tt/AF_UNIX/ socket and associated objects in a system-wide private
42 directory set aside for the purpose.  The user who wishes the service
43 to be performed and calls the client is called the `calling user'; the
44 process which calls the client is called the `calling process'.
45
46 <p>
47 The daemon and the client are responsible for ensuring that
48 information is safely carried across the security boundary between the
49 two users, and that the processes on either side cannot interact with
50 each other in any unexpected ways.
51
52 <chapt id="client">Client program usage
53
54 <p>
55 <example>
56 userv <var/options/ [--] <var/service-user/ <var/service-name/ [<var/argument/ ...]
57 userv <var/options/ -B|--builtin [--] <var/builtin-service/ [<var/info-argument/ ...]
58 </example>
59 <p>
60
61 <var/service-user/ specifies which user is to provide the service.
62 The user may be a login name or a numeric uid, or <tt/-/ to indicate
63 that the service user is to be the same as the calling user.
64 <p>
65
66 The service name is interpreted by the userv<footnote><tt/userv/ is
67 short for `user services', and is pronounced `you-serve'.</footnote>
68 daemon on behalf of the service user.  It will often be the name of a
69 program.
70
71 <sect>Options
72 <p>
73
74 Single-letter options may be combined as is usual with Unix programs,
75 and the value for such an option may appear in the same argument or in
76 the next.
77
78 <taglist>
79 <tag/<tt/-B//
80 <tag/<tt/--builtin//
81 <item>
82 Requests that a builtin service be provided.  This is equivalent to
83 using the <tt/--override/ option to specify a string consisting of
84 <tt/--execute-builtin/ followed by the <var/builtin-service/
85 requested, and requesting a service user of <tt/-/ (indicating the
86 calling user).  Note that the <var/info argument/s supplied will be
87 ignored by most services; if the builtin service being requested
88 requires a <var/service-argument/ then this must be supplied to the
89 client in the same argument as the <var/builtin-service/.  See <ref
90 id="execdirectives"> for details of the builtin services available,
91 and <ref id="optoverride"> for details of the <tt/--override/ options.
92
93 <tag/<tt/-f<var/fd/[<var/modifiers/]=<var/filename///
94 <tag/<tt/--file <var/fd/[<var/modifiers/]=<var/filename///
95 <item>
96 Requests that data be copied in and out of the service using pipes.
97 For each file or descriptor this will be done by creating a pipe, one
98 end of which is passed to the service program and the other end of
99 which is passed to a copy of <prgn/cat/ invoked by the client; the
100 other file descriptor passed to <prgn/cat/ will be one inherited by
101 the client program from the caller or one opened by the client program
102 on behalf of the caller.
103 <p>
104
105 The descriptor in the service program that should be connected must be
106 specified as <var/fd/, either as a decimal number or as one of the
107 strings <tt/stdin/, <tt/stdout/ or <tt/stderr/.  The next argument is
108 a filename which will be opened by the client with the privileges of
109 the calling user.
110
111 <p>
112 <var/modifiers/ is used to specify whether the file or descriptor is
113 to be read from or written to.  It consists of a series of words
114 separated by commas.  A comma may separate the <var/modifiers/ from
115 the <var/fd/ and is required if <var/fd/ is not numeric.
116
117 <p>
118 The modifier words are:
119 <taglist compact>
120 <tag/<tt/read//
121 <item>
122 <tt/O_RDONLY/: Allow reading and not writing.  May not be used with
123 <tt/write/ or things that imply it.
124
125 <tag/<tt/write//
126 <item>
127 <tt/O_WRONLY/: Allow writing and not reading.  <em/Doesn't truncate or
128 create/ without <tt/truncate/ or <tt/create/.  <tt/write/ or things
129 that imply it may not be used with <tt/read/.
130
131 <tag/<tt/overwrite//
132 <item>
133 Equivalent to <tt/write,create,truncate/.
134
135 <tag/<tt/create//
136 <tag/<tt/creat//
137 <item>
138 <tt/O_CREAT/: Creates the file if necessary.  Implies <tt/write/.
139
140 <tag/<tt/exclusive//
141 <tag/<tt/excl//
142 <item>
143 <tt/O_EXCL/: Fails if the file already exists.  Implies <tt/write/ and
144 <tt/create/.  May not be used with <tt/truncate/.
145
146 <tag/<tt/truncate//
147 <tag/<tt/trunc//
148 <item>
149 <tt/O_TRUNC/: Truncate any existing file.  Implies <tt/write/.
150 May not be used with <tt/exclusive/.
151
152 <tag/<tt/append//
153 <item>
154 <tt/O_APPEND/: All writes will append to the file.  Implies <tt/write/.
155
156 <tag/<tt/sync//
157 <item>
158 <tt/O_SYNC/: Do writes synchronously.  Implies <tt/write/.
159
160 <tag/<tt/wait//
161 <tag/<tt/nowait//
162 <tag/<tt/close//
163 <item>
164
165 These modifiers control the behaviour of the client, with respect to
166 the pipes carrying data to and from the service, when the service
167 terminates.  See below.
168
169 <tag/<tt/fd//
170 <item>
171 The <var/filename/ is not a filename but a numeric file descriptor.
172 One or both of <tt/read/ and <tt/write/ must be specified, and no
173 other words are allowed.  The <var/filename/ may also be <tt/stdin/,
174 <tt/stdout/ or <tt/stderr/ for file descriptor 0, 1 or 2 respectively.
175
176 </taglist>
177 <p>
178
179 If no <var/modifiers/ which imply <tt/read/ or <tt/write/ are used it
180 is as if <tt/read/ had been specified, except that if the
181 filedescriptor 1 or 2 of the service is being opened (either specified
182 numerically or with <tt/stdout/ or <tt/stderr/) it is as if
183 <tt/overwrite/ had been specified (or <tt/write/ if only <tt/fd/ was
184 specified).
185 <p>
186
187 The client will also use <tt/O_NOCTTY/ when opening files specified by
188 the caller, to avoid changing its controlling terminal.
189 <p>
190
191 By default stdin, stdout and stderr of the service will be connected
192 to the corresponding descriptors on the client.  Diagnostics from
193 the client and daemon will also appear on stderr.
194 <p>
195
196 If <tt/wait/ is specified, the client will wait for the pipe to be
197 closed, and only exit after this has happened.  This means that either
198 the receiving end of the pipe connection was closed while data was
199 still available at the sending end, or that the end of file was
200 reached on the reading file descriptor.  Errors encountered reading or
201 writing in the client at this stage will be considered a system error
202 and cause the client to exit with status 255, but will not cause
203 disconnection at the service side since the service has already
204 exited.
205 <p>
206
207 If <tt/close/ is specified the client will immediately close the pipe
208 connection by killing the relevant copy of <prgn/cat/.  If the service
209 uses the descriptor it will get <prgn/SIGPIPE/ (or <prgn/EPIPE/) for a
210 writing descriptor or end of file for a reading one; the descriptor
211 opened by or passed to the client will also be closed.
212 <p>
213
214 If <tt/nowait/ is specified then the client will not wait and the
215 connection will remain open after the client terminates.  Data may
216 continue to be passed between the inheritors of the relevant
217 descriptor on the service side and the corresponding file or
218 descriptor on the client side until either side closes their
219 descriptor.  This should not usually be specified for stderr (or
220 stdout if <tt/--signals stdout/ is used) since diagnostics from
221 the service side may arrive after the client has exited and be
222 confused with expected output.
223 <p>
224
225 The default is <tt/wait/ for writing file descriptors and <tt/close/
226 for reading ones.
227
228 <tag/<tt/-w<var/fd/=<var/action///
229 <tag/<tt/--fdwait<var/fd/=<var/action///
230 <item>
231 Sets the action on termination of the service for the specified file
232 descriptor; <var/action/ must be <tt/wait/, <tt/nowait/ or <tt/close/
233 as described above.  The file descriptor must be specified as open
234 when this option is encountered; this option is overridden by any
235 later <tt/--file/ or <tt/--fdwait/ option - even by a <tt/--file/
236 which does not specify an action on termination (in this case the
237 default will be used, as described above).
238
239 <tag/<tt/-D<var/name/=<var/value///
240 <tag/<tt/--defvar <var/name/=<var/value///
241 <item>
242 Set a user-defined variable <var/name/ to <var/value/.  These
243 user-defined variables are made available in the configuration
244 language as the parameters <tt/u-<var/name// and are passed to the
245 service in environment variables <tt/USERV_U_<var/name//.  <var/name/
246 may contain only alphanumerics and underscores, and must start with a
247 letter.  If several definitions are given for the same <var/name/ then
248 only the last is effective.
249
250 <tag/<tt/-t <var/seconds///
251 <tag/<tt/--timeout <var/seconds///
252 <item>
253 Time out the service if it takes longer than <var/seconds/ seconds (a
254 positive integer, in decimal).  Timeout will produce a diagnostic on
255 stderr and an exit status of 255.  If <var/seconds/ is zero then no
256 timeout will be implemented (this is the default).
257
258 <tag/<tt/-S/ <var/method//
259 <tag/<tt/--signals/ <var/method//
260 <item>
261 Affects the handling of the exit status when the service terminates
262 due to a signal.  (The client will always finish by calling <tt/exit/,
263 so that only numbers from 0 to 255 can be returned and not the full
264 range of numbers and signal indications which can be returned by the
265 <tt/wait/ family of system calls.)
266 <p>
267
268 The <var/method/ may be one of the following:
269 <taglist compact>
270 <tag/<var/status/
271 <item>
272 The client's exit status will be <var/status/.  This will not be
273 distinguishable from the service really having exited with code
274 <var/status/.  This method is the default, with a <var/status/ of 254.
275
276 <tag/<tt/number//
277 <tag/<tt/number-nocore//
278 <item>
279 The client's exit status will be the number of the signal which caused
280 the termination of the service.  If <tt/number/ is used rather than
281 <tt/number-nocore/ then 128 will be added if the service dumped core.
282 <tt/number/ is very like the exit code mangling done by the Bourne
283 shell.
284
285 <tag/<tt/highbit//
286 <item>The client's exit status will be the number of the signal with
287 128 added.  If the service exits normally with an exit code of greater
288 than 127 then 127 will be returned.
289
290 <tag/<tt/stdout//
291 <item>
292 The service's numeric wait status as two decimal numbers (high byte
293 first) and a textual description of its meaning will be printed to the
294 client's standard output.  It will be preceded by a newline and
295 followed by an extra newline, and the numbers are separated from each
296 other and from the textual description by single spaces.  The exit
297 status of the client will be zero, unless a system error occurs in
298 which case no exit status and description will be printed to stdout,
299 and an error message will be printed to stderr as usual.
300 </taglist>
301
302 <p>
303 Problems such as client usage errors, the service not being found or
304 permission being denied or failure of a system call are system errors.
305 An error message describing the problem will be printed on the
306 client's stderr, and the client's exit status will be 255.  If the
307 client dies due to a signal this should be treated as a serious system
308 error.
309
310 <tag/<tt/-H//
311 <tag/<tt/--hidecwd//
312 <item>
313 Prevents the calling process's current directory name from being
314 passed to the service; the null string will be passed instead.
315
316 <tag/<tt/-P//
317 <tag/<tt/--sigpipe//
318 <item>
319 If the service program is terminated due to a <prgn/SIGPIPE/ the exit
320 status of the client will be zero, even if it would have been
321 something else according to the exit status method specified.  This
322 option has no effect on the code and description printed if the exit
323 status method <tt/stdout/ is in use.
324
325 <tag/<tt/-h//
326 <tag/<tt/--help//
327 <tag/<tt/--copyright//
328 <item>
329 <tt/-h/ or <tt/--help/ prints the client's usage message;
330 <tt/--copyright/ prints the copyright and lack of warranty notice.
331
332 </taglist>
333
334 <sect id="optoverride">Security-overriding options
335 <p>
336
337 There are also some options which are available for debugging and to
338 allow the system administrator to override a user's policy.  These
339 options are available only if the client is called by root or if the
340 calling user is the same as the service user.
341
342 <taglist>
343
344 <tag/<tt/--override <var/configuration-data///
345 <tag/<tt/--override-file <var/filename///
346 <item>
347 Do not read the usual configuration files.  Instead, the client sends
348 <var/configuration-data/ (followed by a newline) or the contents of
349 <var/filename/ (which is opened in the context of the client) to the
350 daemon and the daemon uses that data instead.  The
351 <var/configuration-data/ must all be in one argument.  It will have a
352 single newline appended so that a single directive can easily be
353 given, but if more than one directive is required it will have to
354 contain one or more real newlines.
355
356 <tag/<tt/--spoof-user <var/user///
357 <item>
358 Pretend to the service that it is being called by <var/user/ (which
359 may be a username or a uid).  This will also affect the group and
360 supplementary groups supplied to the service; they will be the
361 standard group and supplementary groups for <var/user/.
362
363 </taglist>
364
365
366 <chapt id="envir">Execution environment of the service program
367 <p>
368
369 The daemon which is handling the service user side of things will read
370 configuration files to decide what to do.  If it decides to allow the
371 service to be provided it will fork a subprocess to execute the
372 service.
373 <p>
374
375 The service will have no controlling terminal, but it will be a
376 process group leader.
377 <p>
378
379 If the client is killed or times out or a file or descriptor being
380 read or written by the client process gets an error then the service
381 will be disconnected from the client.  The client will return an exit
382 status of 255 and some the service's pipes may be closed at the other
383 end.  The service will become a child of <prgn/init/.  The service may
384 well not notice the disconnection, though writing to a pipe after this
385 may produce a <prgn/SIGPIPE/ and the facility exists to have a
386 <prgn/SIGHUP/ sent to the service on disconnection.
387
388 <sect>File descriptors
389 <p>
390
391 The service program's standard filedescriptors, and possibly other
392 file descriptors, will be connected to pipes or to
393 <prgn>/dev/null</>.  The <prgn/userv/ client/daemon pair will arrange
394 that data is copied between the files or file descriptors specified to
395 to the client by the caller and these these pipes.
396 <p>
397
398 Pipes which may be written to will be closed if a write error occurs
399 on the corresponding client-side file or descriptor, which may result
400 in a <prgn/SIGPIPE/ in the service program; pipes open for reading
401 will get <prgn/EOF/ if the client-side file descriptor gets <prgn/EOF/
402 or an error.
403 <p>
404
405 If the service closes one of its reading file descriptors the writing
406 end of the corresponding pipe will generate a <prgn/SIGPIPE/ when
407 attempts are made by the client/daemon pair to write to it.  This will
408 not be considered an error; rather, the relevant pipe will be
409 discarded and the corresponding file or file descriptor held by the
410 client will be closed.
411 <p>
412
413 Likewise, if one of the file descriptors held by the client for
414 writing by the service is a pipe whose other end is closed by the
415 caller then the client/daemon pair will see an error when trying to
416 copy data provided by the service.  This too will not be considered an
417 error; rather, the pipe correspondong to that descriptor will be
418 closed and any further writes will cause the service to get a
419 <prgn/SIGPIPE/.
420 <p>
421
422 Note that not all write errors or broken pipes on file descriptors may
423 be visible to the service, since buffered data may be discarded by the
424 operating system and there will be a finite interval between the error
425 happening and the service being disconnected from the client or the
426 next write causing a <prgn/SIGPIPE/.
427 <p>
428
429 Read errors on file descriptors (and disconnection) will only be
430 visible to the service and distinguishable from normal end of file if
431 <tt/disconnect-hup/ is in effect.
432 <p>
433
434 Read and write errors (other than broken pipes, as described above)
435 will always be visible to the caller; they are system errors, and will
436 therefore cause the client to print an error message to stderr and
437 return with an exit status of 255.
438 <p>
439
440 If the main service program process exits while it still has running
441 children any file descriptors held by those children can remain open,
442 depending on the use of <tt/wait/, <tt/nowait/ or <tt/close/ for the
443 relevant file descriptor in the client's arguments.  By default
444 writing filedescriptors remain open and the client will wait for them
445 to be closed at the service end, and reading file descriptors are
446 closed immediately.  These leftover child processes will not get a any
447 <tt/SIGHUP/ even if a read or write error occurs or the client
448 disconnects before then.
449
450 <sect>Environment
451 <p>
452
453 The service will have some information in environment variables:
454 <taglist compact>
455 <tag/<tt/USERV_USER//
456 <item>
457 The login name of the calling user.  If the <prgn/LOGNAME/ variable is
458 set (or, if that is unset, if the <prgn/USER/ variable is set) in the
459 environment passed to the client by the caller then the password entry
460 for that login name will be looked up; if that password entry's uid is
461 the same as that of the calling process then that login name will be
462 used, otherwise (or if neither <prgn/LOGNAME/ nor <prgn/USER/ is set)
463 the calling process's uid will be looked up to determine their login
464 name (and if this lookup fails then the service will not be invoked).
465
466 <tag/<tt/USERV_UID//
467 <item>
468 The uid of the calling process.
469
470 <tag/<tt/USERV_GID//
471 <item>
472 The gid and supplementary group list of the calling process: first the
473 group in gid and then those in the supplementary group list, in
474 decimal, separated by spaces.
475
476 <tag/<tt/USERV_GROUP//
477 <item>
478 The group names of the calling process, listed in the same way as the
479 ids are in <tt/USERV_GID/.  If no name can be found for any of the
480 calling process's group(s) then the service will not be invoked.
481
482 <tag/<tt/USERV_CWD//
483 <item>
484 The client's current working directory name (this directory may not be
485 accessible to the service).  If it could not be determined or the
486 <tt/--hidecwd/ flag was used then this variable will be set to an
487 empty string (this is not considered an error).
488
489 <tag/<tt/USERV_SERVICE//
490 <item>
491 The service name requested by the caller.
492
493 <tag/<tt/USERV_U_<var/name///
494 <item>
495 The value supplied to the client by the caller using -D<var/name/.
496
497 </taglist>
498
499 <prgn/HOME/, <prgn/PATH/, <prgn/SHELL/, <prgn/LOGNAME/ and <prgn/USER/
500 will be set appropriately (according to the details of the service
501 user).
502
503
504 <chapt id="config">Service-side configuration
505 <p>
506
507 Which services may be run by whom and under what conditions is
508 controlled by configuration files.
509 <p>
510
511 The daemon will read these files in order.  Certain directives in the
512 files modify the daemon's execution settings for invoking the service,
513 for example allowing certain file descriptors to be specified by the
514 client or specifying which program to execute to provide the service.
515 <p>
516
517 The <em/last/ instance of each such setting will take effect.  The
518 directives which specify which program to execute will not stop the
519 configuration file from being read; they will be remembered and will
520 only take effect if they are not overridden by a later directive.
521 <p>
522
523 The daemon will first read <tt>/etc/userv/system.default</>.  Then, by
524 default (this behaviour may be modified), it will read a per-user file
525 <tt>~/.userv/rc</>, if it exists and the service user's shell is in
526 <tt>/etc/shells</>.  Finally it will read
527 <tt>/etc/userv/system.override</>.
528 <p>
529
530 When it has read all of these files it will act according to the
531 currently values of of the execution settings.
532
533 <sect>Configuration file syntax
534 <p>
535
536 The configuration file is a series of directives, usually one per
537 line.  The portion of a line following a hash character <tt/#/ is
538 taken as a comment and ignored.  Each directive consists of a series
539 of tokens separated by linear whitespace (spaces and tabs); tokens may
540 be words consisting of non-space characters, or, where a string is
541 required, a string in double quotes.  Double-quoted strings may
542 contain the following backslash escapes:
543
544 <taglist compact>
545 <tag/<tt/\n//<item>newline
546 <tag/<tt/\t//<item>tab
547 <tag/<tt/\r//<item>carriage return
548 <tag/<tt/\<var/OOO///<item>character whose octal code is <var/OOO/
549 <tag/<tt/\x<var/XX///<item>character whose hex code is <var/XX/
550 <tag/<tt/\<var/punctuation///<item>literal punctuation character (eg <tt/\\/, <tt/\"/)
551 <tag/<tt/\<var/newline// (ie, backslash at end of line)/
552 <item>string continues on next line
553 </taglist>
554 <p>
555
556 Relative pathnames in directives are relative to the service program's
557 current directory (usually the service user's home directory).
558 Pathnames starting with the two characters <tt>~/</> are taken to be
559 relative to the service user's home directory.
560
561 <sect>Configuration file directives
562 <p>
563
564 <sect1>Immediate directives
565 <p>
566
567 The following directives take effect immediately:
568
569 <taglist>
570 <tag/<tt/cd <var/pathname///
571 <item>
572 Change directory in the service program.  <prgn/cd/ is cumulative.  It
573 is an error if the directory cannot be changed to.
574 <p>
575
576 <prgn/cd/ should not be used between <prgn/execute-from-directory/ and
577 the invocation of the service program, as the test for the
578 availability of the service program would be done with the old current
579 directory and the actual execution with the new (probably causing an
580 error).
581
582 <tag/<tt/eof//
583 <item>
584 Stop reading the configuration file in question, as if end of file had
585 been reached.  Any control constructs (<tt/if/, <tt/catch-quit/ or
586 <tt/errors-push/) which were started in that file will be considered
587 finished.  Parsing will continue in the file which caused the file
588 containing the <tt/eof/ to be read.
589
590 <tag/<tt/quit//
591 <item>
592 Stop reading configuration files and act immediately on the current
593 settings.  The behaviour of <tt/quit/ is subject to the
594 <tt/catch-quit/ control construct.
595
596 <tag/<tt/include <var/filename///
597 <tag/<tt/include-ifexist <var/filename///
598 <item>
599 Read the configuration file <var/filename/, and then return to this
600 file and continue parsing it with the next directive.  It is an error
601 if the file cannot be opened and read, unless <tt/include-ifexist/ is
602 used and the file does not exist, in which case the directive is
603 silently ignored.
604
605 <tag/<tt/include-lookup <var/parameter/ <var/directory///
606 <tag/<tt/include-lookup-all <var/parameter/ <var/directory///
607 <item>
608 Read the configuration file in <var/directory/ whose name is the value
609 of <var/parameter/ (see the description of <tt/if/, above).  If
610 <var/parameter/ has several values they will be tried in order; with
611 <tt/include-lookup/ this search will stop when one is found, but with
612 <tt/include-lookup-all/ the search will continue and any files
613 appropriate to other values will be read too.
614 <p>
615
616 If none of the parameter's values had a corresponding file then the
617 file <tt/:default/ will be read, if it exists.  If <var/parameter/'s
618 list of values was empty then the file <tt/:none/ will be tried first
619 and read if it exists, otherwise <tt/:default/ will be tried.
620 <p>
621
622 It is not an error for any of the files (including <tt/:default/) not
623 to exist, but it is an error if a file exists and cannot be read or if
624 the directory cannot be accessed.
625
626 <p>
627 A translation will be applied to values before they are used to
628 construct a filename, so that the lookup cannot access dotfiles or
629 files in other directories: values starting with full stops will have
630 a colon prepended (making <tt/:./), colons will be doubled, and each
631 slash will be replaced with a colon followed by a hyphen <tt>:-</>.  A
632 parameter value which is the empty string will be replaced with
633 <tt/:empty/ (note that this is different from a parameter not having
634 any values).
635
636 <tag/<tt/include-directory <var/directory///
637 <item>
638 Read configuration from all files in directory <var/directory/ which
639 are plain files whose names consist only of alphanumerics and hyphens
640 and start with an alphanumeric.  They will be read in lexical order.
641 It is an error for the directory not to exist or for it or any of the
642 files found not to be read successfully, or for anything with an
643 appropriate name not to be a plain file or a symbolic link to a plain
644 file.
645
646 <tag/<tt/error <var/text ...///
647 <item>
648 Causes an error whose message includes the descriptive string
649 <var/text/.  <var/text/ may consist of several tokens with intervening
650 whitespace.  The whitespace will be included in the message as found
651 in the configuration file: all the characters until the end of the
652 line will be included verbatim, unless they are part of a
653 double-quoted string, in which case the usual meaning of the string
654 (i.e., after backslash escape processing) will be used.  Comments and
655 linear whitespace at the end of the line (or just before the comment)
656 will still be ignored.
657
658 <tag/<tt/message <var/text ...///
659 <item>
660 Causes a message including the descriptive string <var/text/ to be
661 delivered as if it were an error message, but does not actually cause
662 an error.
663 </taglist>
664
665 <sect1>Directives with delayed effect
666 <p>
667
668 The following directives have no immediate effect, but are remembered
669 and have an effect on later processing of the configuration files.
670
671 <taglist>
672 <tag/<tt/user-rcfile <var/filename///
673 <item>
674 Specifies that the file <var/filename/ should be read instead of the
675 user's <tt>~/.userv/rc</>.  This does <em/not/ happen immediately;
676 instead, the setting is remembered and used after the
677 <tt/system.default/ configuration file has been read.  This directive
678 has no effect in a user's configuration file or in the
679 <tt/system.override/ file, as the user's configuration file has
680 already been found and read by then and will not be re-read.
681
682 <tag/<tt/errors-to-stderr//
683 <item>
684 Causes error messages to be delivered to the client's stderr.
685
686 <tag/<tt/errors-to-file/ <var/filename//
687 <item>
688 Error messages will be written to <var/filename/, which will be opened
689 in the context of and with the privileges of the service user.
690
691 <tag/<tt/errors-to-syslog/ [<var/facility/ [<var/level/]]/
692 <item>
693 Error messages will be delivered using <prgn/syslog/.  The default
694 <var/facility/ is <tt/daemon/; the default <var/level/ is <tt/error/.
695 </taglist>
696
697 <sect1>Control structure directives
698 <p>
699
700 The following directives are used to create control structures.  If
701 the end of the file is encountered before the end of any control
702 structure which was started inside it then that control structure is
703 considered finished.  This is not an error.
704
705 <taglist>
706 <tag/<tt/if <var/condition///
707 <tag/<tt/elif <var/condition///
708 <tag/<tt/else//
709 <tag/<tt/fi//
710 <item>
711 Lines following <tt/if/ are interpreted only if the condition is true.
712 Many conditions are properties of parameter values.  Most parameters
713 have a single string as a value; however, some may yield zero or
714 several strings, in which case the condition is true if it is true of
715 any of the strings individually.  Parameters are described below.
716 <p>
717
718 The conditions are:
719
720 <taglist compact>
721 <tag/<tt/glob <var/parameter/ <var/glob-pattern/ ...//
722 <item>
723 The value of the parameter whose name is given matches one of the glob
724 patterns (anchored at both ends; backslashes can be used to escape
725 metacharacters).
726
727 <tag/<tt/range <var/parameter/ <var/min/ <var/max///
728 <item>
729 The value of the parameter is a nonnegative integer and lies within
730 the range specified.  <var/min/ or <var/max/ may be <tt/$/ to indicate
731 no lower or upper limit, respectively.
732
733 <tag/<tt/grep <var/parameter/ <var/filename///
734 <item>
735 The <var/filename/ refers to a file one of whose lines is the value of
736 the parameter (leading or trailing whitespace on each line and empty
737 lines in the file are ignored).  It is an error for the file not to be
738 opened and read.
739
740 <tag/<tt/! <var/condition///
741 <item>
742 The <var/condition/ is <em/not/ true.
743
744 <tag/Conjunctions: <tt/&amp;/ and <tt/|//
745 <item>
746 <example>
747 ( <var/condition/
748 &amp; <var/condition/
749 &amp; <var/condition/
750 ...
751 )
752 </example>
753 is true if all the listed conditions are true; where <tt/|/ is used it
754 is true if any of them is true.  Newlines must be used to separate one
755 condition from the next, as shown, and the parentheses are mandatory.
756 These conjunctions do not do lazy evaluation.
757 </taglist>
758 <p>
759
760 The parameters are:
761
762 <taglist compact>
763 <tag/<tt/service//
764 <item>
765 The service name specified when the client was called.
766
767 <tag/<tt/calling-user//
768 <item>
769 Two strings: the login name of the calling user (determined as for
770 <tt/USERV_USER/, above) and the calling uid (represented in decimal).
771
772 <tag/<tt/calling-group//
773 <item>
774 Several strings: the primary and supplementary group names and gids
775 (in decimal) of the calling process.  All the group names come first,
776 and then the gids.  If the first supplementary group is the same as
777 the primary group then it is elided.
778
779 <tag/<tt/calling-user-shell//
780 <item>
781 The calling user's shell, as listed in the password entry for the
782 calling login name (as determined for <tt/USERV_USER/, above).
783
784 <tag/<tt/service-user//
785 <item>
786 Two strings: the name of the service user (as specified to the client)
787 and their uid (represented in decimal).
788
789 <tag/<tt/service-group//
790 <item>
791 Several strings: the primary and supplementary group names and gids
792 (in decimal) of the service user.
793
794 <tag/<tt/service-user-shell//
795 <item>
796 The service user's shell, as listed in their password entry.
797
798 <tag/<tt/u-<var/name///
799 <item>
800 The value of the user-defined variable <var/name/ passed by the caller
801 using the <tt/-D/ command-line option to the client.  If the variable
802 was not defined then this parameter is an empty list of strings; in
803 this case any condition which tests it will be false, and
804 <tt/include-lookup/ on it will read the <tt/:none/ file, or
805 <tt/:default/ if <tt/:none/ is not found.
806
807 </taglist>
808
809 <tag/<tt/errors-push/ <var/filename//
810 <tag/<tt/srorre//
811 <item>
812 Stacks the error handling behaviour currently in effect.  Any changes
813 to error handling will take effect only between <tt/errors-push/ and
814 <tt/srorre/.
815
816 <tag/<tt/catch-quit//
817 <tag/<tt/hctac//
818 <item>
819 Any use of <tt/quit/ inside <tt/catch-quit/ will merely cause the
820 parsing to continue at <tt/hctac/ instead.  Any control constructs
821 started since the <tt/catch-quit/ will be considered finished if a
822 <tt/quit/ is found.
823 <p>
824
825 If an error occurs inside <tt/catch-quit/ the execution settings will
826 be reset (as if by the <tt/reset/ directive) and parsing will likewise
827 continue at <tt/hctac/.
828 <p>
829
830 If a lexical or syntax error is detected in the same configuration
831 file as the <tt/catch-quit/, while looking for the <tt/hctac/, that
832 error will not be caught.
833
834 </taglist>
835
836 <sect1 id="execdirectives">Directives for changing execution settings
837 <p>
838
839 The following directives modify the execution settings; the server
840 will remember the fact that the directive was encountered and act on
841 it only after all the configuration has been parsed.  The <em/last/
842 directive which modifies any particuar setting will take effect.
843
844 <taglist>
845 <tag/<tt/reject//
846 <item>
847 Reject the request.  <tt/execute/, <tt/execute-from-directory/ and
848 <tt/execute-from-path/ will change this setting.
849
850 <tag/<tt/execute <var/pathname/ [<var/argument/ ...]//
851 <item>
852 Execute the program <var/pathname/, with the arguments as specified,
853 followed by any arguments given to the client if <tt/no-suppress-args/
854 is in effect.  It is an error for the execution to fail when it is
855 attempted (after all the configuration has been parsed).
856
857 <tag/<tt/execute-from-directory <var/pathname/ [<var/argument/ ...]//
858 <item>
859 Take all the characters after the last slash of the service name
860 specified when the client was called, and execute that program in the
861 directory named by <var/pathname/ as if it had been specified for
862 <var/execute/.  The part of the service name used may contain only
863 alphanumerics and hyphens and must start with an alphanumeric (and it
864 must be non-empty), otherwise it is an error.
865 <p>
866
867 This directive is ignored if the relevant program does not exist in
868 the directory specified; in this case the program to execute is left
869 at its previous setting (or unset, if it was not set before).
870 <p>
871
872 It is an error for the test for the existence of the program to fail
873 other than with a `no such file or directory' indication.  It is also
874 an error for the execution to fail if and when it is attempted (after
875 all the configuration has been parsed).
876
877 <tag/<tt/execute-from-path//
878 <item>
879 <var/service/ is interpreted as a program on the default <prgn/PATH/
880 (or as a pathname of an executable, if it contains a <tt>/</>).  This
881 directive is <em/very dangerous/, and is only provided to make the
882 <tt/--override/ options effective.  It should not normally be used.
883 It is an error for the execution to fail when it is attempted (after
884 all the configuration has been parsed).
885
886 <tag/<tt/execute-builtin <var/service-name/ <var/service-arguments//
887 <item>
888 Executes the builtin service <var/service-name/.  These builtin
889 services display information about the server and/or the request, and
890 ignore any arguments passed from the service side except possibly to
891 print them as part of their output.  They write their results to their
892 standard output (i.e., wherever file descriptor 1 is directed).  The
893 builtin services are:
894
895 <taglist compact>
896 <tag/<tt/execute//
897 Displays the execution settings, defined variables,
898 arguments, etc. with which the builtin service was invoked.
899
900 <tag/<tt/environment//
901 Displays the environment variable settings with which the builtin
902 service was invoked.
903
904 <tag/<tt/parameter <var/parameter///
905 Displays the values of the service configuration language parameter
906 specified.
907
908 <tag/<tt/version//
909 Displays the version string and compilation details of the uservd
910 server program.
911
912 <tag/<tt/reset//
913 Displays the default reset configuration (evaluated when <tt/reset/ is
914 found in a configuration file, or when an error is caught by
915 <tt/catch-quit/).
916
917 <tag/<tt/toplevel//
918 Displays the top-level default configuration (the configuration data,
919 evaluated by the server, which calls all the other configuration
920 files).
921
922 <tag/<tt/override//
923 Displays the top-level override configuration (the configuration data,
924 evaluated by the server, which causes all the other configuration data
925 to be parsed).
926 </taglist>
927
928 In the future other builtin services may be defined which do more than
929 just print information.
930
931 <tag/<tt/set-environment//
932 <tag/<tt/no-set-environment//
933 <item>
934 Runs <tt>/etc/environment</> to set the service user's environment.
935 This adds the overhead of invoking a shell, but doesn't cause any
936 shell (de)mangling of the service's arguments.  This is achieved by
937 invoking
938 <example>
939 .../program arg arg arg ...
940 </example>
941 as
942 <example>
943 /bin/sh -c '. /etc/environment; exec "$@"' - .../program arg arg arg ...
944 </example>
945 <tt/no-set-environment/ cancels the effect of <tt/set-environment/.
946
947 <tag/<tt/no-suppress-args//
948 <tag/<tt/suppress-args//
949 <item>
950 Include any arguments given to the client as arguments to the program
951 invoked as a result of an <tt/execute/ or <tt/execute-from-directory/
952 directive.  <tt/suppress-args/ undoes the effect of
953 <tt/no-suppress-args/.
954
955 <tag/<tt/require-fd <var/fd-range/ read|write//
956 <item>
957 Insist that the filedescriptor(s) be opened for reading resp. writing.
958 It is an error if any descriptor marked as required when the service
959 is about to be invoked (after the configuration has been parsed) was
960 not specified when the client was invoked.  Each file descriptor has a
961 separate setting, and the last one of <tt/require-fd/, <tt/allow-fd/,
962 <tt/ignore-fd/, <tt/null-fd/ or <tt/reject-fd/ which affected a
963 particular file descriptor will take effect.
964 <p>
965
966 <var/fd-range/ may be a single number, two numbers separated by a
967 hyphen, or one number followed by a hyphen (indicating all descriptors
968 from that number onwards).  It may also be one of the words
969 <tt/stdin/, <tt/stdout/ or <tt/stderr/.  Open-ended file descriptor
970 rangers are allowed only with <tt/reject-fd/ and <tt/ignore-fd/, as
971 otherwise the service program would find itself with a very large
972 number of file descriptors open.
973 <p>
974
975 When the configuration has been parsed, and before the service is
976 about to be executed, stderr (fd 2) must be required or allowed
977 (<tt/require-fd/ or <tt/allow-fd/) for writing; this is so that the
978 error message printed by the server's child process if it cannot
979 <prgn/exec/ the service program is not lost.
980
981 <tag/<tt/allow-fd <var/fd-range/ [read|write]//
982 <item>
983 Allow the descriptor(s) to be opened for reading resp. writing, or
984 either if neither <tt/read/ nor <tt/write/ is specified.  If a
985 particular descriptor not specified by the client then it will be open
986 onto <tt>/dev/null</> (for reading, writing, or both, depending on
987 whether <tt/read/, <tt/write/ or neither was specified).
988
989 <tag/<tt/null-fd <var/fd-range/ [read|write]//
990 <item>
991 Specify that the descriptor(s) be opened onto <prgn>/dev/null</> for
992 reading resp. writing, or both if neither <tt/read/ nor <tt/write/
993 is specified.  Any specification of these file descriptors by the
994 client will be silently ignored; the client will see its ends of the
995 descriptors being closed immediately.
996
997 <tag/<tt/reject-fd <var/fd-range///
998 <item>
999 Do not allow the descriptor(s) to be specified by the client.  It is
1000 an error if any descriptor(s) marked for rejection are specified when
1001 the service is about to be invoked (after the configuration has been
1002 parsed).
1003
1004 <tag/<tt/ignore-fd <var/fd-range///
1005 <item>
1006 Silently ignore any specification by the client of those
1007 descriptor(s).  The pipes corresponding to these descriptors will be
1008 closed just before the service is invoked.
1009
1010 <tag/<tt/disconnect-hup//
1011 <tag/<tt/no-disconnect-hup//
1012 <item>
1013 Causes the service's process group to get a <prgn/SIGHUP/ if the
1014 client disconnects before the main service process terminates.
1015 <tt/no-disconnect-hup/ cancels <tt/disconnect-hup/.
1016 <p>
1017
1018 If one of the reading descriptors specified when the client is called
1019 gets a read error, or if the service is disconnected for some other
1020 reason, then the <prgn/SIGHUP/ will be delivered <em/before/ the
1021 writing end(s) of the service's reading pipe(s) are closed, so that
1022 the client can distinguish disconnection from reading EOF on a pipe.
1023
1024 <tag/<tt/reset//
1025 <item>
1026 Resets the execution settings to the default.  This is equivalent to:
1027 <example>
1028 cd ~/
1029 reject
1030 no-set-environment
1031 suppress-args
1032 allow-fd 0 read
1033 allow-fd 1-2 write
1034 reject-fd 3-
1035 disconnect-hup
1036 </example>
1037
1038 </taglist>
1039
1040 If no <tt/execute/, <tt/execute-from-path/ or
1041 <tt/execute-from-directory/ is interpreted before all the files are
1042 read then the request is rejected.
1043
1044
1045 <sect>Errors in the configuration file
1046 <p>
1047
1048 If a syntax error or other problem occurs when processing a
1049 configuration file then a diagnostic will be issued, to wherever the
1050 error messages are currently being sent (see the <tt/errors-/ family
1051 of directives, above).
1052 <p>
1053
1054 The error will cause processing of the configuration files to cease at
1055 that point, unless the error was inside a <tt/catch-quit/ construct.
1056 In this case the settings controlling the program's execution will be
1057 reset to the defaults as if a <tt/reset/ directive had been issued,
1058 and parsing continues after <tt/hctac/.
1059
1060
1061 <sect>Defaults
1062 <p>
1063
1064 The default configuration processing is as if the daemon were parsing
1065 an overall configuration file whose contents were as follows:
1066
1067 <example>
1068 reset
1069 user-rcfile ~/.userv/rc
1070 errors-to-stderr
1071 include /etc/userv/system.default
1072 if grep service-user-shell /etc/shells
1073    errors-push
1074      catch-quit
1075        include-ifexist <var/file specified by most recent user-rcfile directive/
1076      hctac
1077    srorre
1078 fi
1079 include /etc/userv/system.override
1080 quit
1081 </example>
1082 <p>
1083
1084 If one of the <tt/override/ options to the client is used then it will
1085 be as if the daemon were parsing an overall configuration as follows:
1086
1087 <example>
1088 reset
1089 errors-to-stderr
1090 include <var/file containing configuration data sent by client/
1091 quit
1092 </example>
1093
1094
1095 <chapt id="ipass">Information passed through the client/daemon combination
1096 <p>
1097
1098 The information described below is the only information which passes
1099 between the caller and the service.
1100
1101 <list>
1102 <item>
1103 The service name supplied by the caller is available in the
1104 configuration language for deciding whether and which service program
1105 to invoke, in the <tt/service/ parameter, and is used by the
1106 <tt/execute-from-directory/ and <tt/execute-from-path/ configuration
1107 directives.  It is usually used to select which service program to
1108 invoke.  It is also passed to the service program in the
1109 <tt/USERV_SERVICE/ environment variable.
1110
1111 <item>
1112 File descriptors specified by the client and allowed according to the
1113 configuration language will be connected.  Each file descriptor is
1114 opened for reading or writing.  Communication is via pipes, one end of
1115 each pipe being open on the appropriate file descriptor in the service
1116 program (when it is invoked) and the other end being held by the
1117 client process, which will read and write files it opens on behalf of
1118 its caller or file descriptors it is passed by its caller.
1119 <p>
1120
1121 Data may be passed into the service through reading pipes and out of
1122 it through writing pipes.  These pipes can remain open only until the
1123 service and client have terminated, or can be made to stay open after
1124 the client has terminated and (if the service program forks) the main
1125 service process has exited; the behaviour is controlled by options
1126 passed to the client by its caller.
1127 <p>
1128
1129 The caller can arrange that a writing pipe be connected to a pipe or
1130 similar object and cause attempts to write to that descriptor by the
1131 service to generate a <prgn/SIGPIPE/ (or <prgn/EPIPE/ if
1132 <prgn/SIGPIPE/ is caught or ignored) in the service.
1133 <p>
1134
1135 Likewise, the service can close filedescriptors specified for reading,
1136 which will cause the corresponding filedescriptors passed by the
1137 caller to be closed, so that if these are pipes processes which write
1138 to them will receive <prgn/SIGPIPE/ or <prgn/EPIPE/.
1139
1140 <item>
1141 If <tt/no-suppress-args/ is set then arguments passed to the client by
1142 its caller will be passed on, verbatim, to the service.
1143
1144 <item>
1145 Fatal signals and system call failures experienced by the client will
1146 result in the disconnection of the service from the client and
1147 possibly some of the communication file descriptors described above;
1148 if <tt/disconnect-hup/ is set they will also cause the service to get
1149 a <prgn/SIGHUP/.
1150
1151 <item>
1152 The value of the <tt/LOGNAME/ (or <tt/USER/) environment variable as
1153 passed to the client will be used as the login name of the calling
1154 user if the uid of the calling process matches the uid corresponding
1155 to that login name.  Otherwise the calling uid's password entry will
1156 be used to determine the calling user's login name.
1157 <p>
1158
1159 This login name and the calling uid are available in the configuration
1160 language in the <tt/calling-user/ parameter and are passed to the
1161 service program in environment variables <tt/USERV_USER/ and
1162 <tt/USERV_UID/.
1163 <p>
1164
1165 The shell corresponding to that login name (according to the password
1166 entry) is available as in the configuration language's
1167 <tt/calling-user-shell/ parameter.
1168 <p>
1169
1170 If no relevant password entry can be found then no service will be
1171 invoked.
1172
1173 <item>
1174 The numeric values and textual names for calling gid and supplementary
1175 group list are available in the configuration language in the
1176 <tt/calling-group/ parameter and are passed to the service in
1177 environment variables.
1178 <p>
1179
1180 If no name can be found for a numeric group to which the calling
1181 process belongs then no service will be invoked.
1182
1183 <item>
1184 The name of the current working directory in which the client was
1185 invoked is passed, if available and not hidden using <tt/--hidecwd/,
1186 to the service program in the <tt/USERV_CWD/ variable.  This grants no
1187 special access to that directory unless it is a subdirectory of a
1188 directory which is executable (searchable) but not readable by the
1189 service user.
1190
1191 <item>
1192 Settings specified by the caller using the
1193 <tt/-D<var/name/=<var/value// option to the client are available in
1194 the configuration language as the corresponding <tt/u-<var/name//
1195 parameters and are passed to the service program in environment
1196 variables <tt/USERV_U_<var/name//.
1197
1198 <item>
1199 If the calling user is root or the same as the service user then
1200 options may be given to the client which bypass the usual security
1201 features; in this case other information may pass between the caller
1202 and the service.
1203
1204 </list>
1205
1206 <chapt id="notes">Applications and notes on use
1207 <p>
1208
1209 <sect>Reducing the number of absolutely privileged subsystems
1210 <p>
1211
1212 Currently most Unix systems have many components which need to run as
1213 root, even though most of their activity does not strictly require
1214 it.  This gives rise to a large and complex body of code which must be
1215 trusted with the security of the system.
1216 <p>
1217
1218 Using <prgn/userv/ many of these subsystems no longer need any unusual
1219 privilege.
1220 <p>
1221
1222 <prgn/cron/ and <prgn/at/, <prgn/lpr/ and the system's mail transfer
1223 agent (<prgn/sendmail/, <prgn/smail/, <prgn/exim/ or the like) all
1224 fall into this category.
1225
1226 <sect>Do not give away excessive privilege to <prgn/userv/-using facilities
1227 <p>
1228
1229 There is a danger that people reimplementing the facilities I mention
1230 above using <prgn/userv/ will discard much of the security benefit by
1231 using a naive implementation technique.  This will become clearer with
1232 an example:
1233 <p>
1234
1235 Consider the <prgn/lpr/ program.  In current systems this needs to
1236 have an absolutely privileged component in order to support delayed
1237 printing without copying: when the user queues a file to be printed
1238 the filename is stored in the print queue, rather than a copy of it,
1239 and the printer daemon accesses the file directly when it is ready to
1240 print the job.  In order that the user can print files which are not
1241 world-readable the daemon is given root privilege so that it can open
1242 the file in the context of the user, rather than its own.
1243 <p>
1244
1245 A simple-minded approach to converting this scheme to use <prgn/userv/
1246 might involve giving the printer daemon (the <tt/lp/ user) the ability
1247 to read the file by allowing them to run <prgn/cat/ (or a
1248 special-purpose file-reading program) as any user.  The <prgn/lpr/
1249 program would use a <prgn/userv/ service to store the filename in the
1250 printer daemon's queues, and the daemon would read the file later when
1251 it felt like it.
1252 <p>
1253
1254 However, this would allow the printer daemon to read any file on the
1255 system, whether or not someone had asked for it to be printed.  Since
1256 many files will contain passwords and other security-critical
1257 information this is nearly as bad as giving the daemon root access in
1258 the first place.  Any security holes in the print server which allow a
1259 user to execute commands as the <tt/lp/ user will give the user the
1260 ability to read any file on the system.
1261 <p>
1262
1263 Instead, it is necessary to keep a record of which files the daemon
1264 has been asked to print <em/outside/ the control of the print daemon.
1265 This record could be kept by a new root-privileged component, but this
1266 is not necessary: the record of which files a user has asked to be
1267 printed can be kept under the control of the user in question.  The
1268 submission program <prgn/lpr/ will make a record in an area under the
1269 user's control before communicating with the print server, and the
1270 print server would be given the ability to run a special file-reading
1271 program which would only allow files to be read which were listed in
1272 the user's file of things they'd asked to print.
1273 <p>
1274
1275 Now security holes in most of the printing system do not critically
1276 affect the security of the entire system: they only allow the attacker
1277 to read and interfere with print jobs.  Bugs in the programs run by the
1278 print server to read users' files (and to remove entries from the list
1279 of files when it has done with them) will still be serious, but this
1280 program can be quite simple.
1281 <p>
1282
1283 Similar considerations apply to many <prgn/userv/-based versions of
1284 facilities which currently run as root.
1285 <p>
1286
1287 It is debatable whether the user-controlled state should be kept in
1288 the user's filespace (in dotfiles, say) or kept in a separate area set
1289 aside for the purpose; however, using the user's home directory (and
1290 probably creating a separate subdirectory of it as a dotfile to
1291 contain many subsystems' state) has fewer implications for the rest of
1292 the system and makes it entirely clear where the security boundaries
1293 lie.
1294
1295 <sect><prgn/userv/ is not a replacement for <prgn/really/ and <prgn/sudo/
1296 <p>
1297
1298 <prgn/userv/ is not intended as a general-purpose system
1299 administration tool with which system administrators can execute
1300 privileged programs when they need to.  It is unsuitable for this
1301 purpose precisely because it enforces a strong separation between the
1302 calling and the called program, which is undesirable in this context.
1303 <p>
1304
1305 Its facilities for restricting activities to running certain programs
1306 may at first glance seem to provide similar functionality to
1307 <prgn/sudo/<footnote><prgn/sudo/ is a program which allows users to
1308 execute certain programs as root, according to configuration files
1309 specified by the system administrator.</footnote>.  However, the
1310 separation mentioned above is a problem here too, particular for
1311 interaction - it can be hard for a <prgn/userv/ service program to
1312 interact with its real caller or the user in question.
1313
1314 <sect>Don't give access to general-purpose utilities
1315 <p>
1316
1317 Do not specify general purpose programs like <prgn/mv/ or <prgn/cat/
1318 in <tt/execute-/ directives without careful thought about their
1319 arguments, and certainly not if <tt/no-suppress-args/ is specified.
1320 If you do so it will give the caller much more privilige than you
1321 probably intend.
1322 <p>
1323
1324 It is a shame that I have to say this here, but inexperienced
1325 administrators have made similar mistakes with programs like
1326 <prgn/sudo/.
1327
1328 </book>