Commit Graph

11659 Commits

Author SHA1 Message Date
Todd C. Miller
06bf1be67c Updated translations from translationproject.org 2022-06-02 14:10:15 -06:00
Todd C. Miller
66909a4831 Mention sudo_logsrvd.conf "log_server" parsing fix. 2022-06-02 14:09:46 -06:00
Todd C. Miller
2d6b9d22e1 For logsrvd_conf_test include both tls and non-tls configs. 2022-06-02 11:38:43 -06:00
Todd C. Miller
d7b2ff3214 Add a simple regression test for logsrvd.conf parser.
Unlike the parser fuzzer, this includes sample certs and keys.
This test would have detected the BIO_new_file() bug in set_dhparams().
2022-06-02 11:13:18 -06:00
Todd C. Miller
0ca222aa88 Fix inverted logic when setting server_log.
A value that starts with a '/' should be treated as a path.
2022-06-02 10:59:30 -06:00
Todd C. Miller
bec9603f3a Use abs_top_builddir instead of pwd/$(top_builddir). 2022-06-02 10:23:04 -06:00
Todd C. Miller
51b64780c0 Plug a memory leak. 2022-06-01 15:24:28 -06:00
Todd C. Miller
89b80ea690 Fix bug in last commit, need to reinitialize role to NULL. 2022-06-01 14:49:31 -06:00
Todd C. Miller
eb0135a93a Simplify the check for when we can reuse the previous user and host specs.
This makes the code easier to read and quiets a cppcheck false positive.
2022-06-01 14:30:47 -06:00
Todd C. Miller
77a47affb4 Install the plugin man pages in section 5 (or 4 for System V).
The manual had the correct section in the text but was installed
in the wrong directory.
2022-06-01 10:02:34 -06:00
Todd C. Miller
3074f64bd1 Updated translations from translationproject.org 2022-06-01 09:25:06 -06:00
Todd C. Miller
4b5ee47e0d Sudo now supports intercepting system(3). 2022-06-01 09:25:03 -06:00
Todd C. Miller
c20c3b5631 Only display "unable to connect to log server" warning once.
Previously, in intercept mode, if the log server is unreachable the
message would be printed for each sub-command.
2022-05-31 20:03:17 -06:00
Todd C. Miller
de4d53e488 When using ptrace(2), push the point where we suspend into exec_cmnd().
This should reduce the amount of time the child has to wait for
the parent to use PTRACE_SEIZE to seize control and then PTRACE_CONT
to continue the child.
2022-05-31 19:51:26 -06:00
Todd C. Miller
cec83a05a3 Add configure check for vfork(2) and fall back to fork(2) if missing. 2022-05-31 14:47:39 -06:00
Todd C. Miller
f52342031d Add support for intercepting the system(3) function.
This also means we can log system(3) with log_subcmds.
2022-05-31 14:45:00 -06:00
Todd C. Miller
436deda08d Newer compilers define __BYTE_ORDER__ and __ORDER_{BIG,LITTLE}_ENDIAN__
Also add riscv the little endian list.
2022-05-31 10:18:39 -06:00
Todd C. Miller
1c83161622 On AIX, fmemopen(3) has a bug where feof() returns false at EOF.
See https://www.ibm.com/support/pages/apar/IJ11845
2022-05-29 15:52:48 -06:00
Todd C. Miller
dc8311dae9 Fix potential signed integer overflow on 32-bit CPUs.
Converting fractional minutes to nanoseconds could overflow a 32-bit
integer, use long long instead.
2022-05-27 15:47:32 -06:00
Todd C. Miller
93916fde4f Fix path to example sudoers file, it is now in the build dir. 2022-05-27 15:33:58 -06:00
Todd C. Miller
b497d74544 init_options: initialize apparmor_profile to NULL 2022-05-27 13:57:22 -06:00
Todd C. Miller
c1934a6366 Update with latest 1.9.11 changes. 2022-05-27 13:09:08 -06:00
Todd C. Miller
6eda28ef51 Fix typo 2022-05-27 13:08:01 -06:00
Todd C. Miller
789bc6ec8e Update contributors. 2022-05-27 12:42:40 -06:00
Todd C. Miller
15f167c3a0 Fix uninitialized use of ca_store when building with wolfSSL. 2022-05-27 11:23:45 -06:00
Todd C. Miller
7125a9cc23 Newer Debian/Ubuntu uses libsepol-dev not libsepol1-dev. 2022-05-27 09:34:04 -06:00
Todd C. Miller
346e63cd7c Update .pot files for 1.9.11 2022-05-26 09:41:54 -06:00
Todd C. Miller
9bb288d10e Regenerate files after merging AppArmor integration. 2022-05-27 08:30:34 -06:00
Todd C. Miller
402fc832fa Merge pull request #148 from kernelmethod/apparmor_support
Add AppArmor support to sudo
2022-05-27 08:26:24 -06:00
Todd C. Miller
f16754a1dd Merge branch 'main' into apparmor_support 2022-05-27 08:25:12 -06:00
Todd C. Miller
dc2b28d3e0 Pass envp, not environ, to real execve() from exec_wrapper() if possible.
The replacement execve() function was passing the global environ
to exec_wrapper() instead of the envp parameter.  This caused the
command to be run with the wrong environment on AIX systems, and
possibly others, when intercept or log_subcmds was enabled.
Bug #1030.
2022-05-26 16:33:46 -06:00
Todd C. Miller
b6ddf3db6d Consolidate some translatable strings. 2022-05-26 09:37:58 -06:00
Todd C. Miller
38c6e1bffb Standardize protobuf "unable to unpack" warning messages. 2022-05-26 09:35:18 -06:00
Todd C. Miller
9ac42292d1 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.
2022-05-26 09:19:08 -06:00
Todd C. Miller
6ced49a34d Reset intercept_allow_setid if intercept_type changes from trace to dso.
But only reset intercept_allow_setid if the user didn't explicitly set it.
2022-05-25 10:09:08 -06:00
Todd C. Miller
deef5e57fb CentOS Stream only uses a major version number, no minor version.
This prevents the packages from being created as foo.el.arch.rpm
since we were assuming that the version number was two digits.
2022-05-24 15:58:39 -06:00
Todd C. Miller
d6be44db00 Add support for running o32 and n32 binaries on mips64. 2022-05-24 13:43:51 -06:00
Todd C. Miller
bc6a0e1a16 Enable ptrace support for MIPS but only for log_subcmds.
It is not possible to change the syscall return value on MIPS
so we cannot support full intercept mode.
Another complication on MIPS is that if a system call is invoked
via syscall(__NR_###), v0 holds __NR_O32_Linux and the real syscall
is in the first arg (a0) and other args are shifted by one.
2022-05-24 13:43:50 -06:00
Todd C. Miller
f053f174bc Add intercept_type sudoers option to set intercept/log_subcmds mechanism. 2022-05-24 13:39:28 -06:00
kernelmethod
d8184fdb6f Add documentation for AppArmor support
- Document the AppArmor userspec option in the sudoers man pages.
- Add information about the --with-apparmor build configuration option
  to INSTALL.md.
2022-05-23 13:41:56 -06:00
kernelmethod
58ce33abab Add libapparmor-dev to the Debian and Ubuntu Dockerfiles
Install libapparmor-dev on Debian- and Ubuntu-based Docker images so
that they can build sudo with AppArmor support.
2022-05-23 13:41:56 -06:00
kernelmethod
c20859d55b Add an APPARMOR_PROFILE user spec option to sudoers
sudoers now supports an APPARMOR_PROFILE option, which can be specified
as e.g.

    alice       ALL=(ALL:ALL)   APPARMOR_PROFILE=foo    ALL

The line above says "user alice can run any command as any user/group,
under confinement by the AppArmor profile 'foo'." Profiles can be
specified in any way that complies with the rules of
aa_change_profile(2). For instance, the sudoers configuration

    alice       ALL=(ALL:ALL)   APPARMOR_PROFILE=unconfined     ALL

allows alice to run any command unconfined (i.e., without an AppArmor
profile), while

    alice       ALL=(ALL:ALL)   APPARMOR_PROFILE=foo//&bar      ALL

tells sudoers that alice can run any command under the stacked AppArmor
profiles 'foo' and 'bar'.

The intention of this option is to give sysadmins on Linux distros
supporting AppArmor better options for fine-grained access control.
Among other things, this option can enforce mandatory access control
(MAC) over the operations that a privileged user is able to perform to
ensure that they cannot privesc past the boundaries of a specified
profile. It can also be used to limit which users are able to get
unconfined system access, by enforcing a default AppArmor profile on all
users and then specifying 'APPARMOR_PROFILE=unconfined' for a privileged
subset of users.
2022-05-23 13:41:56 -06:00
kernelmethod
bd25b85a66 Add an apparmor_profile sudo setting
Define a new sudo setting, `apparmor_profile`, that can be used to pass
in an AppArmor profile that should be used to confine commands. If
apparmor_profile is specified, sudo will execute the command using the
new `apparmor_execve` function, which confines the command under the
provided profile before exec'ing it.
2022-05-23 13:41:42 -06:00
kernelmethod
0b541c2029 Add a --with-apparmor build flag
Add a new build flag, --with-apparmor, that builds sudo with AppArmor
support. Modify the build script for Debian and Ubuntu to enable this
flag by default.
2022-05-23 13:41:14 -06:00
Todd C. Miller
b203753013 Pass the WUNTRACED flag to waitpid() even if __WALL is present.
Otherwise, we won't get the wait status of a suspended command
that is not being traced.
2022-05-19 19:48:24 -06:00
Todd C. Miller
583e8bf538 Use explicit library dependencies instead of implicit.
We now include all the dependent libraries when linking.
Fixes a linking problem on CentOS Stream 9.
2022-05-19 17:01:14 -06:00
Todd C. Miller
0b63af91bb mail_parse_errors: allocate the correct amount of space for mail body.
Use strlen(), not sizeof(), on "problem parsing sudoers" since it
is a tranlated string and not a constant.
This was caught by the existing overflow checks.
2022-05-19 09:42:57 -06:00
Todd C. Miller
0ea431e392 Move code to suspend sudo when no pty is in use to separate file.
Use this in test_ptrace.c to be able to suspend just like sudo does.
2022-05-18 07:29:55 -06:00
Todd C. Miller
a52e3776f0 Fix suspending a sudo-run shell in ptrace intercept mode with no pty.
When ptracing a process, we receive the signal-delivery-stop signal
before the group-stop signal.  If sudo is running the command in
the same terminal, we need to wait until the stop signal is actually
delivered to the command before we can suspend sudo itself.  If we
suspend sudo before receiving the group-stop, the command will be
restarted with PTRACE_LISTEN too late and will miss the SIGCONT
from sudo.
2022-05-17 14:26:03 -06:00
Todd C. Miller
0bcfe6184f OpenSSL 3.x requires the key usage extension be present in CA and certs.
Certificates generated with a CA that doesn't set the key usage
extension will fail to validate if "tls_verify" is enabled.
2022-05-17 12:22:07 -06:00