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

1.21    ! tedu        1: .\" $OpenBSD: doas.conf.5,v 1.20 2016/06/05 07:22:25 jmc 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.20      jmc        16: .Dd $Mdocdate: June 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.9       jmc        38: .Op Ic cmd Ar command Op Ic args ...
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.3       schwarze   50: .It Ic keepenv
1.1       tedu       51: The user's environment is maintained.
1.5       benno      52: The default is to reset the environment, except for the variables
                     53: .Ev DISPLAY ,
                     54: .Ev HOME ,
                     55: .Ev LOGNAME ,
                     56: .Ev MAIL ,
                     57: .Ev PATH ,
                     58: .Ev TERM ,
                     59: .Ev USER
                     60: and
                     61: .Ev USERNAME .
1.21    ! tedu       62: .It Ic keepenv { Oo Ar variable ... Oc Ic Oo Ar variable=value ... Oc Ic }
1.12      jmc        63: In addition to the variables mentioned above, keep the space-separated
                     64: specified variables.
1.21    ! tedu       65: Variables may also be set using the latter syntax.
1.19      djm        66: If the first character of
                     67: .Ar value
                     68: is a
                     69: .Ql $
1.20      jmc        70: then the value to be set is taken from the existing environment
1.19      djm        71: variable of the same name.
1.1       tedu       72: .El
1.3       schwarze   73: .It Ar identity
1.1       tedu       74: The username to match.
1.12      jmc        75: Groups may be specified by prepending a colon
                     76: .Pq Sq \&: .
1.1       tedu       77: Numeric IDs are also accepted.
1.3       schwarze   78: .It Ic as Ar target
1.1       tedu       79: The target user the running user is allowed to run the command as.
1.13      tedu       80: The default is all users.
1.3       schwarze   81: .It Ic cmd Ar command
1.1       tedu       82: The command the user is allowed or denied to run.
                     83: The default is all commands.
                     84: Be advised that it's best to specify absolute paths.
1.16      tedu       85: If a cmd is specified, only a restricted
                     86: .Ev PATH
                     87: will be searched.
1.9       jmc        88: .It Ic args ...
1.8       zhuk       89: Arguments to command.
1.9       jmc        90: If specified, the command arguments provided by the user
                     91: need to match for the command to be successful.
1.8       zhuk       92: Specifying
                     93: .Ic args
                     94: alone means that command should be run without any arguments.
1.1       tedu       95: .El
                     96: .Pp
                     97: The last matching rule determines the action taken.
1.5       benno      98: .Pp
                     99: Comments can be put anywhere in the file using a hash mark
                    100: .Pq Sq # ,
                    101: and extend to the end of the current line.
1.10      zhuk      102: .Pp
                    103: The following quoting rules apply:
                    104: .Bl -dash
                    105: .It
                    106: The text between a pair of double quotes
                    107: .Pq Sq \&"
                    108: is taken as is.
                    109: .It
1.11      jmc       110: The backslash character
1.10      zhuk      111: .Pq Sq \e
1.11      jmc       112: escapes the next character, including new line characters, outside comments;
1.10      zhuk      113: as a result, comments may not be extended over multiple lines.
                    114: .It
1.11      jmc       115: If quotes or backslashes are used in a word,
                    116: it isn't considered a keyword.
1.10      zhuk      117: .El
1.1       tedu      118: .Sh EXAMPLES
1.5       benno     119: The following example permits users in group wsrc to build ports,
1.14      zhuk      120: wheel to execute commands as any user while keeping the environment
1.5       benno     121: variables
                    122: .Ev ENV ,
                    123: .Ev PS1 ,
                    124: and
                    125: .Ev SSH_AUTH_SOCK ,
1.15      reyk      126: permits tedu to run procmap as root without a password,
                    127: and additionally permits root to run unrestricted commands as itself.
1.1       tedu      128: .Bd -literal -offset indent
1.6       jmc       129: # Non-exhaustive list of variables needed to
1.5       benno     130: # build release(8) and ports(7)
                    131: permit nopass keepenv { \e
                    132:         FTPMODE PKG_CACHE PKG_PATH SM_PATH SSH_AUTH_SOCK \e
                    133:         DESTDIR DISTDIR FETCH_CMD FLAVOR GROUP MAKE MAKECONF \e
                    134:         MULTI_PACKAGES NOMAN OKAY_FILES OWNER PKG_DBDIR \e
                    135:         PKG_DESTDIR PKG_TMPDIR PORTSDIR RELEASEDIR SHARED_ONLY \e
                    136:         SUBPACKAGE WRKOBJDIR SUDO_PORT_V1 } :wsrc
1.21    ! tedu      137: permit nopass keepenv { ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel
1.14      zhuk      138: permit nopass tedu as root cmd /usr/sbin/procmap
1.15      reyk      139: permit nopass keepenv root as root
1.1       tedu      140: .Ed
1.3       schwarze  141: .Sh SEE ALSO
                    142: .Xr doas 1
                    143: .Sh HISTORY
                    144: The
                    145: .Nm
                    146: configuration file first appeared in
                    147: .Ox 5.8 .
                    148: .Sh AUTHORS
                    149: .An Ted Unangst Aq Mt tedu@openbsd.org