]> git.armaanb.net Git - opendoas.git/blob - doas.conf.5
clarify some wording
[opendoas.git] / doas.conf.5
1 .\" $OpenBSD: doas.conf.5,v 1.13 2015/07/27 21:44:11 tedu Exp $
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.
16 .Dd $Mdocdate: July 27 2015 $
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
26 in the
27 .Nm
28 configuration file.
29 .Pp
30 The rules have the following format:
31 .Bd -ragged -offset indent
32 .Ic permit Ns | Ns Ic deny
33 .Op Ar options
34 .Ar identity
35 .Op Ic as Ar target
36 .Op Ic cmd Ar command Op Ic args ...
37 .Ed
38 .Pp
39 Rules consist of the following parts:
40 .Bl -tag -width 11n
41 .It Ic permit Ns | Ns Ic deny
42 The action to be taken if this rule matches.
43 .It Ar options
44 Options are:
45 .Bl -tag -width keepenv
46 .It Ic nopass
47 The user is not required to enter a password.
48 .It Ic keepenv
49 The user's environment is maintained.
50 The default is to reset the environment, except for the variables
51 .Ev DISPLAY ,
52 .Ev HOME ,
53 .Ev LOGNAME ,
54 .Ev MAIL ,
55 .Ev PATH ,
56 .Ev TERM ,
57 .Ev USER
58 and
59 .Ev USERNAME .
60 .It Ic keepenv { Oo Ar variable ... Oc Ic }
61 In addition to the variables mentioned above, keep the space-separated
62 specified variables.
63 .El
64 .It Ar identity
65 The username to match.
66 Groups may be specified by prepending a colon
67 .Pq Sq \&: .
68 Numeric IDs are also accepted.
69 .It Ic as Ar target
70 The target user the running user is allowed to run the command as.
71 The default is all users.
72 .It Ic cmd Ar command
73 The command the user is allowed or denied to run.
74 The default is all commands.
75 Be advised that it is best to specify absolute paths.
76 If a relative path is specified, only a restricted
77 .Ev PATH
78 will be searched.
79 .It Ic args ...
80 Arguments to command.
81 If specified, the command arguments provided by the user
82 need to match those specified.
83 The keyword
84 .Ic args
85 alone means that command must be run without any arguments.
86 .El
87 .Pp
88 The last matching rule determines the action taken.
89 If no rule matches, the action is denied.
90 .Pp
91 Comments can be put anywhere in the file using a hash mark
92 .Pq Sq # ,
93 and extend to the end of the current line.
94 .Pp
95 The following quoting rules apply:
96 .Bl -dash
97 .It
98 The text between a pair of double quotes
99 .Pq Sq \&"
100 is taken as is.
101 .It
102 The backslash character
103 .Pq Sq \e
104 escapes the next character, including new line characters, outside comments;
105 as a result, comments may not be extended over multiple lines.
106 .It
107 If quotes or backslashes are used in a word,
108 it isn't considered a keyword.
109 .El
110 .Sh EXAMPLES
111 The following example permits users in group wsrc to build ports,
112 wheel to execute commands as any user while keeping the environment
113 variables
114 .Ev ENV ,
115 .Ev PS1 ,
116 and
117 .Ev SSH_AUTH_SOCK ,
118 and additionally permits tedu to run procmap as root without a password.
119 .Bd -literal -offset indent
120 # Non-exhaustive list of variables needed to
121 # build release(8) and ports(7)
122 permit nopass keepenv { \e
123         FTPMODE PKG_CACHE PKG_PATH SM_PATH SSH_AUTH_SOCK \e
124         DESTDIR DISTDIR FETCH_CMD FLAVOR GROUP MAKE MAKECONF \e
125         MULTI_PACKAGES NOMAN OKAY_FILES OWNER PKG_DBDIR \e
126         PKG_DESTDIR PKG_TMPDIR PORTSDIR RELEASEDIR SHARED_ONLY \e
127         SUBPACKAGE WRKOBJDIR SUDO_PORT_V1 } :wsrc
128 permit nopass keepenv { ENV PS1 SSH_AUTH_SOCK } :wheel
129 permit nopass tedu as root cmd /usr/sbin/procmap
130 .Ed
131 .Sh SEE ALSO
132 .Xr doas 1
133 .Sh HISTORY
134 The
135 .Nm
136 configuration file first appeared in
137 .Ox 5.8 .
138 .Sh AUTHORS
139 .An Ted Unangst Aq Mt tedu@openbsd.org