[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.32

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