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