7a53967a |
1 | \input texinfo @c -*-texinfo-*- |
2 | @c |
f5050002 |
3 | @c $Id: become.texi,v 1.3 1998/01/20 14:37:43 mdw Exp $ |
7a53967a |
4 | @c |
5 | @c Documentation for `become' |
6 | @c |
69805471 |
7 | @c (c) 1998 EBI |
7a53967a |
8 | @c |
9 | |
10 | @c ----- Revision history --------------------------------------------------- |
11 | @c |
12 | @c $Log: become.texi,v $ |
f5050002 |
13 | @c Revision 1.3 1998/01/20 14:37:43 mdw |
14 | @c Fix typo. Short form of `--preserve' should be `-e', not `-p'. |
15 | @c |
69805471 |
16 | @c Revision 1.2 1998/01/12 16:41:31 mdw |
17 | @c Tidying for new release versions. Fix copyright date. |
18 | @c |
7a53967a |
19 | @c Revision 1.1 1997/09/18 11:16:34 mdw |
20 | @c Brand new Texinfo manual, with wider scope than the original LaTeX one. |
21 | @c |
22 | |
23 | @c ----- Standard boilerplate ----------------------------------------------- |
24 | |
25 | @c %**start of header |
26 | @setfilename become |
27 | @settitle Become |
28 | @setchapternewpage odd |
29 | @footnotestyle end |
30 | @paragraphindent 0 |
31 | @iftex |
32 | @c @smallbook |
33 | @afourpaper |
34 | @c @parindent=0pt |
35 | @end iftex |
36 | @c %**end of header |
37 | |
38 | @c ----- Useful macros ------------------------------------------------------ |
39 | |
69805471 |
40 | @set version 1.2 |
7a53967a |
41 | |
42 | @c ----- Copyright matters -------------------------------------------------- |
43 | |
44 | @c --- The `Info' version --- |
45 | |
46 | @ifinfo |
47 | |
48 | This file documents Become version @value{version}. |
49 | |
69805471 |
50 | Copyright (c) 1998 European Bioinformatics Institute. |
7a53967a |
51 | |
52 | Permission is granted to make and distribute verbatim copies of this |
53 | manual provided the copyright notice and this permission notice are |
54 | preserved on all copies. |
55 | |
56 | @ignore |
57 | Permission is granted to process this file through TeX and print the |
58 | results, provided the printed document carries a copying permission |
59 | notice identical to this one except for the removal of this paragraph |
60 | (this paragraph not being relevant to the printed manual). |
61 | |
62 | @end ignore |
63 | Permission is granted to copy and distribute modified versions of this |
64 | manual under the conditions for verbatim copying, provided also that the |
65 | sections entitled `Copying' and `GNU General Public License' are |
66 | included exactly as in the original, and provided that the entire |
67 | resulting derived work is distributed under the terms of a permission |
68 | notice identical to this one. |
69 | |
70 | Permission is granted to copy and distribute translations of this manual |
71 | into another language, under the above conditions for modified versions, |
72 | except that this permission notice may be stated in a translation |
73 | approved by the European Bioinformatics Institute. |
74 | |
75 | @end ifinfo |
76 | |
77 | @c --- Printed title page --- |
78 | |
79 | @titlepage |
80 | |
81 | @title The Become program |
82 | @subtitle Become version @value{version} |
83 | @author Mark Wooding (@email{mdw@@ebi.ac.uk}) |
84 | @page |
85 | |
86 | @vskip 0pt plus 1filll |
87 | |
88 | Copyright @copyright{} 1997 European Bioinformatics Institute. |
89 | |
90 | Permission is granted to make and distribute verbatim copies of this |
91 | manual provided the copyright notice and this permission notice are |
92 | preserved on all copies. |
93 | |
94 | Permission is granted to copy and distribute modified versions of this |
95 | manual under the conditions for verbatim copying, provided also that the |
96 | sections entitled `Copying' and `GNU General Public License' are |
97 | included exactly as in the original, and provided that the entire |
98 | resulting derived work is distributed under the terms of a permission |
99 | notice identical to this one. |
100 | |
101 | Permission is granted to copy and distribute translations of this manual |
102 | into another language, under the above conditions for modified versions, |
103 | except that this permission notice may be stated in a translation |
104 | approved by the European Bioinformatics Institute. |
105 | |
106 | @end titlepage |
107 | |
108 | |
109 | @c -------------------------------------------------------------------------- |
110 | @ifinfo |
111 | @node Top, Copying, (dir), (dir) |
112 | @top Become |
113 | |
114 | |
115 | Become is a system for managing shared accounts. It allows users to |
116 | `become' other users in order to do useful work. It can be managed on a |
117 | central server (or a small number of central servers), or it can run |
118 | standalone. |
119 | |
120 | This file documents Become version @value{version}. |
121 | |
122 | @end ifinfo |
123 | |
124 | @menu |
125 | * Copying:: Your rights to distribute and modify |
126 | * Introduction:: A brief introduction to Become |
127 | * Becoming someone else:: How to become somebody else |
128 | * Administering Become:: How to maintain Become |
129 | * Invoking Become:: Reference to Become's command line options |
130 | |
131 | --- The Detailed Node Listing --- |
132 | |
133 | Becoming someone else |
134 | |
135 | * Terminology:: Some important terms defined |
136 | * Environment:: Login styles and environment variables |
137 | * Group permissions:: How Become handles group permissions |
138 | * X authority:: Problems with X authority files |
139 | * Running commands:: Running commands other than a shell |
140 | |
141 | How Become sets up the environment |
142 | |
143 | * New environment variables:: Become adds some useful environment variables |
144 | * Login styles:: Choose how Become sets the environment |
145 | * Tweaking the environment:: Altering individual environment variables |
146 | * Removed variables:: Some environment variables aren't passed on |
7a53967a |
147 | |
148 | Login styles |
149 | |
150 | * The preserve style:: Preserve the current environment |
151 | * The set-user style:: Set user-specific variables (like @code{su}) |
152 | * The login style:: Clear the environment (like @code{login}) |
153 | |
154 | How Become handles groups |
155 | |
156 | * Primary group selection:: Setting the new primary group |
157 | * Subsidiary groups:: Setting subsidiary group memberships |
158 | |
159 | Considerations for X authority |
160 | |
161 | * The user-group method:: A secure method for handling X authority |
162 | * Using xauth:: A less secure method, which might be easier |
163 | |
164 | Become administration |
165 | |
166 | * Configuration files:: Overview of Become's configuration files |
167 | * Standalone or networked:: The two main types of Become installations |
168 | * The configuration file:: How to define who's allowed to do what |
69805471 |
169 | * Networked configuration:: Considerations for networked installations |
7a53967a |
170 | |
171 | The configuration file |
172 | |
173 | * Basic syntax:: Quick overview of Become's syntax |
174 | * Classes:: Defining classes of things |
175 | * Predefined classes:: Become predefines some (maybe) useful classes |
176 | * Allow statements:: Allow users to become other users |
177 | * Other statements:: Some other useful statements |
178 | * Example configuration file:: An example, showing a few features. |
179 | * Complete grammar:: Complete grammar for Become config files |
180 | |
181 | Networked configuration |
182 | |
183 | * Choosing servers:: Which servers Become tries to talk to |
184 | * Setting up keys:: How to generate keys for Become |
185 | * Random number files:: Become keeps random number state around |
186 | * Issuing a new key:: How to issue new keys without disruption |
187 | |
188 | Setting up keys |
189 | |
190 | * Invoking keygen:: How to use the @code{keygen} program |
191 | |
192 | Invoking Become |
193 | |
194 | * Becoming another user:: Options for becoming another user |
195 | * Starting Become daemons:: Options for starting Become daemons |
196 | * Debugging options:: Options to use when Become goes wrong |
197 | @end menu |
198 | |
199 | @c -------------------------------------------------------------------------- |
200 | @node Copying, Introduction, Top, Top |
201 | @unnumbered The GNU General Public License |
202 | |
203 | |
204 | @include gpl.texi |
205 | |
206 | |
207 | @c -------------------------------------------------------------------------- |
208 | @node Introduction, Becoming someone else, Copying, Top |
209 | @unnumbered Introduction |
210 | |
211 | |
212 | It's often useful to be able to share accounts between a number of |
213 | users. For example, a group maintaining an externally visible service |
214 | need to be able to start and kill the server process. Giving such a |
215 | shared account a password is a fairly bad plan: such passwords tend not |
216 | to get changed very often, and they have a habit of spreading beyond the |
217 | group of legitimate users. |
218 | |
219 | The Become program presented here offers a solution to the problems of |
220 | shared accounts. It allows the system adminstrator to define which |
221 | users are allowed access to which accounts, on which hosts, and to |
222 | execute which commands. Such shared accounts can then, in general, have |
223 | their passwords removed. |
224 | |
225 | This coincidentally has another advantage: when `becoming' to a shared |
226 | account, a user can retain her@footnote{Or his. I'll choose one or the |
227 | other fairly randomly throughout this manual.} own environment, which |
228 | she's carefully crafted and honed over the years, rather then being |
229 | presented with some lowest-common-denominator setup which probably |
230 | doesn't even use the right shell. |
231 | |
232 | The configuration file for Become can either be distributed to all the |
233 | various hosts in a network or a few carefully set up and secure servers |
234 | (@pxref{Standalone or networked}). |
235 | |
236 | |
237 | @c -------------------------------------------------------------------------- |
238 | @node Becoming someone else, Administering Become, Introduction, Top |
239 | @chapter Becoming someone else |
240 | |
241 | |
242 | The simplest way to become someone else is to say |
243 | |
244 | @example |
245 | become @var{user} |
246 | @end example |
247 | |
248 | @noindent |
249 | Become will check to see whether you're allowed to become @var{user}. If you |
250 | are, it starts a shell process with the user-id set to @var{user}. Any |
251 | commands you type are executed with the privileges of @var{user}. |
252 | |
253 | The full invocation is slightly more complicated: |
254 | |
255 | @example |
256 | become [@var{option}@dots{}] [@var{env-var}@dots{}] @var{user} [@var{command} [@var{arg}@dots{}]] |
257 | @end example |
258 | |
259 | Actually, the @var{option}s, @var{env-var}s and @var{user} can be in any |
260 | order -- the important point is that all of them appear before the |
261 | @var{command}, if there is one. |
262 | |
263 | @menu |
264 | * Terminology:: Some important terms defined |
265 | * Environment:: Login styles and environment variables |
266 | * Group permissions:: How Become handles group permissions |
267 | * X authority:: Problems with X authority files |
268 | * Running commands:: Running commands other than a shell |
269 | @end menu |
270 | |
271 | |
272 | |
273 | @node Terminology, Environment, Becoming someone else, Becoming someone else |
274 | @section Terminology |
275 | |
276 | The following terms get used quite a bit in the following text: |
277 | |
278 | @table @asis |
279 | @item request |
280 | An invocation of Become, asking permission to become another user. |
281 | |
282 | @item old user |
283 | The (real) user id of the process which invoked Become; usually, this will be |
284 | your normal user id. |
285 | |
286 | @item target user |
287 | The user whom you want to become, named in a request. |
288 | @end table |
289 | |
290 | |
291 | |
292 | @node Environment, Group permissions, Terminology, Becoming someone else |
293 | @section How Become sets up the environment |
294 | |
295 | There are thorny problems with handling the user's environment. It seems |
296 | that (the author's initial assessment notwithstanding) there is no single |
297 | best way of handling environment variables. As a result, Become can do just |
298 | about everything you might want it to. This gets slightly complicated. |
299 | Don't worry: it's not as hard as all that. |
300 | |
301 | @menu |
302 | * New environment variables:: Become adds some useful environment variables |
303 | * Login styles:: Choose how Become sets the environment |
304 | * Tweaking the environment:: Altering individual environment variables |
305 | * Removed variables:: Some environment variables aren't passed on |
7a53967a |
306 | @end menu |
307 | |
308 | |
309 | @node New environment variables, Login styles, Environment, Environment |
310 | @subsection Environment variables created by Become |
311 | |
312 | To help you (and, more importantly, your startup scripts) keep track of who |
313 | you are, and who you were originally, Become adds some variables to the |
314 | environment of any processes it starts. |
315 | |
316 | @table @code |
317 | @item BECOME_USER |
318 | The name of the target user (i.e., the user you are now). It might be useful |
319 | to test this value in shell startup scripts, for example. |
320 | |
321 | @item BECOME_HOME |
322 | The home directory of the target user. It can be handy to read startup and |
323 | other configuration files from here. |
324 | |
325 | @item BECOME_OLD_USER |
326 | The name of the user who invoked Become. |
327 | |
328 | @item BECOME_OLD_HOME |
329 | The home directory of the `old' user. |
330 | |
331 | @item BECOME_ORIGINAL_USER |
332 | This is intended to be the name you logged in with. If it's unset, Become |
333 | sets it to be the same as @code{BECOME_OLD_USER}; otherwise it leaves it |
334 | unchanged. |
335 | |
336 | @item BECOME_ORIGINAL_HOME |
337 | This is intended to be the home directory you logged in with. If it's unset, |
338 | Become sets it to be the same as @code{BECOME_OLD_HOME}; otherwise, it leaves |
339 | it unchanged. |
340 | @end table |
341 | |
342 | Don't even think about relying on these variables as a form of |
343 | authentication. It won't work. They're provided only to help organise |
344 | startup scripts. |
345 | |
346 | |
347 | |
348 | @node Login styles, Tweaking the environment, New environment variables, Environment |
349 | @subsection Login styles |
350 | |
351 | Originally, Become always tried to preserve your environment. There's a |
352 | rational explanation for this approach, which is given in the description of |
353 | the `preserve' style below. Unfortunately, not everyone liked this |
354 | approach. As a result, there's now a collection of different login styles. |
355 | |
356 | Login styles are selected by giving command line arguments: |
357 | |
358 | @table @code |
f5050002 |
359 | @item -e |
7a53967a |
360 | @itemx --preserve |
361 | The original style: try to preserve the existing user's environment as much |
362 | as possible. |
363 | |
364 | @item -s |
365 | @itemx --set-user |
366 | Set some user-specific variables, like @code{USER} and @code{HOME} to reflect |
367 | the target user rather than the old user. All other variables are preserved. |
368 | |
369 | @item -l |
370 | @itemx --login |
371 | Attempts to make the `become' process as much like a real login as possible. |
372 | All variables not explicitly preserved are deleted, and a new environment is |
373 | built, reflecting the target user. |
374 | @end table |
375 | |
376 | The various styles, and the reasons behind them, are described below. |
377 | |
378 | @menu |
379 | * The preserve style:: Preserve the current environment |
380 | * The set-user style:: Set user-specific variables (like @code{su}) |
381 | * The login style:: Clear the environment (like @code{login}) |
382 | @end menu |
383 | |
384 | |
385 | @node The preserve style, The set-user style, Login styles, Login styles |
386 | @subsubsection The `preserve' login style |
387 | |
388 | You've spent many hours (days? weeks, even?) customising and honing your |
389 | startup files, learning how to use your shell, and tweaking your favourite |
390 | text editor until it's just the way you like it. So there can be few things |
391 | more annoying than logging into a shared account to find out that the shell's |
392 | wrong, your editor startup files are ignored, and nothing works quite the way |
393 | you'd like it to. Typically you can't change this without annoying the other |
394 | users: the result is a horrible compromise which dissatisfies everyone |
395 | equally. |
396 | |
397 | The `preserve' style lets you take your standard environment with you when |
398 | you become someone else. It tries hard not to modify any environment |
399 | variables. |
400 | |
401 | Become starts your standard shell. If you have an environment variable |
402 | @code{SHELL} defined, than this is executed. Otherwise, the shell specified |
403 | in your entry in the password file is used. (You must have permission to |
404 | execute whatever shell is chosen as the target user, or you'll just be given |
405 | an error message.) |
406 | |
407 | Most programs look at environment variables in preference to looking up |
408 | entries in the password database; e.g., they tend to use @code{USER} or |
409 | @code{LOGNAME} for the user name, and @code{HOME} for your home directory. |
410 | As a result, most programs will continue to find their configuration files in |
411 | your home directory. Also, systems like RCS will use your real name, rather |
412 | than the name of the user that you have become. |
413 | |
414 | To make best use of this login style, you may need to adjust your login |
415 | scripts to notice when @code{BECOME_USER} is someone else, and read in |
416 | appropriate definitions. For example, a `bash' user might say something like |
417 | this in her @file{.bashrc}: |
418 | |
419 | @example |
420 | if [ -n "$BECOME_HOME" ]; then . $BECOME_HOME/.bashrc |
421 | @end example |
422 | |
423 | @noindent |
424 | Similarly, a C shell user (either `tcsh' or `csh') might say something like |
425 | |
426 | @example |
427 | if ($?BECOME_HOME) source $@{BECOME_HOME@}/.cshrc |
428 | @end example |
429 | |
430 | (Note that plain Bourne shell users have a slight problem, because the Bourne |
431 | shell only reads configuration things on a login, not when a normal |
432 | interactive shell is started.) |
433 | |
434 | |
435 | @node The set-user style, The login style, The preserve style, Login styles |
436 | @subsubsection The `set-user' login style |
437 | |
438 | The author sees the main use of Become as allowing a user to acquire the |
439 | privileges associated with a shared account without all the problems which |
440 | shared accounts usually cause. To the author's way of thinking, one of the |
441 | main problems is that your environment gets replaced by something alien and |
442 | wrong. People disagree with me over this point, and for this reason the |
443 | `set-user' style exists. |
444 | |
445 | The objective of `set-user' style is to behave similarly to the standard |
446 | @code{su} command. Unless they've been preserved explicitly (@pxref{Tweaking |
447 | the environment}), `set-user' mode sets the following environment variables: |
448 | |
449 | @table @code |
450 | @item USER |
451 | @itemx LOGNAME |
452 | The name of the target user. |
453 | |
454 | @item HOME |
455 | The home directory of the target user. |
456 | |
457 | @item SHELL |
458 | The target user's default shell |
459 | @end table |
460 | |
461 | The result of this is that the shell will read the target user's |
462 | configuration files and present you with the environment set up there. |
463 | |
464 | I can't think of this style as being anything other than a migration aid |
465 | while users are getting used to the freedom offered by the `preserve' style. |
466 | |
467 | |
468 | @node The login style, , The set-user style, Login styles |
469 | @subsubsection The `login' login style |
470 | |
471 | The `login' style causes Become to attempt to emulate a full login. Become |
472 | will empty the environment of any variables which aren't explicitly preserved |
473 | (@pxref{Tweaking the environment}). It will then set the following |
474 | variables: |
475 | |
476 | @table @code |
477 | @item USER |
478 | @itemx LOGNAME |
479 | The name of the target user. |
480 | |
481 | @item HOME |
482 | The home directory of the target user. |
483 | |
484 | @item SHELL |
485 | The target user's default shell |
486 | |
487 | @item MAIL |
488 | An educated guess at where the target user's mailbox is. |
489 | @end table |
490 | |
491 | By default, it runs the target user's shell, informing it that this is a |
492 | login by setting the first character of @code{argv[0]} to @samp{-}. |
493 | |
494 | Become makes no entries in the @file{utmp} and @file{wtmp} files. |
495 | |
496 | |
497 | |
498 | @node Tweaking the environment, Removed variables, Login styles, Environment |
499 | @subsection Tweaking individual environment variables |
500 | |
501 | Become's login styles provide a sort of course-grained control over the |
502 | environment. Sometimes the control isn't fine enough. Become lets you tweak |
503 | individual variables: you can set, delete, or preserve named variables from |
504 | modification. |
505 | |
506 | There are three different things you can do with environment variables: |
507 | |
508 | @itemize @bullet |
509 | @item |
510 | Set a variable called @var{var} to a value @var{value}, by saying |
511 | |
512 | @example |
513 | @var{var}=@var{value} |
514 | @end example |
515 | |
516 | @noindent |
517 | The variable is preserved from automatic deletion by the login-style rules. |
518 | |
519 | @item |
520 | Delete a variable called @var{var} from the environment, by saying |
521 | |
522 | @example |
523 | @var{var}- |
524 | @end example |
525 | |
526 | @item |
527 | Preserve a variable @var{var} from being deleted or modified by Become's |
528 | login-style rules, but not change its value, by saying |
529 | |
530 | @example |
531 | @var{var}! |
532 | @end example |
533 | @end itemize |
534 | |
535 | Just to try and make this slightly more sensible, here's an example. Suppose |
536 | I want my @code{XAUTHORITY} variable to be set when I become user `fred': |
537 | |
538 | @example |
539 | become XAUTHORITY=$HOME/.Xauthority fred |
540 | @end example |
541 | |
542 | @noindent |
543 | should do the job nicely. Similarly, if I want to log in as `bob', but don't |
544 | want my @code{EDITOR} variable to change: |
545 | |
546 | @example |
547 | become --login EDITOR! bob |
548 | @end example |
549 | |
550 | @noindent |
551 | (Of course, in this example, I'm at the mercy of Bob's shell init files as to |
552 | whether his choice of editor overrides mine.) |
553 | |
554 | |
555 | |
69805471 |
556 | @node Removed variables, , Tweaking the environment, Environment |
7a53967a |
557 | @subsection Variables removed from the environment |
558 | |
559 | Some variables are removed from the environment which Become passes to a |
560 | program for security reasons: |
561 | |
562 | @table @code |
563 | @item LD_* |
564 | @itemx SHLIB_PATH |
565 | @itemx LIBPATH |
566 | @itemx _RLD_* |
567 | These variables are used on various systems as a search path for shared |
568 | libraries. Clearly, by manipulating these search paths, an attacker could |
569 | replace a standard shared library with one of his own. |
570 | |
571 | @item IFS |
572 | The shell input field separator. Modifying this variable radically alters |
573 | the way shells parse their inputs. (In particular, consider the case where |
574 | @code{IFS} contains @samp{/}.) |
575 | |
576 | @item ENV |
577 | @itemx BASH_ENV |
578 | Used by some shells: it contains the name of a file to read on every shell |
579 | invocation. |
580 | |
581 | @item KRB_CONF |
582 | @ignore |
583 | I'm not really sure what's going on here, so I'll just have to bluff my way |
584 | through. I think that the following is more-or-less accurate, having browsed |
585 | a small amount of Kerberos-related documentation. |
586 | @end ignore |
587 | Contains the name of a Kerberos configuration file. By manipulating this |
588 | variable, an attacker could persuade a program to believe the wrong |
589 | authentication server. |
590 | @end table |
591 | |
592 | Also note that the @code{PATH} variable is modified: any items which aren't |
593 | absolute pathnames are removed from the path. This check may become stricter |
594 | in future, although getting the balance between security and convenience is |
595 | particularly hard here. |
596 | |
597 | |
598 | |
7a53967a |
599 | @node Group permissions, X authority, Environment, Becoming someone else |
600 | @section How Become handles groups |
601 | |
602 | As well as handling changes of user id, Become also changes group ids. |
603 | The exact changes Become makes are under user control. |
604 | |
605 | @menu |
606 | * Primary group selection:: Setting the new primary group |
607 | * Subsidiary groups:: Setting subsidiary group memberships |
608 | @end menu |
609 | |
610 | |
611 | @node Primary group selection, Subsidiary groups, Group permissions, Group permissions |
612 | @subsection Choosing a new primary group |
613 | |
614 | By default, the primary group is chosen according to the login style |
615 | (@pxref{Login styles}): the `preserve' style retains the current primary |
616 | group, while `set-user' and `login' styles choose the target's primary group. |
617 | |
618 | You can override Become's default choice using the @code{--group} (@code{-g} |
619 | for short) option: |
620 | |
621 | @example |
622 | become --group=@var{group} @dots{} |
623 | @end example |
624 | |
625 | The chosen @var{group} may be either a group name or a numeric gid. The |
626 | group must be one of the following: |
627 | |
628 | @itemize @bullet |
629 | @item |
630 | Your current primary group. |
631 | @item |
632 | One of your current subsidiary groups. |
633 | @item |
634 | The target user's primary group. |
635 | @item |
636 | One of the target user's subsidiary groups. |
637 | @end itemize |
638 | |
639 | Become will raise an error if this isn't the case. |
640 | |
641 | |
642 | @node Subsidiary groups, , Primary group selection, Group permissions |
643 | @subsection Handling subsidiary group memberships |
644 | |
645 | Subsidiary group memberships are a powerful tool for managing permissions |
646 | under Unix. Traditionally, they tend to be tied to particular users. Become |
647 | tries to be sightly more intelligent about group memberships. |
648 | |
649 | Become has a concept of @dfn{group style}, analogous to login style |
650 | (@pxref{Login styles}). The styles are selected by giving command line |
651 | arguments: |
652 | |
653 | @table @code |
654 | @item -k |
655 | @itemx --keep-groups |
656 | Retain the existing group memberships; don't add any new groups. |
657 | |
658 | @item -m |
659 | @itemx --merge-groups |
660 | Merge group memberships of the target user with the exiting memberships. |
661 | |
662 | @item -r |
663 | @itemx --replace-groups |
664 | Replace the existing group memberships with the target user's memberships. |
665 | @end table |
666 | |
667 | Again, the defaults are dependent on the chosen login style. Both `preserve' |
668 | and `set-user' merge group memberships; the `login' style replaces the set of |
669 | groups. |
670 | |
671 | Note that you can do perverse things like replace all the subsidiary groups |
672 | but retain your primary group (using the @code{--group} option; |
673 | @pxref{Primary group selection}) if you like: Become won't try to stop you. |
674 | |
675 | |
676 | |
677 | @node X authority, Running commands, Group permissions, Becoming someone else |
678 | @section Considerations for X authority |
679 | |
680 | Other users can't read your @file{.Xauthority} file, if you have one. This |
681 | is as it should be: anyone who can read it can connect to your X server and |
682 | read or generate events. However, once you've become another user, you can't |
683 | open any X windows; this can be annoying if your favourite editor is X-based. |
684 | |
685 | There are two basic approaches. Either you can send the shared account a |
686 | copy of your display's magic cookie, or you can retain permission to read the |
687 | cookie file. |
688 | |
689 | @menu |
690 | * The user-group method:: A secure method for handling X authority |
691 | * Using xauth:: A less secure method, which might be easier |
692 | @end menu |
693 | |
694 | |
695 | @node The user-group method, Using xauth, X authority, X authority |
696 | @subsection The user-group method for handling X authority |
697 | |
698 | This method is completely secure only if your site uses the `user-group' |
699 | system. In this system, each user is allocated a group containing only that |
700 | user. Usually this is made the user's default primary group, although that's |
701 | not necessary here. |
702 | |
703 | When you start a new X session, ensure that your cookie file is owned by you |
704 | and your private group. Change the file's permissions so that it's group |
705 | readable. Finally, ensure that your private group is retained when you |
706 | become someone else (@pxref{Group permissions}), and that the |
707 | @code{XAUTHORITY} variable is set correctly. |
708 | |
709 | The following Bourne shell code in a @file{.xinitrc} should do most of the |
710 | work: |
711 | |
712 | @example |
713 | XAUTHORITY="$HOME/.Xauthority" |
714 | export XAUTHORITY |
715 | chgrp mygroup $XAUTHORITY |
716 | chmod 640 $XAUTHORITY |
717 | @end example |
718 | |
719 | @noindent |
720 | In a C shell, this becomes |
721 | |
722 | @example |
723 | setenv XAUTHORITY $@{HOME@}/.Xauthority |
724 | chgrp mygroup $XAUTHORITY |
725 | chmod 640 $XAUTHORITY |
726 | @end example |
727 | |
728 | The @code{XAUTHORITY} file is preserved by both the `preserve' and `set-user' |
729 | login styles, so this isn't a problem. You can now become other users, and |
730 | your X permissions will follow you around correctly. |
731 | |
732 | It's probably worth noting that the @code{xauth} program annoyingly resets |
733 | the permissions on the cookie file every time it writes to it. This will be |
734 | particularly irritating if you use @code{ssh}'s X forwarding capabilities, |
735 | because every @code{ssh} connection will reset the permissions. You can deal |
736 | with this problem by putting a line |
737 | |
738 | @example |
739 | chmod 640 $@{XAUTHORITY-$HOME/.Xauthority@} 2>/dev/null |
740 | @end example |
741 | |
742 | @noindent |
743 | in your @file{.bashrc} or @file{.profile} (for Bourne-like shell users) or |
744 | |
745 | @example |
746 | if ($?XAUTHORITY) then |
747 | chmod 640 $XAUTHORITY >&/dev/null |
748 | else |
749 | chmod 640 $@{HOME@}/.Xauthority >&/dev/null |
750 | endif |
751 | @end example |
752 | |
753 | @noindent |
754 | in @file{.cshrc} for C shell users. |
755 | |
756 | |
757 | |
758 | @node Using xauth, , The user-group method, X authority |
759 | @subsection The `xauth' method for handling X authority |
760 | |
761 | This method sends your X cookie to the shared account. It's therefore |
762 | intrinsically dangerous: you must be able to trust the other users of the |
763 | shared account not to take undue advantage of this situation. |
764 | |
765 | The following (Bourne) shell snippet illustrates how you might send an |
766 | authorisation cookie to the shared account, to allow it to connect to your |
767 | display: |
768 | |
769 | @example |
770 | if test -n "$BECOME_HOME"; then |
771 | XAUTHORITY="$BECOME_HOME/.Xauthority"; export XAUTHORITY |
772 | elif test -n "$DISPLAY" && test -z "done_xauth_cookie"; then |
773 | case "$DISPLAY" in |
774 | :0.0) display=`hostname`:0.0 ;; |
775 | *) display="$DISPLAY" ;; |
776 | esac |
777 | xauth extract - $display | \ |
778 | become someone -c 'xauth -f $BECOME_HOME/.Xauthority merge -' |
779 | done_xauth_cookie=yes; export done_xauth_cookie |
780 | fi |
781 | @end example |
782 | |
783 | The equivalent C shell code is |
784 | |
785 | @example |
786 | if ($?BECOME_HOME) then |
787 | setenv XAUTHORITY "$@{BECOME_HOME@}/.Xauthority |
788 | else if ($?DISPLAY && ! $?done_xauth_cookie) then |
789 | if ($DISPLAY == :0.0) then |
790 | set display="`hostname`:0.0" |
791 | else |
792 | set display="$DISPLAY" |
793 | endif |
794 | xauth extract - $display | \ |
795 | become someone -c 'xauth -f $BECOME_HOME/.Xauthority merge -' |
796 | endif |
797 | @end example |
798 | |
799 | It works as follows: |
800 | |
801 | @itemize @bullet |
802 | @item |
803 | If the variable @code{BECOME_HOME} is set, then we're probably really someone |
804 | else, so point to the shared account's authority file. |
805 | |
806 | @item |
807 | Otherwise, check to see whether we have a display, and the authorisation has |
808 | not already been sent. If this is so, resolve a local display name into a |
809 | remote one (just in case) and then send it to the shared account. |
810 | @end itemize |
811 | |
812 | |
813 | |
814 | @node Running commands, , X authority, Becoming someone else |
815 | @section Executing specific commands |
816 | |
817 | As well as starting shells, Become can run single commands. This can be |
818 | useful in two ways: |
819 | |
820 | @itemize @bullet |
821 | @item |
822 | It enables Become to be used in scripts. |
823 | |
824 | @item |
825 | It allows access to shared accounts to be controlled on the basis of the |
826 | command to be run. |
827 | @end itemize |
828 | |
829 | To run a command as another user, say: |
830 | |
831 | @example |
832 | become @var{user} @var{command} [@var{argument}@dots{}] |
833 | @end example |
834 | |
835 | If the request is granted, Become runs @var{command}, passing it any |
836 | arguments following the command name. Become doesn't run a shell, so there's |
837 | no extra escaping which needs to be done. |
838 | |
839 | If you really want to run a shell command as another user, you can use the |
840 | @code{-c} option: |
841 | |
842 | @example |
843 | become @var{user} -c @var{shell-command} |
844 | @end example |
845 | |
846 | This is exactly equivalent to |
847 | |
848 | @example |
849 | become @var{user} /bin/sh -c @var{shell-command} |
850 | @end example |
851 | |
852 | in every way. In particular, you must have permission to run @file{/bin/sh} |
853 | as @var{user} for it to work: Become doesn't attempt to interpret the shell |
854 | command in any way. Also note that Become always uses the Bourne shell, |
855 | regardless of your current shell preference, or @var{user}'s default shell. |
856 | (This is done to provide a stable programming interface which works |
857 | irrespective of changes to the shared account's configuration.) |
858 | |
859 | |
860 | @c -------------------------------------------------------------------------- |
861 | @node Administering Become, Invoking Become, Becoming someone else, Top |
862 | @chapter Become administration |
863 | |
864 | |
865 | This chapter will explain how Become is administrated and maintained. |
866 | |
867 | @menu |
868 | * Configuration files:: Overview of Become's configuration files |
869 | * Standalone or networked:: The two main types of Become installations |
870 | * The configuration file:: How to define who's allowed to do what |
871 | * Networked configuration:: Considerations for networked installations |
872 | @end menu |
873 | |
874 | |
875 | |
876 | @node Configuration files, Standalone or networked, Administering Become, Administering Become |
877 | @section Configuration files |
878 | |
879 | Become keeps its configuration and administrative files in a directory |
880 | usually named @file{/etc/become}, although this can be changed with the |
881 | @code{--with-etcdir} option to the configuration script when you build |
882 | Become. |
883 | |
884 | Not all of the files are needed on all machines. |
885 | |
886 | @table @file |
887 | @item become.conf |
888 | The main configuration file, containing a description of which users are |
889 | allowed to become which other users, where, and what they're allowed to run |
890 | when they get there. Only needed on servers or standalone machines. |
891 | |
892 | @item become.server |
893 | A list of servers to contact. Only needed on client machines. |
894 | |
895 | @item become.key |
896 | The encryption key to use when sending requests to servers. Needed on |
897 | clients and servers, but not on standalone machines. |
898 | |
899 | @item become.pid |
900 | The process id of the server. Created automatically by Become's server when |
901 | in starts up. |
902 | |
903 | @item become.random |
904 | Contains state information for Become's random number generator. Created |
905 | automatically if it doesn't exist. |
906 | @end table |
907 | |
908 | |
909 | @node Standalone or networked, The configuration file, Configuration files, Administering Become |
910 | @section Installation types |
911 | |
912 | |
913 | Become can be installed in two different ways, depending on how you want to |
914 | administer it: |
915 | |
916 | @itemize @bullet |
917 | @item |
918 | In a @dfn{standalone} installation, each Become request is dealt with |
919 | locally: the program reads the configuration file, and decides whether it |
920 | should grant or deny permission. |
921 | |
922 | Standalone installations don't depend on servers being available, or even on |
923 | the existance of a network. They're useful for small sites, or sites with a |
924 | small number of users. The disadvantages are that reading the configuration |
925 | file takes a while, so the program doesn't feel as responsive as it should, |
926 | and ensuring that all the hosts' configuration files are synchronised becomes |
927 | difficult when you have lots of machines. |
928 | |
929 | @item |
930 | In a @dfn{network} installation, any Become requests are sent on to a |
931 | collection of servers. The servers analyse the request and send a reply back |
932 | which either authorises or forbids access. |
933 | |
934 | A networked installation clearly depends on the servers' reliability. The |
935 | client reacts only to the first reply it receives, so as long as there is one |
936 | server running, everything should continue as normal. |
937 | |
938 | A networked installation is useful when you have a large number of client |
939 | machines, particularly ones which may not be awake all the time. The full |
940 | configuration file only needs to be installed on a small number of servers; |
941 | the clients require only a list of server machines to contact, and an |
942 | encryption key to use. |
943 | @end itemize |
944 | |
945 | |
946 | |
947 | @node The configuration file, Networked configuration, Standalone or networked, Administering Become |
948 | @section The configuration file |
949 | |
950 | The main configuration file, usually called @file{/etc/become/become.conf}, |
951 | contains all the rules which Become uses to decide whether to grant or deny |
952 | requests. It may also contain additional information for the benefit of |
953 | Become daemons, if you're using a networked installation. |
954 | |
955 | @menu |
956 | * Basic syntax:: Quick overview of Become's syntax |
957 | * Classes:: Defining classes of things |
958 | * Predefined classes:: Become predefines some (maybe) useful classes |
959 | * Allow statements:: Allow users to become other users |
960 | * Other statements:: Some other useful statements |
961 | * Example configuration file:: An example, showing a few features. |
962 | * Complete grammar:: Complete grammar for Become config files |
963 | @end menu |
964 | |
965 | |
966 | @node Basic syntax, Classes, The configuration file, The configuration file |
967 | @subsection Basic configuration file syntax |
968 | |
969 | The configuration file consists of a sequence of statements, each terminated |
970 | by a semicolon. |
971 | |
972 | Comments begin with a @samp{#} character, and continue to the end of the |
973 | line. This is the only time newlines behave specially: newlines behave just |
974 | like any other whitespace characters within statements. |
975 | |
976 | Strings are enclosed in double-quote characters (@samp{"}). Within a string, |
977 | a backslash causes the following character to be treated literally, whatever |
978 | it may be (including quotes, backslashes and newlines). |
979 | |
980 | Names begin with an alphabetic character or an underscore, and consist of |
981 | letters, digits and underscores. |
982 | |
983 | In general, ... |
984 | |
985 | |
986 | |
987 | @node Classes, Predefined classes, Basic syntax, The configuration file |
988 | @subsection Classes |
989 | |
990 | A @dfn{class} in Become is a set of users, hosts or commands. You can define |
991 | and name your own classes using statements of the form: |
992 | |
993 | @example |
994 | user @var{name} = @var{class-expr} ; |
995 | command @var{name} = @var{class-expr} ; |
996 | host @var{name} = @var{class-expr} ; |
997 | @end example |
998 | |
999 | A @var{class-expr} is an expression defining a class. You can build a |
1000 | complex class out of simple classes using the operators (in ascending |
1001 | precedence order) @samp{,}, @samp{-}, @samp{|} and @samp{&}, which represent |
1002 | the set options `union', `subtraction', `union' (again!), and `intersection'. |
1003 | Subexpressions can be parenthesised to override the default precedence. |
1004 | Once a class name has been defined, as shown above, it can be used in |
1005 | subsequent class expressions. |
1006 | |
1007 | A single user may be designated by either a user name (in quotes) or an |
1008 | integer uid. Commands and hosts may be designated by quoted strings which |
1009 | may contain wildcards. Host strings are matched against both numeric (dotted |
1010 | quad) IP addresses and the reverse-resolved hostname. Command strings are |
1011 | matched against the absolute pathname of the command the user wants to |
1012 | execute. |
1013 | |
1014 | |
1015 | |
1016 | @node Predefined classes, Allow statements, Classes, The configuration file |
1017 | @subsection Predefined classes |
1018 | |
1019 | In an attempt to make life a bit easier, Become creates a collection of |
1020 | predefined classes. |
1021 | |
1022 | The standard classes @code{all} and @code{none} match anything and nothing |
1023 | respectively. The @code{all} class is useful in some contexts: it gives you |
1024 | a way of saying `everything except@dots{}', for example: |
1025 | |
1026 | @example |
1027 | user MUNDANES = all - SYSHACKS; |
1028 | @end example |
1029 | |
1030 | @noindent |
1031 | The @code{none} class isn't particularly useful in itself. It's there for |
1032 | completeness. |
1033 | |
1034 | Become also defines some other classes: |
1035 | |
1036 | @itemize @bullet |
1037 | @item |
1038 | For each username @var{user}, Become adds a class called @samp{@var{user}} |
1039 | which matches just that user. |
1040 | |
1041 | @item |
1042 | For each group name @var{group}, Become creates a class called |
1043 | @samp{@var{group}} which matches any user who is a member of that group. |
1044 | |
1045 | @item For each netgroup @var{netgroup}, Become creates two classes: |
1046 | @samp{u_@var{netgroup}} which matches any user listed in the netgroup, and |
1047 | @samp{h_@var{netgroup}} which matches any host listed in the netgroup. |
1048 | @end itemize |
1049 | |
1050 | If a name is used for both a user @emph{and} a group, then corresponding |
1051 | class ends up containing the user together with all of the group members. |
1052 | For this reason, it's probably better to use the predefined classes for |
1053 | groups rather than individual users -- use quoted user names for individual |
1054 | users. |
1055 | |
1056 | Note that users and groups are read using the standard @code{get*ent} calls |
1057 | @emph{and} directly from the NIS server (if there is one). The idea here is |
1058 | that a Become server can be run on a machine which allows restricted logins. |
1059 | It still needs to know about all the users known to the outside world. |
1060 | |
1061 | Netgroups are read only from the NIS servers. In particular, although GNU |
1062 | systems allow netgroup databases to be stored in local files, Become wonn't |
1063 | read them because there's no defined interface for enumerating netgroups. |
1064 | |
1065 | |
1066 | @node Allow statements, Other statements, Predefined classes, The configuration file |
1067 | @subsection Allow statements |
1068 | |
1069 | Defining classes is just a means to an end. The end is to specify which |
1070 | users are allowed to do what, where, and as whom. This is done with an |
1071 | @code{allow} statement: |
1072 | |
1073 | @example |
1074 | allow [[@var{host-class}]] [@var{user-class}] -> [@var{user-class}] [ : @var{command-class}] |
1075 | @end example |
1076 | |
1077 | (The @var{host-class} is optional, but must be enclosed in square brackets if |
1078 | present.) |
1079 | |
1080 | The four classes in an allow statement are called, respectively, the `host', |
1081 | the `to-user', the `from-user' and the `command'. Any of the four classes |
1082 | may be omitted, and an omitted class defaults to `all'. |
1083 | |
1084 | When a request is received, Become checks the fields in the request against |
1085 | the classes in each allow statement of the configuration file. If a |
1086 | statement matches, the request is granted; if there are no full matches, |
1087 | the request is denied. |
1088 | |
1089 | |
1090 | @node Other statements, Example configuration file, Allow statements, The configuration file |
1091 | @subsection Other statements |
1092 | |
1093 | Two other statement types are defined. They only have an effect on Become in |
1094 | daemon mode: |
1095 | |
1096 | @example |
1097 | port @var{port} ; |
1098 | keyfile @var{key-file} ; |
1099 | @end example |
1100 | |
1101 | @noindent |
1102 | The @code{port} statement specifies the port to which the server should |
1103 | listen; the @var{port} may be be an integer or a quoted service name. The |
1104 | @code{keyfile} statement instructs Become to use the key from the file named |
1105 | @var{key-file}, which must be a quoted string. |
1106 | |
1107 | |
1108 | @node Example configuration file, Complete grammar, Other statements, The configuration file |
1109 | @subsection An example configuration file |
1110 | |
1111 | @example |
1112 | # |
1113 | # become.conf |
1114 | # |
1115 | # Example configuration file |
1116 | # |
1117 | |
1118 | allow wheel -> "root"; |
1119 | |
1120 | user NEWS = "fred", "jim"; |
1121 | allow NEWS -> "news"; |
1122 | |
1123 | user HTTP = "jim", "bob"; |
1124 | allow HTTP -> "httpd" : "/bin/kill", "/etc/init.d/httpd"; |
1125 | @end example |
1126 | |
1127 | |
1128 | @node Complete grammar, , Example configuration file, The configuration file |
1129 | @subsection Complete grammar for configuration files |
1130 | |
1131 | @format |
1132 | @var{file} ::= @var{file} @var{statement} |
1133 | |
1134 | @var{statement} ::= @var{class-def} |
1135 | | @var{allow-spec} |
1136 | | @var{port-spec} |
1137 | | @var{key-spec} |
1138 | |
1139 | @var{class-def} ::= @samp{user} @var{name} = @var{class-expr} @samp{;} |
1140 | | @samp{command} @var{name} = @var{class-expr} @samp{;} |
1141 | | @samp{host} @var{name} = @var{class-expr} @samp{;} |
1142 | |
1143 | @var{allow-spec} ::= @samp{allow} @var{opt-host-spec} @var{opt-user-spec} |
1144 | @samp{->} @var{opt-user-spec} @var{opt-command-spec} @samp{;} |
1145 | |
1146 | @var{opt-host-spec} ::= @samp{[} @var{class-expr} @samp{]} |
1147 | | @var{empty} |
1148 | |
1149 | @var{opt-user-spec} ::= @var{class-expr} |
1150 | | @var{empty} |
1151 | |
1152 | @var{opt-command-spec} ::= @samp{:} @var{class-expr} |
1153 | | @var{empty} |
1154 | |
1155 | @var{port-spec} ::= @samp{port} @var{integer} @samp{;} |
1156 | | @samp{port} @var{string} @samp{;} |
1157 | |
1158 | @var{key-spec} ::= @samp{keyfile} @var{string} @samp{;} |
1159 | |
1160 | @var{class-expr} ::= @var{class-diff-expr} |
1161 | | @var{class-expr} @samp{,} @var{class-diff-expr} |
1162 | |
1163 | @var{class-diff-expr} ::= @var{class-isect-expr} |
1164 | | @var{class-diff-expr} @samp{-} @var{class-union-expr} |
1165 | |
1166 | @var{class-union-expr} ::= @var{class-isect-expr} |
1167 | | @var{class-union-expr} @samp{|} @var{class-isect-expr} |
1168 | |
1169 | @var{class-isect-expr} ::= @var{class-primary} |
1170 | | @var{class-isect-expr} @samp{&} @var{class-primary} |
1171 | |
1172 | @var{class-primary} ::= @samp{(} @var{class-expr} @samp{)} |
1173 | | @var{string} |
1174 | | @var{integer} |
1175 | |
1176 | @var{integer} ::= one or more digits (@samp{0}--@samp{9}) |
1177 | |
1178 | @var{name} ::= an alphabetic character or underscore, followed by zero or |
1179 | more alphanumeric characters or underscores |
1180 | |
1181 | @var{string} ::= @samp{"} @var{string-chars} @samp{"} |
1182 | |
1183 | @var{string-chars} ::= @var{string-chars} @var{string-char} |
1184 | | @var{empty} |
1185 | |
1186 | @var{string-char} ::= a @samp{\} followed by any character |
1187 | | any character other than @samp{"}, @samp{\} or newline |
1188 | |
1189 | @var{empty} ::= |
1190 | @end format |
1191 | |
1192 | |
1193 | @node Networked configuration, , The configuration file, Administering Become |
1194 | @section Networked configuration |
1195 | |
1196 | If you're planning to use Become in a standalone way, you can skip this |
1197 | section. |
1198 | |
1199 | @menu |
1200 | * Choosing servers:: Which servers Become tries to talk to |
1201 | * Setting up keys:: How to generate keys for Become |
1202 | * Random number files:: Become keeps random number state around |
1203 | * Issuing a new key:: How to issue new keys without disruption |
1204 | @end menu |
1205 | |
1206 | |
1207 | @node Choosing servers, Setting up keys, Networked configuration, Networked configuration |
1208 | @subsection Choosing servers |
1209 | |
1210 | Become notices that it's meant to send requests to a server if it finds a |
1211 | @file{become.server} file. This file contains entries of the form |
1212 | |
1213 | @example |
1214 | @var{host} [: @var{port}] |
1215 | @end example |
1216 | |
1217 | If the @var{port} is omitted, Become chooses a port by looking at the |
1218 | services database for a service which matches the name by which Become was |
1219 | invoked: normally this will be @samp{become}. |
1220 | |
1221 | Become sends a request to all of the servers and believes the first valid |
1222 | reply it receives. Since servers ignore requests they believe to be invalid, |
1223 | this enables you to change Become's key without disrupting service |
1224 | (@pxref{Issuing a new key}). |
1225 | |
1226 | If you're using NIS, you should try to ensure that Become servers runs only |
1227 | on NIS servers; the NIS master is probably a good choice. |
1228 | |
1229 | Become isn't particularly processor-intensive, and doesn't seem to require |
1230 | very much memory. |
1231 | |
1232 | |
1233 | @node Setting up keys, Random number files, Choosing servers, Networked configuration |
1234 | @subsection Setting up keys |
1235 | |
1236 | Communication between Become clients and the server is encrypted to ensure |
1237 | that it's not feasible to gain unauthorised privilege by subverting the |
1238 | network. Become uses simple symmetric cryptography -- it's not necessary to |
1239 | use complicated public key techniques in this case. |
1240 | |
1241 | Each client machine, and the server, must have a copy of the same key. The |
1242 | key is usually stored in @file{/etc/become/become.key}. Become's keys are |
1243 | 128 bits long. |
1244 | |
1245 | The key file can be generated using the @code{keygen} program, supplied. The |
1246 | command |
1247 | |
1248 | @example |
1249 | keygen --bits=128 --output=/etc/become/become.key |
1250 | @end example |
1251 | |
1252 | @noindent |
1253 | generates a 128-bit key and writes it to @file{/etc/become/become.key} in a |
1254 | format which Become can read. |
1255 | |
1256 | The @code{keygen} program works by measuring the time between keystrokes. It |
1257 | also tries to obtain some randomness from the environment, and mixes all of |
1258 | this noise together before it outputs the key file. |
1259 | |
1260 | Having generated a key, it must be distributed to all of the other hosts |
1261 | which will use this server. The author recommends using the @code{scp} |
1262 | program, distributed with the @code{SSH} (Secure Shell) package, for doing |
1263 | this. |
1264 | |
1265 | Being able to read a key file enables a user to assume root privileges. The |
1266 | author recommends that only the super-user be able to read key files. |
1267 | |
1268 | @menu |
1269 | * Invoking keygen:: How to use the @code{keygen} program |
1270 | @end menu |
1271 | |
1272 | |
1273 | @node Invoking keygen, , Setting up keys, Setting up keys |
1274 | @subsubsection Invoking @code{keygen} |
1275 | |
1276 | @example |
1277 | keygen [@var{option}@dots{}] |
1278 | @end example |
1279 | |
1280 | By default, @code{keygen} generates a 128-bit key, and writes it to standard |
1281 | output in a hexadecimal format. This behaviour can be modified by passing |
1282 | options: |
1283 | |
1284 | @table @code |
1285 | @item -h |
1286 | @itemx --help |
1287 | Write a summary of @code{keygen}'s usage instructions to standard output and |
1288 | exits. |
1289 | |
1290 | @item -b @var{bits} |
1291 | @itemx --bits=@var{bits} |
1292 | Generate a @var{bits}-bit key, instead of the default 128 bits. |
1293 | |
1294 | @item -o @var{file} |
1295 | @itemx --output=@var{file} |
1296 | Write the key to @var{file} instead of standard output. |
1297 | |
1298 | @item -f @var{format} |
1299 | @itemx --format=@var{format} |
1300 | Set the format in which @code{keygen} outputs the generated key. If the |
1301 | @var{format} is @samp{hex} (or @samp{tx}), the key is output in Become's |
1302 | hexadecimal format; @samp{binary} writes the key as a raw binary dump; and |
1303 | @samp{base64} writes the key using the Base64 encoding. |
1304 | @end table |
1305 | |
1306 | |
1307 | |
1308 | @node Random number files, Issuing a new key, Setting up keys, Networked configuration |
1309 | @subsection Random number files |
1310 | |
1311 | Become uses random numbers to generate session keys when it's communicating |
1312 | with a server. When it's finished, it stores the state of its random number |
1313 | generator in a file, usually @code{/etc/become/become.random}. If this file |
1314 | doesn't exist, Become creates it automatically, using noise collected from |
1315 | the environment. It's probably not worth your while creating randomness |
1316 | files by hand. |
1317 | |
1318 | |
1319 | @node Issuing a new key, , Random number files, Networked configuration |
1320 | @subsection Issuing a new key |
1321 | |
1322 | When you're sending out a new key, you run a risk of disrupting service. The |
1323 | server reads a new key; the clients still have the old one. |
1324 | |
1325 | The author's recommendation is to run two servers. Update the key on one. |
1326 | Then send the new key to all of the clients. Finally, update the key on the |
1327 | other server. Because of the way Become works, a client will always get a |
1328 | response from one of the servers, depending on whether the new key has |
1329 | reached it yet. |
1330 | |
1331 | A similar method is handy if Become's protocol ever changes. (This is quite |
1332 | likely at the moment. The current protocol doesn't include any version |
1333 | information, and the MAC isn't as good as it could be.) |
1334 | |
1335 | |
1336 | @c -------------------------------------------------------------------------- |
1337 | @node Invoking Become, , Administering Become, Top |
1338 | @chapter Invoking Become |
1339 | |
1340 | |
1341 | This chapter provides an exhaustive description of Become's command line |
1342 | options, organised in a reference-manual sort of way. |
1343 | |
1344 | @menu |
1345 | * Becoming another user:: Options for becoming another user |
1346 | * Starting Become daemons:: Options for starting Become daemons |
1347 | * Debugging options:: Options to use when Become goes wrong |
1348 | @end menu |
1349 | |
1350 | |
1351 | |
1352 | @node Becoming another user, Starting Become daemons, Invoking Become, Invoking Become |
1353 | @section Becoming another user |
1354 | |
1355 | @subsection Synopsis |
1356 | |
1357 | @example |
1358 | become [@var{option}@dots{}] [@var{env-var}@dots{}] @var{user} [@var{command} [@var{argument}@dots{}]] |
1359 | @end example |
1360 | |
1361 | Actually, you can put the @var{option}s, @var{env-var}s and @var{user} in any |
1362 | order you like; the important thing is that all of them appear before the |
1363 | command, if any. |
1364 | |
1365 | |
1366 | @subsection Usage |
1367 | |
1368 | The @var{option}s appropriate for this mode are as follows: |
1369 | |
1370 | @table @code |
1371 | @item -h |
1372 | @itemx --help |
1373 | Display a (fairly verbose) help message describing the various command line |
1374 | options and exits successfully. |
1375 | |
1376 | @item -u |
1377 | @itemx --usage |
1378 | Display a terse summary of the command line options and exits successfully. |
1379 | |
1380 | @item -v |
1381 | @itemx |
1382 | Display's Become's version number and exits successfully. |
1383 | |
1384 | @item -e |
1385 | @item --preserve-environment |
1386 | Selects the `preserve' login style (@pxref{The preserve style}). All |
1387 | environment variables are preserved. The default command is the current |
1388 | user's own shell. The default primary group becomes the current primary |
1389 | group; the default group style is set to `merge'. |
1390 | |
1391 | @item -s |
1392 | @itemx --su |
1393 | @itemx --set-user |
1394 | Selects the `set-user' login style (@pxref{The set-user style}). Most |
1395 | environment variables are preserved, but @code{USER}, @code{LOGNAME}, |
1396 | @code{HOME} and other user-specific variables are altered to reflect the |
1397 | target user's configuration. The default command is the target user's shell. |
1398 | The default primary group becomes the target user's primary group; the |
1399 | default group style is set to `merge'. |
1400 | |
1401 | @item -l |
1402 | @itemx --login |
1403 | Selects the `login' login style (@pxref{The login style}). The environment |
1404 | is cleared and rebuilt, in a similar way to the behaviour of @code{login}. |
1405 | The default command is the target user's shell. The default primary group |
1406 | becomes the target user's primary group; the default group style is set to |
1407 | `replace'. |
1408 | |
1409 | @item -g @var{group} |
1410 | @itemx --group=@var{group} |
1411 | Selects @var{group} as the primary group; it may be either a group name or a |
1412 | numeric group id. Note that @var{group} must be the primary group or |
1413 | a subsidiary group of either the current user or the target user. |
1414 | |
1415 | @item -k |
1416 | @itemx --keep-groups |
1417 | Selects the `keep' group style (@pxref{Subsidiary groups}). The current set |
1418 | of subsidiary group memberships are passed on unchanged. |
1419 | |
1420 | @item -m |
1421 | @itemx --merge-groups |
1422 | Selects the `merge' group style (@pxref{Subsidiary groups}). The current set |
1423 | of subsidiary group memberships are merged with the subsidiary groups of the |
1424 | target user. |
1425 | |
1426 | @item -r |
1427 | @itemx --replace-groups |
1428 | Selects the `replace' group style (@pxref{Subsidiary groups}). The target |
1429 | user's subsidiary group memberships are passed on; the current subsidiary |
1430 | groups are discarded. |
1431 | |
1432 | @item -c @var{shell-cmd} |
1433 | @itemx --command=@var{shell-cmd} |
1434 | Sets the @var{command} and @var{argument}s to invoke |
1435 | @code{/bin/sh -c @var{shell-cmd}}; i.e., to execute a Bourne shell command |
1436 | instead of just @code{exec}ing a program. Note that permissions are checked |
1437 | for executing the Bourne shell @code{/bin/sh}; the contents of the |
1438 | @var{shell-cmd} are not inspected. |
1439 | @end table |
1440 | |
1441 | The @var{env-var} arguments fine-tune the environment passed to the command. |
1442 | Each @var{env-var} setting must be one of the following: |
1443 | |
1444 | @table @code |
1445 | @item @var{var}=@var{value} |
1446 | Assign the variable named @var{var} the value @var{value}. Protect the |
1447 | variable @var{var} from modifications by the login style. |
1448 | |
1449 | @item @var{var}! |
1450 | Protect the variable @var{var} from modifications by the login style, but |
1451 | don't change its value. |
1452 | |
1453 | @item @var{var}- |
1454 | Remove the variable @var{var} from the environment; do not pass it on. |
1455 | @end table |
1456 | |
1457 | The @var{user} specifies the user as whom the @var{command} should be |
1458 | executed (i.e., the @dfn{target user}). It may be a user name or a numeric |
1459 | user id. |
1460 | |
1461 | The @var{command} specifies a command to execute. If @var{command} does not |
1462 | contain a path, it is looked for using the current @code{PATH} environment |
1463 | variable. The resulting pathname is canonified if necessary, to produce an |
1464 | absolute pathname. Note that symbolic links are @emph{not} resolved -- this |
1465 | prevents an attack whereby a user could invoke a program, passing it an |
1466 | unusual @code{argv[0]} which might cause unusual behaviour. |
1467 | |
1468 | The @var{command} name is used both as the command to execute and passed to |
1469 | the command as @code{argv[0]}. It is not possible to specify an alternative |
1470 | calue to be passed as @code{argv[0]}. Subsequent arguments, if supplied, are |
1471 | passed as @code{argv[1]} upwards. |
1472 | |
1473 | If no @var{command} is given, a shell is invoked; the particulars of the |
1474 | shell are determined by the login style (see above). |
1475 | |
1476 | The @var{command} is executed as follows: |
1477 | |
1478 | @itemize @bullet |
1479 | @item |
1480 | The subsidiary groups are chosen as determined by the group style. |
1481 | @item |
1482 | The real and effective gids are set. |
1483 | @item |
1484 | The real and effective uids are set. |
1485 | @item |
1486 | The @var{command} is called using the standard @code{execve} system call. |
1487 | @end itemize |
1488 | |
1489 | |
1490 | |
1491 | @node Starting Become daemons, Debugging options, Becoming another user, Invoking Become |
1492 | @section Starting Become daemons |
1493 | |
1494 | @subsection Synopsis |
1495 | |
1496 | @example |
1497 | become --daemon [@var{option}@dots{}] |
1498 | @end example |
1499 | |
1500 | |
1501 | @subsection Usage |
1502 | |
1503 | The following options are appropriate to this mode: |
1504 | |
1505 | @table @code |
1506 | @item -h |
1507 | @itemx --help |
1508 | Display a (fairly verbose) help message describing the various command line |
1509 | options and exits successfully. |
1510 | |
1511 | @item -u |
1512 | @itemx --usage |
1513 | Display a terse summary of the command line options and exits successfully. |
1514 | |
1515 | @item -v |
1516 | @itemx |
1517 | Display's Become's version number and exits successfully. |
1518 | |
1519 | @item -d |
1520 | @itemx --daemon |
1521 | Start a Become server, instead of processing a request. Become will read its |
1522 | command line options, read in the configuration file (and verify that it's |
1523 | correct) and then fork into the background to wait for incoming requests. |
1524 | Become relinquishes all setuid privileges (by setting all uids to the real |
1525 | uid) when it enters daemon mode. It is therefore only really useful to run a |
1526 | daemon as the superuser. |
1527 | |
1528 | @item -p @var{port} |
1529 | @itemx --port=@var{port} |
1530 | Listen for requests on @var{port}. This option is overridden by the |
1531 | @code{port} option in the configuration file. |
1532 | |
1533 | @item -f @var{file} |
1534 | @itemx --config-file=@var{file} |
1535 | Read configuration from @var{file}, instead of the default (usually |
1536 | @file{/etc/become/become.conf}). |
1537 | @end table |
1538 | |
1539 | The syntax of the configuration file is described in @ref{The configuration |
1540 | file}. |
1541 | |
1542 | |
1543 | @node Debugging options, , Starting Become daemons, Invoking Become |
1544 | @section Debugging options |
1545 | |
1546 | Some options are only useful when trying to find out why Become is |
1547 | misbehaving. Of course, this never happens, so here are the options which |
1548 | you won't need to use: |
1549 | |
1550 | @table @code |
1551 | @item -T[@var{file}] |
1552 | @itemx --trace[=@var{file}] |
1553 | Write trace information to @var{file} (or to standard output, if no |
1554 | @var{file} is specified). You must be able to create the file and open it |
1555 | for writing. |
1556 | |
1557 | @item -L[@var{feature}...] |
1558 | @itemx --trace-level[=@var{feature}] |
1559 | Selects which features Become ought to trace. Each feature is allocated a |
1560 | letter; simply string together the letters for the features you want to |
1561 | debug. The letters @samp{D} and @samp{A} stand respectively for `default' |
1562 | and `all' features; you can subtract from them by saying, for example, |
1563 | @samp{A-xyz} to select all features except @samp{x}, @samp{y} and @samp{z}. |
1564 | The exact list of features supported at any one time can be listed by giving |
1565 | the @code{--trace-level} option without an argument. |
1566 | |
1567 | @item -I @var{user} |
1568 | @itemx --impersonate=@var{user} |
1569 | Pretend to be @var{user} instead of yourself when the request is checked. |
1570 | This option can only be used if it wasn't disabled at compile-time and if |
1571 | Become is not running setuid. Even so, Become will only inform you of the |
1572 | outcome; it will not execute any commands. |
1573 | @end table |
1574 | |
1575 | |
1576 | |
1577 | @c -------------------------------------------------------------------------- |
1578 | |
1579 | @c --- No index yet --- |
1580 | @c |
1581 | @c @node Concept index, , Invoking Become, Top |
1582 | @c @unnumbered Concept index |
1583 | @c @printindex cp |
1584 | @c |
1585 | @c @contents |
1586 | |
1587 | @bye |
1588 | |
1589 | @c ----- That's all, folks -------------------------------------------------- |