]> git.armaanb.net Git - opendoas.git/blob - doas.conf.5
timestamp: error out if fstat and lstat st_ino and st_dev are not the same
[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 No ...
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 persist
49 After the user successfully authenticates, do not ask for a password
50 again for some time.
51 .It Ic keepenv
52 The user's environment is maintained.
53 The default is to reset the environment, except for the variables
54 .Ev DISPLAY ,
55 .Ev HOME ,
56 .Ev LOGNAME ,
57 .Ev MAIL ,
58 .Ev PATH ,
59 .Ev TERM ,
60 .Ev USER
61 and
62 .Ev USERNAME .
63 .It Ic setenv { Oo Ar variable ... Oc Oo Ar variable=value ... Oc Ic }
64 In addition to the variables mentioned above, keep the space-separated
65 specified variables.
66 Variables may also be removed with a leading
67 .Sq -
68 or set using the latter syntax.
69 If the first character of
70 .Ar value
71 is a
72 .Ql $
73 then the value to be set is taken from the existing environment
74 variable of the indicated name.
75 .El
76 .It Ar identity
77 The username to match.
78 Groups may be specified by prepending a colon
79 .Pq Sq \&: .
80 Numeric IDs are also accepted.
81 .It Ic as Ar target
82 The target user the running user is allowed to run the command as.
83 The default is all users.
84 .It Ic cmd Ar command
85 The command the user is allowed or denied to run.
86 The default is all commands.
87 Be advised that it is best to specify absolute paths.
88 If a relative path is specified, only a restricted
89 .Ev PATH
90 will be searched.
91 .It Ic args Op Ar argument ...
92 Arguments to command.
93 The command arguments provided by the user need to match those specified.
94 The keyword
95 .Ic args
96 alone means that command must be run without any arguments.
97 .El
98 .Pp
99 The last matching rule determines the action taken.
100 If no rule matches, the action is denied.
101 .Pp
102 Comments can be put anywhere in the file using a hash mark
103 .Pq Sq # ,
104 and extend to the end of the current line.
105 .Pp
106 The following quoting rules apply:
107 .Bl -dash
108 .It
109 The text between a pair of double quotes
110 .Pq Sq \&"
111 is taken as is.
112 .It
113 The backslash character
114 .Pq Sq \e
115 escapes the next character, including new line characters, outside comments;
116 as a result, comments may not be extended over multiple lines.
117 .It
118 If quotes or backslashes are used in a word,
119 it isn't considered a keyword.
120 .El
121 .Sh FILES
122 .Bl -tag -width "/etc/doas.conf"
123 .It Pa /etc/doas.conf
124 doas configuration file.
125 .El
126 .Sh EXAMPLES
127 The following example permits user aja to install packages
128 from a preferred mirror;
129 group wheel to execute commands as any user while keeping the environment
130 variables
131 .Ev PS1
132 and
133 .Ev SSH_AUTH_SOCK
134 and
135 unsetting
136 .Ev ENV ;
137 permits tedu to run procmap as root without a password;
138 and additionally permits root to run unrestricted commands as itself.
139 .Bd -literal -offset indent
140 permit persist setenv { PKG_CACHE PKG_PATH } aja cmd pkg_add
141 permit setenv { -ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel
142 permit nopass tedu as root cmd /usr/sbin/procmap
143 .Ed
144 .Sh SEE ALSO
145 .Xr doas 1
146 .Sh HISTORY
147 The
148 .Nm
149 configuration file first appeared in
150 .Ox 5.8 .
151 .Sh AUTHORS
152 .An Ted Unangst Aq Mt tedu@openbsd.org