root/op/1.30/op.1

Revision 231, 9.8 kB (checked in by athomas, 4 years ago)
  • Fixed use of DEFAULT section, closes #5. Quite a pain in the arse actually.
  • Environment variables can now be propagated into child environments even when "environment" is specified. This will override any existing variables.
  • Now using vsnprintf rather than snprintf. Correspondingly, changed preprocessor define which may mean build scripts need to be changed.
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.
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 xauth
187 Attempt to propagate the X authority entry for the current display to the new
188 users X authority file. The DISPLAY environment variable is also propagated to
189 the new environment. The destination user is determined by first using the user
190 specified after xauth=..., then the user specified by uid=... then finally the
191 root user is used.
192 .TP
193 .B $n
194 defines the \fIn\fRth variable argument specified in the command
195 .I arg
196 list.  The value for this type may be a comma-separated list of regular
197 expressions using \fIegrep\fR(1).  option defines the range of values
198 allowed for the variable arguments  A variable argument specified as a
199 command
200 .I arg
201 but not described in the
202 .I options
203 section may take on any value.  If an argument does not match any
204 of its permitted values, then a diagnostic is printed and the
205 command is not executed.  When using '(' syntax to pass values
206 to other options, only the next options can use values from
207 the previous search.
208 .TP
209 .B $*
210 is used in the
211 .I options
212 section to place restriction on the trailing arguments
213 specified as $* in the
214 .I args
215 section.  If any of these (possibly many) arguments do not match, then
216 a diagnostic is printed, and the command is not executed.
217 .PP
218 There can also be a special entry in the file beginning at the first
219 non-comment line
220 that can define default values to override the builtin defaults listed
221 here, yet still be overridden by any entry that wants to redefine any of
222 the keyword fields described above.  It should have the following format:
223 .RS
224 .DT
225 \fBDEFAULT\fR   \fIkeyword_option\fR
226 .RE
227 where \fIkeyword_option\fR is a \fIkeyword=value\fR string mentioned above
228 under \fIoptions\fR.
229 .PP
230 It should be noted that if any regular
231 .I mnemonic
232 entry defines its own
233 .I option,
234 the value given for that entry must explicitly include the item from the
235 DEFAULT line if the default values is to be included.  That is, the
236 .I options
237 definitions completely override any
238 defaults; they do not add to them  In this way, if a value specified on
239 the DEFAULT line for
240 .B users
241 or
242 .B groups
243 (for example) needs to be "erased" without redefining new values
244 (that is, we want no users or groups to be allowed to run the mnemonic),
245 then the default value must be overridden with nothing (as in
246 \fBusers=\fR).  For the
247 .B users
248 or
249 .B groups
250 fields, such a null setting has the effect of setting the list of
251 allowable users or groups to be empty.  For the other keywords (\fR
252 uid, gid, dir, chroot, \fRand\fB umask\fR), a null setting leaves that
253 attribute as it is upon invocation of the
254 .I op
255 program, overriding any defaults.
256 .PP
257 Another note is that if the
258 .I command
259 for a
260 .I mnemonic
261 is
262 .B MAGIC_SHELL
263 then a shell (using the users $SHELL environment variable) is created,
264 if there are arguments in addition to the
265 .I mnemonic
266 on the command line then the shell is invoked "-c args".
267 .SH EXAMPLES
268 .PP
269 Example /etc/op.conf:
270 .RS
271 .PP
272 # Define some users
273 .br
274 OPERATORS=(fred|barry)
275 .br
276 # Define hosts that Fred is restricted to
277 .br
278 FRED_HOSTS=(alpha|beta)
279 .br
280 # Define hosts that Barry is restricted to
281 .br
282 BARRY_HOSTS=(theta|gamma)
283 .br
284 # Define user/host access list
285 .br
286 ACCESS_LIST=fred@FRED_HOSTS|barry@BARRY_HOSTS
287 .PP
288 .br
289 # 'op shell' - gives user a root shell
290 .br
291 shell
292 .br
293     /bin/su -;
294 .br
295         users=ACCESS_LIST
296 .br
297         environment
298 .br
299         password
300 .br
301     help="Root shell"
302 .PP
303 .br
304 # 'op reboot' - reboot system
305 .br
306 reboot
307 .br
308     /sbin/reboot;
309 .br
310         users=ACCESS_LIST
311 .br
312         password
313 .br
314     help="Reboot system"
315 .PP
316 # 'op shutdown <time>' - shutdown at a
317 .br
318 # certain time. Restricts argument to
319 .br
320 # valid values only
321 .br
322 shutdown
323 .br
324     /sbin/shutdown -h $1;
325 .br
326     users=ACCESS_LIST
327 .br
328     $1=(now|[0-1]?[0-9]:[0-9][0-9]|2[0-3]:[0-5][0-9]|\+[0-9]+)
329 .br
330     help="Shutdown system"
331 .PP
332 # Switch inetd on and off, shows complex
333 .br
334 # shell example and 'string' arguments. $1
335 .br
336 # in this example is expanded by op
337 .br
338 inetd /bin/sh -c '
339 .br
340         case $1 in
341 .br
342             on) /usr/sbin/inetd -s ;;
343 .br
344             off) /usr/bin/pkill inetd ;;
345 .br
346         esac
347 .br
348     ';
349 .br
350     users=ACCESS_LIST
351 .br
352     $1=on|off
353 .PP
354
355 .SH FILES
356 .TP
357 .B /etc/op.conf
358 Access control description file.
359 .TP
360 .B /etc/op.d/*.conf
361 Access control description files.
362 .SH "SEE ALSO"
363 sudo(1), su(1), chroot(2), egrep(1)
364 .SH CREDIT
365 .B "Op: A flexible Tool for Restricted Superuser Access",
366 originally by
367 .I "Tom Christiansen"
368 , CONVEX Computer Corporation,
369 .B "Proceedings of the Large Installation Systems Administration III Workshop".
370 Further changes by
371 .I "Howard Owen"
372 , currently maintained by
373 .I "Alec Thomas".
374 .
375 .SH BUG REPORTS TO
376 alec@swapoff.org
377 .SH COPYRIGHTS
378 \fB\(co\fR\s12 Copyright 1991 by David Koblas
379 \fB\(co\fR\s12 Copyright 2002 by Alec Thomas
Note: See TracBrowser for help on using the browser.