Todd C. Miller [Thu, 7 Sep 2017 20:59:37 +0000 (14:59 -0600)]
More accurately describe the use_pty option now that its behavior
has changed with respect to interposition with a pipe.
Also describe some caveats with log_input.
Todd C. Miller [Thu, 7 Sep 2017 17:32:30 +0000 (11:32 -0600)]
If /dev/tty is not available and no I/O logging plugins are configured,
fall back on exec_nopty() even if the policy plugin requested a pty.
We never allocate a pty when sudo is not run from a terminal anyway.
Todd C. Miller [Wed, 6 Sep 2017 21:59:37 +0000 (15:59 -0600)]
Set SIGCHLD handler to SIG_DFL before forking the askpass command
and restore after. Otherwise, SIGCHLD will end up in the list of
pending signals and sudo_execute() will not execute the command.
Todd C. Miller [Wed, 6 Sep 2017 18:29:36 +0000 (12:29 -0600)]
The read and write sides of signal_pipe[] were swapped, resulting
in EBADF reading from and writing to the signal pipe on Linux and
probably others. On systems with bidirectional pipes this was not
an issue.
Todd C. Miller [Fri, 1 Sep 2017 17:36:15 +0000 (11:36 -0600)]
The fix for matching when no sudoRunAsUser is present in a sudoRole
was incomplete. If no -g option was specified on the command line
but sudoRunAsGroup is present in a sudoRole, we need to treat the
group match as failed instead of missing.
Todd C. Miller [Thu, 31 Aug 2017 17:29:19 +0000 (11:29 -0600)]
Go back to returning true from display_privs() on non-error. This
results in "sudo -U otheruser -l" exiting with a status of 0 even
when otheruser is not allowed to run commands. This is appropriate
since the "sudo -l" command was successful. This does not change
the exit value when otheruser runs "sudo -l" themselves, the exit
status will be 1 since that user is not allowed to run commands.
Requested by Radovan Sroka.
Todd C. Miller [Thu, 31 Aug 2017 17:05:48 +0000 (11:05 -0600)]
Fix the pass2 ldap query string when no search filter is defined.
Due to the addition of "(sudoUser=*)" to the query we always need
the AND operator, even if no search filter is present.
Todd C. Miller [Tue, 29 Aug 2017 14:58:14 +0000 (08:58 -0600)]
Don't forward SIGINFO to the child when it is send by the kernel
(not another user process). This is consistent with the handling
of other keyboard-generated signals such as SIGINT, SIGQUIT and
SIGTSTP. Bug #796
Todd C. Miller [Thu, 3 Aug 2017 13:32:24 +0000 (07:32 -0600)]
Allow the user to specify a list of environment variables to preserve.
This adds an option paramter to the --preserve-env option, a
comma-separated list of variable names.
Todd C. Miller [Tue, 1 Aug 2017 22:14:54 +0000 (16:14 -0600)]
Replace tty_tickets option with timestamp_type which can be
global, ppid or tty. Defaults to tty (no change in behavior).
Some users want the ppid behavior.
Todd C. Miller [Fri, 28 Jul 2017 19:52:55 +0000 (13:52 -0600)]
Add support for --enable-sasl and --disable-sasl to make it possible
to enable/disable support for LDAP with SASL authentication. Sudo
compiles in support for SASL authentiation by default if the
ldap_sasl_interactive_bind_s() function is detected.
Bug #788
Todd C. Miller [Thu, 27 Jul 2017 20:10:44 +0000 (14:10 -0600)]
Terminate the command if an I/O log function returns 0 or -1. This
was mistakenly removed by 25b7fd056614 in Sudo 1.8.18 with the
removal of the ignore_iolog_errors variable.
Todd C. Miller [Fri, 21 Jul 2017 15:07:00 +0000 (09:07 -0600)]
Don't set passprompt_override when SUDO_PROMPT is present.
This effectively reverts ed77d255f383.
We treat the SUDO_PROMPT environment variable similar to passprompt
in sudoers: it will only override a PAM prompt if the PAM prompt
is either "Password:" or "username's Password:".
Todd C. Miller [Thu, 20 Jul 2017 22:06:47 +0000 (16:06 -0600)]
When deciding which prompt to use (PAM's or sudo's) treat the PAM
prompt "username's Password:" as equivalent to "Password:".
Some PAM modules (on AIX at least) use this prompt.
Todd C. Miller [Mon, 17 Jul 2017 15:42:42 +0000 (09:42 -0600)]
Call install_sudoers() even when doedit is false. If a file in a
#includedir has a syntax error it will still have been edited and
we need to install the edited temp file.
Todd C. Miller [Wed, 12 Jul 2017 11:47:28 +0000 (05:47 -0600)]
Clear input, output, control and local flags before copying them
from the source terminal. Otherwise, flags that are disabled
in the source terminal may still be enabled in the destination.
Todd C. Miller [Wed, 12 Jul 2017 11:45:46 +0000 (05:45 -0600)]
Remove pointless subshells in targets that simply change the directory
and execute a command. The command is already run in a shell so
there is no need to execute a subshell in this case.
Todd C. Miller [Thu, 15 Jun 2017 18:59:46 +0000 (12:59 -0600)]
When copying terminal settings from one tty to another only copy a
subset of the flags. Sudo now copies the same set of flags that
OpenSSH uses, which should be safe.
Todd C. Miller [Thu, 15 Jun 2017 13:51:00 +0000 (07:51 -0600)]
Better handling of SIGCONT from in command in the monitor. It is
useful to know when the command continued but we don't want to
inform the parent or store the wait status in this case. Fixes a
hang after multiple suspends on Linux.
Todd C. Miller [Mon, 5 Jun 2017 13:11:09 +0000 (07:11 -0600)]
sudo_edit() must return a wait status but if there is an error, or
even if no changes were made to the file, it was returning 1 instead
which would be interpreted as the command having received SIGHUP.
Use the W_EXITCODE() to construct a proper wait status in the error
case too.
Todd C. Miller [Sat, 3 Jun 2017 14:45:29 +0000 (08:45 -0600)]
Avoid sign extension when assigning the value of tty_nr in
/proc/self/stat on Linux. It is an unsigned int value that
is printed as a signed int but dev_t is unsigned long long.
We need to cast to unsigned int before assigning to a dev_t.
Todd C. Miller [Sat, 3 Jun 2017 14:43:32 +0000 (08:43 -0600)]
Instead of hard-coding a check for bash functions in env_should_delete(),
use a "*=()* " pattern in initial_badenv_table[] to match them instead.
This allows the user to remove the check via env_delete.
Todd C. Miller [Wed, 31 May 2017 15:14:31 +0000 (09:14 -0600)]
A command name may also contain newline characters so read
/proc/self/stat until EOF. It is not legal for /proc/self/stat to
contain embedded NUL bytes so treat the file as corrupt if we see
any. With help from Qualys.
This is not exploitable due to the /dev traversal changes in sudo
1.8.20p1 (thanks Solar!).
Todd C. Miller [Tue, 30 May 2017 16:44:11 +0000 (10:44 -0600)]
Add a new "devsearch" Path setting to sudo.conf for configuring the
/dev paths to traverse instead of hard-coding a list in ttyname.c
The default value can be set at configure time.
Todd C. Miller [Mon, 29 May 2017 20:32:53 +0000 (14:32 -0600)]
Fix for CVE-2017-1000367, parsing of /proc/pid/stat on Linux when
the process name contains spaces. Since the user has control over
the command name this could be used by a user with sudo access to
overwrite an arbitrary file.
Thanks to Qualys for investigating and reporting this bug.
Also stop performing a breadth-first traversal of /dev when looking
for the device. Only the directories specified in search_devs[]
are checked.