[BACK]Return to doas.conf.5 CVS log [TXT][DIR] Up to [local] / src / usr.bin / doas

Annotation of src/usr.bin/doas/doas.conf.5, Revision 1.36

1.36    ! tedu        1: .\" $OpenBSD: doas.conf.5,v 1.35 2018/02/07 05:13:57 tedu Exp $
1.1       tedu        2: .\"
                      3: .\"Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
                      4: .\"
                      5: .\"Permission to use, copy, modify, and distribute this software for any
                      6: .\"purpose with or without fee is hereby granted, provided that the above
                      7: .\"copyright notice and this permission notice appear in all copies.
                      8: .\"
                      9: .\"THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10: .\"WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11: .\"MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12: .\"ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13: .\"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14: .\"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15: .\"OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.35      tedu       16: .Dd $Mdocdate: February 7 2018 $
1.1       tedu       17: .Dt DOAS.CONF 5
                     18: .Os
                     19: .Sh NAME
                     20: .Nm doas.conf
                     21: .Nd doas configuration file
                     22: .Sh DESCRIPTION
                     23: The
                     24: .Xr doas 1
                     25: utility executes commands as other users according to the rules
1.18      jmc        26: in the
                     27: .Nm
1.1       tedu       28: configuration file.
                     29: .Pp
                     30: The rules have the following format:
1.3       schwarze   31: .Bd -ragged -offset indent
                     32: .Ic permit Ns | Ns Ic deny
                     33: .Op Ar options
1.4       bentley    34: .Ar identity
1.3       schwarze   35: .Op Ic as Ar target
1.31      schwarze   36: .Op Ic cmd Ar command Op Ic args No ...
1.1       tedu       37: .Ed
                     38: .Pp
                     39: Rules consist of the following parts:
1.3       schwarze   40: .Bl -tag -width 11n
                     41: .It Ic permit Ns | Ns Ic deny
1.1       tedu       42: The action to be taken if this rule matches.
1.3       schwarze   43: .It Ar options
1.1       tedu       44: Options are:
1.3       schwarze   45: .Bl -tag -width keepenv
                     46: .It Ic nopass
1.1       tedu       47: The user is not required to enter a password.
1.30      tedu       48: .It Ic persist
                     49: After the user successfully authenticates, do not ask for a password
                     50: again for some time.
1.3       schwarze   51: .It Ic keepenv
1.1       tedu       52: The user's environment is maintained.
1.5       benno      53: The default is to reset the environment, except for the variables
1.36    ! tedu       54: .Ev DISPLAY
1.5       benno      55: and
1.36    ! tedu       56: .Ev TERM .
1.29      jmc        57: .It Ic setenv { Oo Ar variable ... Oc Oo Ar variable=value ... Oc Ic }
1.12      jmc        58: In addition to the variables mentioned above, keep the space-separated
                     59: specified variables.
1.29      jmc        60: Variables may also be removed with a leading
                     61: .Sq -
                     62: or set using the latter syntax.
1.27      tedu       63: If the first character of
                     64: .Ar value
                     65: is a
                     66: .Ql $
                     67: then the value to be set is taken from the existing environment
1.34      tedu       68: variable of the indicated name.
1.1       tedu       69: .El
1.3       schwarze   70: .It Ar identity
1.1       tedu       71: The username to match.
1.12      jmc        72: Groups may be specified by prepending a colon
                     73: .Pq Sq \&: .
1.1       tedu       74: Numeric IDs are also accepted.
1.3       schwarze   75: .It Ic as Ar target
1.1       tedu       76: The target user the running user is allowed to run the command as.
1.13      tedu       77: The default is all users.
1.3       schwarze   78: .It Ic cmd Ar command
1.1       tedu       79: The command the user is allowed or denied to run.
                     80: The default is all commands.
1.23      tedu       81: Be advised that it is best to specify absolute paths.
1.25      tedu       82: If a relative path is specified, only a restricted
1.16      tedu       83: .Ev PATH
                     84: will be searched.
1.31      schwarze   85: .It Ic args Op Ar argument ...
1.8       zhuk       86: Arguments to command.
1.26      tedu       87: The command arguments provided by the user need to match those specified.
1.25      tedu       88: The keyword
1.8       zhuk       89: .Ic args
1.25      tedu       90: alone means that command must be run without any arguments.
1.1       tedu       91: .El
                     92: .Pp
                     93: The last matching rule determines the action taken.
1.24      tedu       94: If no rule matches, the action is denied.
1.5       benno      95: .Pp
                     96: Comments can be put anywhere in the file using a hash mark
                     97: .Pq Sq # ,
                     98: and extend to the end of the current line.
1.10      zhuk       99: .Pp
                    100: The following quoting rules apply:
                    101: .Bl -dash
                    102: .It
                    103: The text between a pair of double quotes
                    104: .Pq Sq \&"
                    105: is taken as is.
                    106: .It
1.11      jmc       107: The backslash character
1.10      zhuk      108: .Pq Sq \e
1.11      jmc       109: escapes the next character, including new line characters, outside comments;
1.10      zhuk      110: as a result, comments may not be extended over multiple lines.
                    111: .It
1.11      jmc       112: If quotes or backslashes are used in a word,
1.23      tedu      113: it is not considered a keyword.
1.33      jmc       114: .El
                    115: .Sh FILES
                    116: .Bl -tag -width "/etc/doas.conf"
                    117: .It Pa /etc/doas.conf
1.35      tedu      118: doas configuration file.
1.10      zhuk      119: .El
1.1       tedu      120: .Sh EXAMPLES
1.32      tedu      121: The following example permits user aja to install packages
                    122: from a preferred mirror;
                    123: group wheel to execute commands as any user while keeping the environment
1.5       benno     124: variables
1.27      tedu      125: .Ev PS1
                    126: and
                    127: .Ev SSH_AUTH_SOCK
                    128: and
                    129: unsetting
1.29      jmc       130: .Ev ENV ;
                    131: permits tedu to run procmap as root without a password;
1.15      reyk      132: and additionally permits root to run unrestricted commands as itself.
1.1       tedu      133: .Bd -literal -offset indent
1.32      tedu      134: permit persist setenv { PKG_CACHE PKG_PATH } aja cmd pkg_add
1.28      tedu      135: permit setenv { -ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel
1.14      zhuk      136: permit nopass tedu as root cmd /usr/sbin/procmap
1.15      reyk      137: permit nopass keepenv root as root
1.1       tedu      138: .Ed
1.3       schwarze  139: .Sh SEE ALSO
                    140: .Xr doas 1
                    141: .Sh HISTORY
                    142: The
                    143: .Nm
                    144: configuration file first appeared in
                    145: .Ox 5.8 .
                    146: .Sh AUTHORS
                    147: .An Ted Unangst Aq Mt tedu@openbsd.org