root/op/1.32/op.1

Revision 261, 10.1 kB (checked in by athomas, 3 years ago)
  • Branched 1.32
Line 
1 .TH OP 1
2 .UC 4
3 .SH NAME
4 op \- operator access
5 .SH SYNOPSIS
6 .B op
7 mnemonic [arg]
8 .SH DESCRIPTION
9 The
10 .I op
11 tool provides a flexible means for system administrators to grant
12 trusted users access to certain
13 .B root
14 operations without having to give them full superuser privileges.
15 Different sets of users may access different operations, and the
16 security-related aspects of environment of each
17 operation can be carefully controlled.
18 .SH OPTIONS
19 .TP
20 .B -V
21 Show version number.
22 .TP
23 .B -l
24 List available commands. Note that this will only display commands you are
25 permitted to run.
26 .SH CONFIGURATION
27 .PP
28 Configuration entries are read from
29 .B /etc/op.conf
30 and all files in lexical order from
31 .B /etc/op.d
32 with the extension
33 .B .conf.
34 Files must be owned by
35 .I root
36 and not have
37 .I group
38 or
39 .I other
40 permissions set.
41 .PP
42 The fields of the entries in the configuration files are separated by white
43 space.  Each entry may span several lines and continues until the next
44 alphanumeric string is found at the beginning of a lines (which is taken to be
45 the next
46 .I mnemonic or variable definition,
47 and thus the beginning of a new entry).  Comments may be embedded
48 beginning with a # character.  Each entry in the configuration files has the
49 following form:
50 .RS
51 .DT
52 .PP
53 \fImnemonic     command \fR[\fI arg ... \fR]\fI ; \fR[\fI option ... \fR]
54 .RE
55 or
56 .RS
57 .DT
58 var=value
59 .PP
60 .RE
61 where the fields are interpreted in the following manner:
62 .TP
63 .I var
64 a variable name, which must be an upper case alphanumeric identifier.
65 Variables are expanded when reading options.
66 .TP
67 .I value
68 the remainder of the line is taken to be the value of the variable.
69 .TP
70 .I mnemonic
71 a unique, alphanumeric identifier for each operator function.
72 .TP
73 .I command
74 the full pathname of the executable to be run by
75 .I op
76 when the associated
77 .I mnemonic
78 is chosen.
79 .TP
80 .I arg(s)
81 any arguments, either literal or variable, needed by
82 .I command.
83 Literal arguments are simply specified directly, like specific command
84 options (\fB0Gun\fR) or files (\fB/dev/rmt20\fR).  Variable arguments
85 are specified here as \fB$1, $2 ... $\fR\fIn\fR; these are described
86 more fully in the options section below. \fB$*\fR indicates any number
87 trailing arguments.
88 .TP
89 .I option(s)
90 a set of optional parameters to specify settings or restoring for the
91 particular
92 .I mnemonic,
93 define variable arguments specified for the
94 .I command,
95 space and are of the form
96 .I keyword=value.
97 The absence of a specific list of values separated by commas, where
98 appropriate.
99 There should be no white space in each element of the
100 .I value
101 string unless quoted.  The
102 .I keyword
103 is any of the following types:
104 .TP
105 .B uid
106 Set the user id to the value specified.  The value can be numeric user
107 ID or a login name.  The default is
108 .B root.
109 .TP
110 .B gid
111 Set the group id's to the values specified.  Each value can be a numeric
112 group ID or a group name.
113 .TP
114 .B dir
115 Change the current working directory to the path specified.
116 .TP
117 .B chroot
118 Change the root directory to the path specified using
119 .I chroot.
120 .TP
121 .B umask
122 Set the file creation umask to the octal value specified.  The default
123 is to set it to
124 .B 022.
125 .TP
126 .B groups
127 Allow any user who belongs to a group listed here to execute this
128 .I op
129 function.  The default is not to allow any specific group. Note that the user
130 and group strings are always treated as regular expressions, meaning the user
131 name 'a' will match *any* user with the letter A in their name. In addition,
132 group@hostname can be used to explicitly allow access only on specific hosts.
133
134 .TP
135 .B users
136 Allow any user listed here to execute this
137 .I op
138 function.  The default is to not allow any specific users.  You may use
139 the regular expression .* to indicate that all users may use this
140 mnemonic.  User expressions are in the form <user>[@<host>][/<expiry>] where
141 <user> is a regular expression matched against the current system user, <host>
142 is a regular expression matched against the systems hostname and <expiry> is a
143 time in the form YYYYMMDD[hh[mm]] when that users access to the command
144 expires.
145 .TP
146 .B netgroups
147 Allow any user who belongs to a netgroup listed here to execute this
148 .I op
149 function. The default is not to allow any specific netgroup.
150
151 .TP
152 .B password
153 Queries the user for a password. If there is an = part the value is the crypted
154 password required, otherwise the users own password is asked.
155 .TP
156 .B securid
157 Queries the user for SecureID PIN and code. If op has been compiled
158 without SecurID support, this option will cause the command to fail
159 with an error message.
160 .TP
161 .BI $VAR
162 where
163 .I VAR
164 is the name of an environment variable.  The specified environment
165 case, simply using
166 .I $VAR with no = part (as in
167 .B $USER)
168 means that this environment variable is inherited unchanged from
169 the caller's shell. If the $VAR is an assignment the environment variable
170 is set to the specified value in the new environment.
171 .TP
172 .B environment
173 Disables the destruction of the users environment.
174 .TP
175 .B help
176 Define help for this mnemonic. Defaults to the full command.
177 .I op -l
178 will display this help when it lists the available commands. eg.
179 .I help="This is some help"
180 .TP
181 .B nolog
182 Disables informational logging per command. Useful for cron jobs to avoid
183 spamming the logs. Note that authentication failures and other errors will
184 still be logged.
185 .TP
186 .B fowners
187 Specifies the owner and group of the target command executable as a list of
188 regular expression in the form
189 .I user:group
190 If the executables ownership does not match, the command will not be executed.
191 .TP
192 .B fperms
193 As with
194 .I fowners
195 but matches against the octal permissions of the executable.
196 .TP
197 .B xauth
198 Attempt to propagate the X authority entry for the current display to the new
199 users X authority file. The DISPLAY environment variable is also propagated to
200 the new environment. The destination user is determined by first using the user
201 specified after xauth=..., then the user specified by uid=... then finally the
202 root user is used.
203 .TP
204 .B $n
205 defines the \fIn\fRth variable argument specified in the command
206 .I arg
207 list.  The value for this type may be a comma-separated list of regular
208 expressions using \fIegrep\fR(1).  option defines the range of values
209 allowed for the variable arguments  A variable argument specified as a
210 command
211 .I arg
212 but not described in the
213 .I options
214 section may take on any value.  If an argument does not match any
215 of its permitted values, then a diagnostic is printed and the
216 command is not executed.  When using '(' syntax to pass values
217 to other options, only the next options can use values from
218 the previous search.
219 .TP
220 .B $*
221 is used in the
222 .I options
223 section to place restriction on the trailing arguments
224 specified as $* in the
225 .I args
226 section.  If any of these (possibly many) arguments do not match, then
227 a diagnostic is printed, and the command is not executed.
228 .PP
229 There can also be a special entry in the file beginning at the first
230 non-comment line
231 that can define default values to override the builtin defaults listed
232 here, yet still be overridden by any entry that wants to redefine any of
233 the keyword fields described above.  It should have the following format:
234 .RS
235 .DT
236 \fBDEFAULT\fR   \fIkeyword_option\fR
237 .RE
238 where \fIkeyword_option\fR is a \fIkeyword=value\fR string mentioned above
239 under \fIoptions\fR.
240 .PP
241 It should be noted that if any regular
242 .I mnemonic
243 entry defines its own
244 .I option,
245 the value given for that entry must explicitly include the item from the
246 DEFAULT line if the default values is to be included.  That is, the
247 .I options
248 definitions completely override any
249 defaults; they do not add to them  In this way, if a value specified on
250 the DEFAULT line for
251 .B users
252 or
253 .B groups
254 (for example) needs to be "erased" without redefining new values
255 (that is, we want no users or groups to be allowed to run the mnemonic),
256 then the default value must be overridden with nothing (as in
257 \fBusers=\fR).  For the
258 .B users
259 or
260 .B groups
261 fields, such a null setting has the effect of setting the list of
262 allowable users or groups to be empty.  For the other keywords (\fR
263 uid, gid, dir, chroot, \fRand\fB umask\fR), a null setting leaves that
264 attribute as it is upon invocation of the
265 .I op
266 program, overriding any defaults.
267 .PP
268 Another note is that if the
269 .I command
270 for a
271 .I mnemonic
272 is
273 .B MAGIC_SHELL
274 then a shell (using the users $SHELL environment variable) is created,
275 if there are arguments in addition to the
276 .I mnemonic
277 on the command line then the shell is invoked "-c args".
278 .SH EXAMPLES
279 .PP
280 Example /etc/op.conf:
281 .RS
282 .PP
283 # Define some users
284 .br
285 OPERATORS=(fred|barry)
286 .br
287 # Define hosts that Fred is restricted to
288 .br
289 FRED_HOSTS=(alpha|beta)
290 .br
291 # Define hosts that Barry is restricted to
292 .br
293 BARRY_HOSTS=(theta|gamma)
294 .br
295 # Define user/host access list
296 .br
297 ACCESS_LIST=fred@FRED_HOSTS|barry@BARRY_HOSTS
298 .PP
299 .br
300 # 'op shell' - gives user a root shell
301 .br
302 shell
303 .br
304     /bin/su -;
305 .br
306         users=ACCESS_LIST
307 .br
308         environment
309 .br
310         password
311 .br
312     help="Root shell"
313 .PP
314 .br
315 # 'op reboot' - reboot system
316 .br
317 reboot
318 .br
319     /sbin/reboot;
320 .br
321         users=ACCESS_LIST
322 .br
323         password
324 .br
325     help="Reboot system"
326 .PP
327 # 'op shutdown <time>' - shutdown at a
328 .br
329 # certain time. Restricts argument to
330 .br
331 # valid values only
332 .br
333 shutdown
334 .br
335     /sbin/shutdown -h $1;
336 .br
337     users=ACCESS_LIST
338 .br
339     $1=(now|[0-1]?[0-9]:[0-9][0-9]|2[0-3]:[0-5][0-9]|\+[0-9]+)
340 .br
341     help="Shutdown system"
342 .PP
343 # Switch inetd on and off, shows complex
344 .br
345 # shell example and 'string' arguments. $1
346 .br
347 # in this example is expanded by op
348 .br
349 inetd /bin/sh -c '
350 .br
351         case $1 in
352 .br
353             on) /usr/sbin/inetd -s ;;
354 .br
355             off) /usr/bin/pkill inetd ;;
356 .br
357         esac
358 .br
359     ';
360 .br
361     users=ACCESS_LIST
362 .br
363     $1=on|off
364 .PP
365
366 .SH FILES
367 .TP
368 .B /etc/op.conf
369 Access control description file.
370 .TP
371 .B /etc/op.d/*.conf
372 Access control description files.
373 .SH "SEE ALSO"
374 sudo(1), su(1), chroot(2), egrep(1)
375 .SH CREDIT
376 .B "Op: A flexible Tool for Restricted Superuser Access",
377 originally by
378 .I "Tom Christiansen"
379 , CONVEX Computer Corporation,
380 .B "Proceedings of the Large Installation Systems Administration III Workshop".
381 Further changes by
382 .I "Howard Owen"
383 , currently maintained by
384 .I "Alec Thomas".
385 .
386 .SH BUG REPORTS TO
387 alec@swapoff.org
388 .SH COPYRIGHTS
389 \fB\(co\fR\s12 Copyright 1991 by David Koblas
390 \fB\(co\fR\s12 Copyright 2002-2005 by Alec Thomas
Note: See TracBrowser for help on using the browser.