Bump plugin minor version and document new intercept-related settings.

There should have been a minor version bump for sudo 1.9.8 when
intercept was originally implemented.
This commit is contained in:
Todd C. Miller
2022-05-26 09:19:08 -06:00
parent 6ced49a34d
commit 9ac42292d1
5 changed files with 191 additions and 9 deletions

View File

@@ -16,7 +16,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.TH "SUDO_PLUGIN" "5" "February 16, 2022" "Sudo @PACKAGE_VERSION@" "File Formats Manual" .TH "SUDO_PLUGIN" "5" "May 26, 2022" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
.nh .nh
.if n .ad l .if n .ad l
.SH "NAME" .SH "NAME"
@@ -291,6 +291,36 @@ implied_shell=bool
If the user does not specify a program on the command line, If the user does not specify a program on the command line,
\fBsudo\fR \fBsudo\fR
will pass the plugin the path to the user's shell and set will pass the plugin the path to the user's shell and set
\fIimplied_shell\fR.
.TP 6n
intercept_ptrace=bool
Indicates whether or not the system supports intercept
mode using
ptrace(2).
This is currently only true for Linux systems that support
seccomp(2)
filtering and the
\(lqtrap\(rq
action.
Other systems will use a dynamic shared object to implement
intercept.
.TP 6n
intercept_setid=bool
Indicates whether or not the system supports running set-user-ID
and set-group-ID binaries in intercept mode.
This is currently only true for Linux systems that support
seccomp(2)
filtering and the
\(lqtrap\(rq
action.
On systems that use a dynamic shared object to implement
intercept, the dynamic linker (ld.so or the equivalent)
will disable preloading of shared objects when executing a
set-user-ID or set-group-ID binary.
This will disable intercept mode for that program and any other
programs that it executes.
The policy plugin may refuse to execute a set-user-ID or set-group-ID
binary in intercept mode to avoid this.
.TP 6n .TP 6n
login_class=string login_class=string
BSD BSD
@@ -1078,6 +1108,21 @@ The specified
\fInumber\fR \fInumber\fR
must refer to an open file descriptor. must refer to an open file descriptor.
.TP 6n .TP 6n
intercept=bool
If specified,
\fBsudo\fR
will intercept attempts to execute a subsequent command and perform
a policy check via the policy plugin's
\fBcheck_policy\fR()
function to determine whether or not the command is permitted.
This can be used to prevent shell escapes on supported platforms
but it has a number of limitations.
See
\fBPreventing shell escapes\fR
in
sudoers(@mansectform@)
for details.
.TP 6n
iolog_compress=bool iolog_compress=bool
Set to true if the I/O logging plugins, if any, should compress the Set to true if the I/O logging plugins, if any, should compress the
log data. log data.
@@ -1142,6 +1187,24 @@ on
BSD BSD
systems. systems.
.TP 6n .TP 6n
log_subcmds=bool
If specified,
\fBsudo\fR
will call the audit plugin's
\fBaccept\fR()
function to log when the command runs a subsequent command, if supported
by the system.
If
\fIintercept\fR
is also specified,
\fIlog_subcmds\fR
will be ignored.
See
\fBPreventing shell escapes\fR
in
sudoers(@mansectform@)
for more information.
.TP 6n
noexec=bool noexec=bool
If set, prevent the command from executing other programs. If set, prevent the command from executing other programs.
.TP 6n .TP 6n
@@ -1466,6 +1529,16 @@ Force the value specified by the
\fIumask\fR \fIumask\fR
option to override any umask set by PAM or login.conf. option to override any umask set by PAM or login.conf.
.TP 6n .TP 6n
use_ptrace=bool
If specified,
\fBsudo\fR
will use
ptrace(2)
to implement intercept mode if supported by the system.
This setting has no effect unless
\fIintercept\fR
is also set.
.TP 6n
use_pty=bool use_pty=bool
Allocate a pseudo-terminal to run the command in, regardless of whether Allocate a pseudo-terminal to run the command in, regardless of whether
or not I/O logging is in use. or not I/O logging is in use.
@@ -5280,7 +5353,7 @@ The
\fIcmnd_chroot\fR \fIcmnd_chroot\fR
and and
\fIcmnd_cwd\fR \fIcmnd_cwd\fR
enties were added to the entries were added to the
\fRsettings\fR \fRsettings\fR
list. list.
.TP 6n .TP 6n
@@ -5293,6 +5366,27 @@ Version 1.18 (sudo 1.9.9)
The policy may now set resource limit values in the The policy may now set resource limit values in the
\fRcommand_info\fR \fRcommand_info\fR
list. list.
The
\fIintercept\fR
and
\fIlog_subcmds\fR
entries were added to the
\fRcommand_info\fR
list.
.TP 6n
Version 1.19 (sudo 1.9.11)
The
\fIintercept_ptrace\fR
and
\fIintercept_setid\fR
entries were added to the
\fRsettings\fR
list.
The
\fIuser_ptrace\fR
entry was added to the
\fRcommand_info\fR
list.
.SH "SEE ALSO" .SH "SEE ALSO"
sudo.conf(@mansectform@), sudo.conf(@mansectform@),
sudoers(@mansectform@), sudoers(@mansectform@),

View File

@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd February 16, 2022 .Dd May 26, 2022
.Dt SUDO_PLUGIN @mansectform@ .Dt SUDO_PLUGIN @mansectform@
.Os Sudo @PACKAGE_VERSION@ .Os Sudo @PACKAGE_VERSION@
.Sh NAME .Sh NAME
@@ -269,6 +269,34 @@ to print a usage message and exit.
If the user does not specify a program on the command line, If the user does not specify a program on the command line,
.Nm sudo .Nm sudo
will pass the plugin the path to the user's shell and set will pass the plugin the path to the user's shell and set
.Em implied_shell .
.It intercept_ptrace=bool
Indicates whether or not the system supports intercept
mode using
.Xr ptrace 2 .
This is currently only true for Linux systems that support
.Xr seccomp 2
filtering and the
.Dq trap
action.
Other systems will use a dynamic shared object to implement
intercept.
.It intercept_setid=bool
Indicates whether or not the system supports running set-user-ID
and set-group-ID binaries in intercept mode.
This is currently only true for Linux systems that support
.Xr seccomp 2
filtering and the
.Dq trap
action.
On systems that use a dynamic shared object to implement
intercept, the dynamic linker (ld.so or the equivalent)
will disable preloading of shared objects when executing a
set-user-ID or set-group-ID binary.
This will disable intercept mode for that program and any other
programs that it executes.
The policy plugin may refuse to execute a set-user-ID or set-group-ID
binary in intercept mode to avoid this.
.It login_class=string .It login_class=string
.Bx .Bx
login class to use when setting resource limits and nice value, login class to use when setting resource limits and nice value,
@@ -965,6 +993,20 @@ system call to execute the command instead of
The specified The specified
.Em number .Em number
must refer to an open file descriptor. must refer to an open file descriptor.
.It intercept=bool
If specified,
.Nm sudo
will intercept attempts to execute a subsequent command and perform
a policy check via the policy plugin's
.Fn check_policy
function to determine whether or not the command is permitted.
This can be used to prevent shell escapes on supported platforms
but it has a number of limitations.
See
.Sy Preventing shell escapes
in
.Xr sudoers @mansectform@
for details.
.It iolog_compress=bool .It iolog_compress=bool
Set to true if the I/O logging plugins, if any, should compress the Set to true if the I/O logging plugins, if any, should compress the
log data. log data.
@@ -1017,6 +1059,23 @@ The nice value, if specified, overrides the priority associated with the
on on
.Bx .Bx
systems. systems.
.It log_subcmds=bool
If specified,
.Nm sudo
will call the audit plugin's
.Fn accept
function to log when the command runs a subsequent command, if supported
by the system.
If
.Em intercept
is also specified,
.Em log_subcmds
will be ignored.
See
.Sy Preventing shell escapes
in
.Xr sudoers @mansectform@
for more information.
.It noexec=bool .It noexec=bool
If set, prevent the command from executing other programs. If set, prevent the command from executing other programs.
.It preserve_fds=list .It preserve_fds=list
@@ -1311,6 +1370,15 @@ option is also set.
Force the value specified by the Force the value specified by the
.Em umask .Em umask
option to override any umask set by PAM or login.conf. option to override any umask set by PAM or login.conf.
.It use_ptrace=bool
If specified,
.Nm sudo
will use
.Xr ptrace 2
to implement intercept mode if supported by the system.
This setting has no effect unless
.Em intercept
is also set.
.It use_pty=bool .It use_pty=bool
Allocate a pseudo-terminal to run the command in, regardless of whether Allocate a pseudo-terminal to run the command in, regardless of whether
or not I/O logging is in use. or not I/O logging is in use.
@@ -4676,7 +4744,7 @@ The
.Em cmnd_chroot .Em cmnd_chroot
and and
.Em cmnd_cwd .Em cmnd_cwd
enties were added to the entries were added to the
.Li settings .Li settings
list. list.
.It Version 1.17 (sudo 1.9.4) .It Version 1.17 (sudo 1.9.4)
@@ -4687,6 +4755,26 @@ field was added to the audit_plugin and approval_plugin structs.
The policy may now set resource limit values in the The policy may now set resource limit values in the
.Li command_info .Li command_info
list. list.
The
.Em intercept
and
.Em log_subcmds
entries were added to the
.Li command_info
list.
.It Version 1.19 (sudo 1.9.11)
The
.Em intercept_ptrace
and
.Em intercept_setid
entries were added to the
.Li settings
list.
The
.Em user_ptrace
entry was added to the
.Li command_info
list.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr sudo.conf @mansectform@ , .Xr sudo.conf @mansectform@ ,

View File

@@ -1,7 +1,7 @@
/* /*
* SPDX-License-Identifier: ISC * SPDX-License-Identifier: ISC
* *
* Copyright (c) 2009-2020 Todd C. Miller <Todd.Miller@sudo.ws> * Copyright (c) 2009-2022 Todd C. Miller <Todd.Miller@sudo.ws>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@@ -21,7 +21,7 @@
/* API version major/minor */ /* API version major/minor */
#define SUDO_API_VERSION_MAJOR 1 #define SUDO_API_VERSION_MAJOR 1
#define SUDO_API_VERSION_MINOR 18 #define SUDO_API_VERSION_MINOR 19
#define SUDO_API_MKVERSION(x, y) (((x) << 16) | (y)) #define SUDO_API_MKVERSION(x, y) (((x) << 16) | (y))
#define SUDO_API_VERSION SUDO_API_MKVERSION(SUDO_API_VERSION_MAJOR, SUDO_API_VERSION_MINOR) #define SUDO_API_VERSION SUDO_API_MKVERSION(SUDO_API_VERSION_MAJOR, SUDO_API_VERSION_MINOR)

View File

@@ -26,7 +26,7 @@
"INFO1=VALUE1", "INFO1=VALUE1",
"info2=value2" "info2=value2"
], ],
"version": "1.18" "version": "1.19"
} }
(APPROVAL 2) Constructed: (APPROVAL 2) Constructed:
{ {
@@ -56,7 +56,7 @@
"INFO1=VALUE1", "INFO1=VALUE1",
"info2=value2" "info2=value2"
], ],
"version": "1.18" "version": "1.19"
} }
(APPROVAL 1) Show version was called with arguments: (0,) (APPROVAL 1) Show version was called with arguments: (0,)
Python approval plugin (API 1.0): ApprovalTestPlugin (loaded from 'SRC_DIR/regress/plugin_approval_test.py') Python approval plugin (API 1.0): ApprovalTestPlugin (loaded from 'SRC_DIR/regress/plugin_approval_test.py')

View File

@@ -321,7 +321,7 @@ sudo_terminated(struct command_status *cstat)
debug_return_bool(false); debug_return_bool(false);
} }
#if SUDO_API_VERSION != SUDO_API_MKVERSION(1, 18) #if SUDO_API_VERSION != SUDO_API_MKVERSION(1, 19)
# error "Update sudo_needs_pty() after changing the plugin API" # error "Update sudo_needs_pty() after changing the plugin API"
#endif #endif
static bool static bool