]> git.armaanb.net Git - opendoas.git/blobdiff - doas.conf.5
tweak previous;
[opendoas.git] / doas.conf.5
index a72f0847e66b64d7cc14ee2a9100a5add895d562..6cc58a47159b28a041cfb8b1ba2ab2d581364157 100644 (file)
@@ -1,4 +1,4 @@
-.\" $OpenBSD: doas.conf.5,v 1.2 2015/07/16 21:24:07 nicm Exp $
+.\" $OpenBSD: doas.conf.5,v 1.10 2015/07/22 20:15:24 zhuk Exp $
 .\"
 .\"Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
 .\"
@@ -13,7 +13,7 @@
 .\"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 .\"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\"OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.Dd $Mdocdate: July 16 2015 $
+.Dd $Mdocdate: July 22 2015 $
 .Dt DOAS.CONF 5
 .Os
 .Sh NAME
@@ -31,9 +31,9 @@ The rules have the following format:
 .Bd -ragged -offset indent
 .Ic permit Ns | Ns Ic deny
 .Op Ar options
-.Op Ar identity
+.Ar identity
 .Op Ic as Ar target
-.Op Ic cmd Ar command
+.Op Ic cmd Ar command Op Ic args ...
 .Ed
 .Pp
 Rules consist of the following parts:
@@ -47,9 +47,18 @@ Options are:
 The user is not required to enter a password.
 .It Ic keepenv
 The user's environment is maintained.
-The default is to reset the environment.
+The default is to reset the environment, except for the variables
+.Ev DISPLAY ,
+.Ev HOME ,
+.Ev LOGNAME ,
+.Ev MAIL ,
+.Ev PATH ,
+.Ev TERM ,
+.Ev USER
+and
+.Ev USERNAME .
 .It Ic keepenv { Oo variable names Oc Ic }
-Reset the environment, but keep the specified variables.
+Reset the environment, but keep the space-separated specified variables.
 .El
 .It Ar identity
 The username to match.
@@ -62,14 +71,55 @@ The default is root.
 The command the user is allowed or denied to run.
 The default is all commands.
 Be advised that it's best to specify absolute paths.
+.It Ic args ...
+Arguments to command.
+If specified, the command arguments provided by the user
+need to match for the command to be successful.
+Specifying
+.Ic args
+alone means that command should be run without any arguments.
 .El
 .Pp
 The last matching rule determines the action taken.
+.Pp
+Comments can be put anywhere in the file using a hash mark
+.Pq Sq # ,
+and extend to the end of the current line.
+.Pp
+The following quoting rules apply:
+.Bl -dash
+.It
+The text between a pair of double quotes
+.Pq Sq \&"
+is taken as is.
+.It
+The backslash character
+.Pq Sq \e
+escapes the next character, including new line characters, outside comments;
+as a result, comments may not be extended over multiple lines.
+.It
+If quotes or backslashes are used in a word,
+it isn't considered a keyword.
+.El
 .Sh EXAMPLES
-The following example permits users in group wheel to execute commands as root,
+The following example permits users in group wsrc to build ports,
+wheel to execute commands as root while keeping the environment
+variables
+.Ev ENV ,
+.Ev PS1 ,
+and
+.Ev SSH_AUTH_SOCK ,
 and additionally permits tedu to run procmap as root without a password.
 .Bd -literal -offset indent
-permit :wheel
+# Non-exhaustive list of variables needed to
+# build release(8) and ports(7)
+permit nopass keepenv { \e
+        FTPMODE PKG_CACHE PKG_PATH SM_PATH SSH_AUTH_SOCK \e
+        DESTDIR DISTDIR FETCH_CMD FLAVOR GROUP MAKE MAKECONF \e
+        MULTI_PACKAGES NOMAN OKAY_FILES OWNER PKG_DBDIR \e
+        PKG_DESTDIR PKG_TMPDIR PORTSDIR RELEASEDIR SHARED_ONLY \e
+        SUBPACKAGE WRKOBJDIR SUDO_PORT_V1 } :wsrc
+permit nopass keepenv { ENV PS1 SSH_AUTH_SOCK } :wheel
 permit nopass tedu cmd /usr/sbin/procmap
 .Ed
 .Sh SEE ALSO