root/op/1.27/op.paper

Revision 207, 14.5 kB (checked in by root, 5 years ago)

Initial import.

Line 
1         Op: A Flexible Tool for Restricted Superuser
2                            Access
3
4                       Tom Christiansen
5
6                 CONVEX Computer Corporation
7                          POB 833851
8                    3000 Waterview Parkway
9                  Richardson, TX  75083-3851
10
11              {uunet,uiucdcs,sun}!convex!tchrist
12                      tchrist@convex.com
13
14                           ABSTRACT
15
16           The op tool provides  a  flexible  means  for
17      system   administrators  to  grant  trusted  users
18      access to certain root operations  without  having
19      to give them full superuser privileges.  Different
20      sets of users may access different operations, and
21      the  security-related  aspects  of  environment of
22      each operation can be carefully controlled.
23
24      One sure way to render a UNIX  system  unstable  is  to
25 distribute  the  root  password  to everyone who thinks they
26 need it.  Well-meaning and experienced though  these  people
27 may  be,  they will inevitably introduce anomalies into your
28 system that will cause it to malfunction in mysterious ways.
29 You  may  spend  hours or even days trying to determine what
30 was changed, by whom, and for  what  reason.   This  problem
31 occurs even when all parties involved are experienced system
32 administrators.
33
34      Furthermore, large sites often have computer  operators
35 who  attend  to  the routine tasks of system administration,
36 such as dumps and restores, tape handling, system  shutdown,
37 and  so  on.   These people may not be sophisticated and you
38 may not wish them to have complete system privileges  to  do
39 their  jobs.  Denying the superuser password to your cowork-
40 ers or management is difficult,  if  not  impossible.   This
41 difficulty  is  particularly true in a technical environment
42 where programmers may be competent, but insensitive  to  the
43 management of a complex system.
44
45      The op program, a standard utility provided by  CONVEX,
46 is  specifically  designed  to address this problem.  The op
47 program gives the system manager a means to grant a user  or
48
49                         July 2, 1991
50
51                            - 2 -
52
53 group of users limited access to specific superuser commands
54 without granting access to all superuser privileges.   Care-
55 ful control of the environment provides both flexibility and
56 security.
57
58      To set up your system, the op  program,  you  begin  by
59 finding  out  the specific tasks for which system privileges
60 are deemed necessary when  a  user  requests  the  superuser
61 password.  Complete access to every command on the system is
62 usually not required.  Using  op,  the  system  manager  can
63 designate  a set of privileged commands and access lists for
64 these commands; the system manager,  in  effect,  can  grant
65 limited system privileges beyond those normally available to
66 a normal user without giving away full superuser privileges.
67
68      The op program is not interactive; it  functions  as  a
69 prefix  command,  similar to time or nice, whose side-effect
70 is to alter the user's  environment  in  some  fashion.  The
71 functions  (or  mnemonics)  understood by the op program are
72 listed in the configurable ascii data  file  /etc/op.access.
73 This file describes what commands can be performed by the op
74 program, how they are to be performed, and who is allowed to
75 perform  them.   For  security  reasons, this file should be
76 owned and readable only by the superuser.   Each  invocation
77 of  op  is logged using syslog(3) with the LOG_AUTH facility
78 class.
79
80      The restrictions can be made  as  tight  as  each  site
81 demands,  as determined by the system administrator who cus-
82 tomizes the op.access file.  This file contains a mapping of
83 mnemonics,  or  operator functions, to the full pathnames of
84 programs that should be invoked and the arguments  that  are
85 allowed,  if any.  The arguments to the executed program can
86 be a combination of literal and variable arguments, and res-
87 trictions  can be placed on which values are valid substitu-
88 tions for the variable arguments.   Because  some  syntactic
89 checking  of the command arguments is possible, running com-
90 mands under op can be safer than running them directly  from
91 a  superuser's  shell.  This safety feature can prevent pit-
92 falls like accidentally transposing the file system and tape
93 device  arguments  to  the  dump  program  (eg.  dump  0uf /
94 /dev/rmt16), which would destroy the file system.
95
96      The following set of attributes can be  controlled  for
97 each mnemonic by the op program:
98
99         o    the user id to set
100
101         o    the group vector to set
102
103         o    the directory to chdir(2) to
104
105         o    the root directory to set with chroot(2)
106
107                         July 2, 1991
108
109                            - 3 -
110
111         o    the umask to set
112
113         o    a list of groups allowed to execute this function
114
115         o    a list of users allowed to execute this function
116
117         o    the range of valid arguments for the command,  both  in
118              number and value
119
120         o    any environment variable settings
121
122      The fields of the entries in op.access are separated by
123 white  space.  Each entry may span several lines and contin-
124 ues until the next  alphanumeric  string  is  found  at  the
125 beginning of a line (which is taken to be the next mnemonic,
126 and thus the beginning of a new  entry).   Comments  may  be
127 embedded  beginning  with  a  #  character.   Each  entry in
128 op.access has the following form:
129
130      mnemonic     command  [ arg ... ]  ;  [ option ... ]
131
132 where the fields are interpreted in the following manner:
133
134 mnemonic    a  unique,  alphanumeric  identifier  for   each
135             operator function.
136
137 command     the full pathname of the executable to be run by
138             op when the associated mnemonic is chosen.
139
140 arg(s)      any  arguments,  either  literal  or   variable,
141             needed by command.  Literal arguments are simply
142             specified  directly,   like   specific   command
143             options  (0Gun) or files (/dev/rmt20).  Variable
144             arguments are specified here as $1, $2  ...  $n;
145             these  are  described  more fully in the options
146             section below.  $* indicates any number trailing
147             arguments.
148
149 option(s)   a set of optional parameters to specify settings
150             or  restrictions  for  the  particular mnemonic,
151             define variable arguments specified for the com-
152             mand,  and define environment variable settings.
153             Options are separated by white space and are  of
154             the   form  keyword=value.   The  absence  of  a
155             specific option means the default is sufficient.
156             The  value  can  be  a single value or a list of
157             values separated by commas,  where  appropriate.
158             There  should  be no white space in each element
159             of the value string unless quoted.  The  keyword
160             is any of the following types:
161
162             uid     Set the user id to the value  specified.
163                     The  value can be a numeric user ID or a
164
165                         July 2, 1991
166
167                            - 4 -
168
169                     login name.  The default is root.
170
171             gid     Set the group ids to the  values  speci-
172                     fied.  Each value can be a numeric group
173                     ID or a group name.
174
175             dir     Change the current working directory  to
176                     the path specified.
177
178             chroot  Change the root directory  to  the  path
179                     specified using chroot.
180
181             umask   Set the file creation umask to the octal
182                     value  specified.  The default is to set
183                     it to 022.
184
185             groups  Allow any user who belongs  to  a  group
186                     listed here to execute this op function.
187                     The default is not to allow any specific
188                     group.
189
190             users   Allow any user listed  here  to  execute
191                     this op function.  The default is not to
192                     allow any specific users.  You  may  use
193                     the  regular  expression  .* to indicate
194                     that all users may use this mnemonic.
195
196             $n      defines the nth variable argument speci-
197                     fied in the command arg list.  The value
198                     for this type may be  a  comma-separated
199                     list   of   regular   expressions  using
200                     regex(3).  option defines the  range  of
201                     values  allowed  for  the variable argu-
202                     ments.  A variable argument specified as
203                     a  command  arg but not described in the
204                     options section may take on  any  value.
205                     If an argument does not match any of its
206                     permitted values, then a  diagnostic  is
207                     printed and the command is not executed.
208
209             $*      is used in the options section to  place
210                     restrictions  on  the trailing arguments
211                     specified as $* in the args section.  If
212                     any  of  these (possibly many) arguments
213                     do  not  match,  then  a  diagnostic  is
214                     printed,  and  the  command  is not exe-
215                     cuted.
216
217             $VAR    where VAR is the name of an  environment
218                     variable.    The  specified  environment
219                     variable  is  set  to  the  value  given
220                     before  the  command  is executed.  As a
221                     special case, simply using $VAR with  no
222                     =  part  (as  in  $USER) means that this
223
224                         July 2, 1991
225
226                            - 5 -
227
228                     environment   variable   is    inherited
229                     unchanged from the caller's shell.
230
231      There can also be a special entry in the file beginning
232 at the first non-comment line that can define default values
233 to override the builtin defaults listed here, yet  still  be
234 overridden  by  any  entry that wants to redefine any of the
235 keyword fields described above.  It should have the  follow-
236 ing format:
237
238      DEFAULT      keyword_option ...
239 where keyword_option is a  keyword=value  strings  mentioned
240 above under options.
241
242      It should be noted that if any regular  mnemonic  entry
243 defines  its own option, the value given for that entry must
244 explicitly include the item from the  DEFAULT  line  if  the
245 default  value  is  to  be  included.   That is, the options
246 definitions completely override any defaults;  they  do  not
247 add  to  them.   In  this  way,  if a value specified on the
248 DEFAULT line for users or groups (for example) needs  to  be
249 "erased"  without redefining new values (that is, we want no
250 users or groups to be allowed to run  this  mnemonic),  then
251 the  default  value  must  be overridden with nothing (as in
252 users=).  For the users and groups fields, such a null  set-
253 ting  has  the effect of setting the list of allowable users
254 or groups to be empty.  For the other  keywords  (uid,  gid,
255 dir,  chroot,  and umask), a null setting leaves that attri-
256 bute as it is upon invocation of the op program,  overriding
257 any defaults.
258
259      This file format may seem complex at first glance,  but
260 is  actually  intuitive  and flexible.  An example op.access
261 file might look like:
262
263                         July 2, 1991
264
265                            - 6 -
266
267 # first, define the site defaults we want to use here
268 # we would like the people in `operator' group to be able to execute
269 # almost everything, so it is easier to put it here than on every line...
270 # set up default envariables
271 #
272 DEFAULT groups=operator $USER $TERM $PATH=/usr/ucb:/usr/bin:/bin
273 #
274 #    find out who's filled up the disk; anyone may do this
275 #
276 full            /usr/etc/quot $1; users=.*
277 #
278 #    filesystem backups
279 #
280 daily           /etc/dump 5Gun $1; $1=/,/usr[0-9]*,/project
281 weekly          /etc/dump 0Gun $1; $1=/,/usr[0-9]*,/project
282 #
283 #    tape handling commands
284 #    must include `operator' if we want them to be allowed as well
285 #
286 tape            /etc/tpc $1 $2; groups=tapeopers,operator users=boss
287                 $1=enable,disable,stop,restart $2=all,unit[01]
288 #
289 mounted         /etc/tpc mounted unit$1 $2; $1=[0-3]
290 #
291 #    taking the system down
292 #    $1 shows a good use of regular expressions;
293 #    $2 can be anything, but is required; no instant shutdowns
294 #
295 shutdown        /etc/shutdown -h $1 $2; $1=+[1-9][0-9]*,[0-9]*:[0-9]*
296 reboot          /etc/shutdown -r $1 $2; $1=+[1-9][0-9]*,[0-9]*:[0-9]*
297 #
298 #    start up disco daemon
299 disco           /etc/opbin/start_disco; uid=disco gid=proj dir=/scratch
300                         umask=027 groups=geo,disco users=snoopy,linus
301                         $USER=disco $SHELL=/bin/shell
302 #
303 #    let certain people mount and unmount the removable drive
304 #
305 rdsmount        /etc/mount $1 $2; groups=operator,swdev,disco users=bob,steve $1=/dev/dd0[a-g] $2=/.*
306 rdsumount       /etc/umount $1; groups=operator,swdev,disco users=bob,steve $1=/dev/dd0[a-g]
307 #
308 #    allow operators to give files away; notice that they
309 #    they must give at least two args, but may give more
310 #
311 chown            /etc/chown $1 $2 $*; $1=[a-z0-9][a-z0-9]*
312 #
313 #    permit development personnel to run install
314 #
315 inst            /usr/bin/install -o root -g system $1 $2; groups=devel
316                         $2=/bin,/usr/bin,/usr/ucb,/usr/new,/usr/local
317 #
318 nfsmount        /etc/mount -o timeo=100,hard,intr $1 $2; groups=devel,operator
319                         $1=\([a-zA-Z0-9_]*\):\(.*\) $2=/remote/\1\2
320
321                         July 2, 1991
322
323                            - 7 -
324
325      Some example command lines using op,  given  the  above
326 op.access file, might be:
327
328      % op full /usr1
329      % op weekly /usr1
330      % op tape disable unit0
331      % op reboot 17:30 "We have to fix our network."
332      % op disco
333      % op rdsmount  /dev/dd0c  ~/mystuff
334      % op mounted 3 8688
335      % op chown jim  /tmp/bill/*
336      % op inst less  /usr/local
337      % op nfsmount  convexs:/usr/src  /remote/convexs/usr/src
338
339      Note that the following commands would not work because
340 they  would  not  match the back-reference specifications in
341 the nfsmount mnemonic:
342
343      op nfsmount convexs:/usr/src /remote/foobar/usr/src
344      op nfsmount convexs:/usr/src /remote/convexs/src
345
346      In summary, the op program allows the system manager to
347 give  out limited system privileges without compromising the
348 root password.  The system can be easily tuned to the  needs
349 of a specific site.  The environment in which these commands
350 execute  can  be  tightly  controlled  and  their  arguments
351 checked  for  valid  values.  For security reasons, a log is
352 kept of all commands run.  Careful  application  of  the  op
353 program can result in a stabler system.
354
355                         July 2, 1991
Note: See TracBrowser for help on using the browser.