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