1 .\" $OpenBSD: doas.conf.5,v 1.9 2015/07/22 06:30:12 jmc Exp $
3 .\"Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
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.
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 22 2015 $
21 .Nd doas configuration file
25 utility executes commands as other users according to the rules
30 The rules have the following format:
31 .Bd -ragged -offset indent
32 .Ic permit Ns | Ns Ic deny
36 .Op Ic cmd Ar command Op Ic args ...
39 Rules consist of the following parts:
41 .It Ic permit Ns | Ns Ic deny
42 The action to be taken if this rule matches.
45 .Bl -tag -width keepenv
47 The user is not required to enter a password.
49 The user's environment is maintained.
50 The default is to reset the environment, except for the variables
60 .It Ic keepenv { Oo variable names Oc Ic }
61 Reset the environment, but keep the space-separated specified variables.
64 The username to match.
65 Groups may be specified by prepending a colon (:).
66 Numeric IDs are also accepted.
68 The target user the running user is allowed to run the command as.
71 The command the user is allowed or denied to run.
72 The default is all commands.
73 Be advised that it's best to specify absolute paths.
76 If specified, the command arguments provided by the user
77 need to match for the command to be successful.
80 alone means that command should be run without any arguments.
83 The last matching rule determines the action taken.
85 Comments can be put anywhere in the file using a hash mark
87 and extend to the end of the current line.
89 The following quoting rules apply:
92 The text between a pair of double quotes
98 escapes next character, including new line character, outside comment;
99 as a result, comments may not be extended over multiple lines.
101 If quotes or backslash are used in the word, this word won't be
102 considered a keyword.
105 The following example permits users in group wsrc to build ports,
106 wheel to execute commands as root while keeping the environment
112 and additionally permits tedu to run procmap as root without a password.
113 .Bd -literal -offset indent
114 # Non-exhaustive list of variables needed to
115 # build release(8) and ports(7)
116 permit nopass keepenv { \e
117 FTPMODE PKG_CACHE PKG_PATH SM_PATH SSH_AUTH_SOCK \e
118 DESTDIR DISTDIR FETCH_CMD FLAVOR GROUP MAKE MAKECONF \e
119 MULTI_PACKAGES NOMAN OKAY_FILES OWNER PKG_DBDIR \e
120 PKG_DESTDIR PKG_TMPDIR PORTSDIR RELEASEDIR SHARED_ONLY \e
121 SUBPACKAGE WRKOBJDIR SUDO_PORT_V1 } :wsrc
122 permit nopass keepenv { ENV PS1 SSH_AUTH_SOCK } :wheel
123 permit nopass tedu cmd /usr/sbin/procmap
130 configuration file first appeared in
133 .An Ted Unangst Aq Mt tedu@openbsd.org