Todd C. Miller
ec751c63eb
log_allowed: pass struct eventlog * instead of argv[] and envp[].
...
This lets us log based on the command_info[] list passed in from
the front-end. Previously, much of the struct eventlog was constructed
from internal sudoers state instead.
2021-08-25 17:29:15 -06:00
Todd C. Miller
e2abcd6cb6
log_server_accept: fix memory leak of evlog when logging a sub-command.
...
Coverity CID 238643
2021-08-14 09:11:02 -06:00
Todd C. Miller
dae370fb70
Use a separate uuid for intercepted commands.
...
We use the uuid to match the command with its exit status.
2021-08-09 15:50:26 -06:00
Todd C. Miller
2e99450d40
Fix logging intercepted commands to a log server in sudoers.
...
Only available when the server supports the subcommands capability.
2021-08-09 15:50:26 -06:00
Todd C. Miller
1ae9954c63
Use run_argv and run_envp passed into the audit plugin for event logging.
...
Previously we used NewArgv[] and env_get() but now that logging is
performed via an audit plugin we should use the values passed in.
2021-08-09 15:50:25 -06:00
Todd C. Miller
8fa897d3ae
Move log_server_accept() out from under the #ifdef SUDOERS_LOG_CLIENT
...
Fixes a link error when sudo is configured with --disable-log-client.
2021-04-01 15:10:32 -06:00
Todd C. Miller
0663ffbc3f
Use sudo_basename() instead of doing the equivalent manually.
2021-02-10 15:14:08 -07:00
Todd C. Miller
5c66e9532e
Set sudoers_audit.close to NULL if not using a log server.
2020-12-11 08:46:39 -07:00
Todd C. Miller
27615b5582
For the audit plugin, command_info may be NULL.
...
Fixes a NULL dereference in sudoers_audit when an I/O logging
plugin rejects input/output or returns an error.
2020-11-17 13:04:57 -07:00
Todd C. Miller
2b71b61044
Update struct eventlog based on command_info[] from front-end.
...
The I/O log path is not known until the I/O log plugins have
run and other plugins may alter the execution environment.
2020-11-14 11:42:27 -07:00
Todd C. Miller
56fb16d3e8
Use sudoers_to_eventlog() and init_log_details() in sudoers_audit_accept().
...
log_deserialize_info() can be private to iolog.c again.
2020-11-09 17:15:11 -07:00
Todd C. Miller
62525dcc94
Log reject and alert messages to the log server if one is defined.
2020-11-09 17:15:02 -07:00
Todd C. Miller
e56c3b342b
Rename iolog_plugin.h to log_client.h.
...
It is no longer I/O log specific and is used by sudoers_audit too.
2020-11-09 17:13:04 -07:00
Todd C. Miller
62547746d3
Rename iolog_client -> log_client.
...
The logsrvd client code is now used for more than just I/O logging.
2020-11-09 17:13:04 -07:00
Todd C. Miller
2112d9beb1
Log accept messages in sudoers_audit if not I/O logging.
2020-11-04 05:39:16 -07:00
Todd C. Miller
4416bd5977
Use libeventlog in sudoers instead of doing our own logging.
2020-10-26 16:10:40 -06:00
Todd C. Miller
f1d19f1d6e
Add SLOG_AUDIT flag for log_warningx() to also audit the message.
...
This lets us combine audit_failure() and log_warningx() calls with
the same message.
2020-09-23 08:18:55 -06:00
Todd C. Miller
985af422d2
Rename __dso_public -> sudo_dso_public and move to config.h.
2020-08-12 09:57:42 -06:00
Todd C. Miller
ac00a07018
Initialize sudo_conv and sudo_printf in sudoers_audit_open().
...
We will need them if there is an error parsing sudoers and leaving
them unset can result in NULL deref. Also set the text domain to
"sudoers" like we do for the policy and I/O logging open functions.
Bug #934 .
2020-07-12 10:13:53 -06:00
Todd C. Miller
f047377a07
Add basic support for reject and error audit events to sudoers.
...
This is only used when logging events from plugins other than sudoers,
such as an approval plugin. With this change, if an approval
plugin rejects the command the denial will be logged in the
sudoers log file using the message from the approval plugin.
2020-06-04 14:41:35 -06:00
Todd C. Miller
b519481912
Defer logging of the successful command until approval plugins have run.
...
This adds audit plugin support to the sudoers module, currently
only used for accept events. As a result, the sudoers file is now
initially parsed as an audit plugin.
2020-06-02 09:07:46 -06:00
Todd C. Miller
dd88460800
We no longer need to include headers we don't use for sudo*.h files.
...
Previously we needed to include headers required by the various
sudo*h files. Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Todd C. Miller
45e589d443
Pass back a failure or error string to the front end.
...
The audit_failure() function now stores the failure string.
This will allow an audit plugin to log the reason if the user's
request is a rejected.
2020-01-30 13:25:36 -07:00
Todd C. Miller
486ee2b71f
debug_decl and debug_decl_vars now require a semicolon at the end.
2019-12-22 08:48:16 -07:00
Todd C. Miller
cf6c60c102
Add log_allowed and log_denied sudoers flags, defaulting to true.
2019-10-17 13:43:04 -06:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -06:00
Todd C. Miller
64e5d34c57
Add comments in .c files so PVS-Studio will check them.
2018-10-21 08:46:05 -06:00
Todd C. Miller
48fba3c2cc
update my email to Todd.Miller@sudo.ws
2017-12-03 17:53:40 -07:00
Todd C. Miller
4a07b472f0
Only include stddef.h where it is needed.
2015-06-20 05:34:35 -06:00
Todd C. Miller
dc883f2454
We require ANSI C so stop using the obsolete STDC_HEADERS.
2015-06-19 14:29:27 -06:00
Todd C. Miller
59ab26dbcc
Go back to a 2 args debug_decl and just use the "default" instance,
...
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
e9914a91b1
The sudoers plugin now defines its own list of debugging subsystem names
...
and defines.
2014-10-22 13:30:52 -06:00
Todd C. Miller
866cfc4fc3
Add support for multiple Debug lines per program. Callers may
...
register arbitrary debug facilities or use built-in defaults. We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
47835ff289
Rename missing.h -> sudo_compat.h
2014-07-22 14:25:16 -06:00
Todd C. Miller
127ba1354b
Rename gettext.h -> sudo_gettext.h
2014-07-21 14:49:43 -06:00
Todd C. Miller
18dbc52e4b
Add Solaris audit support; from Gary Winiger at Oracle.
2014-06-27 16:01:40 -06:00
Todd C. Miller
337a712745
Pass argc to audit functions too. Will be needed for Solaris audit
...
support.
2014-05-13 09:41:53 -06:00
Todd C. Miller
983ab1d163
Avoid unused variable warning if auditing is not supported.
2014-05-02 05:25:57 -06:00
Todd C. Miller
d3b4326713
Handle the (currently impossible) case where both BSM and Linux
...
auditing are supported. Pacifies cppcheck.
2014-04-24 11:17:05 -06:00
Todd C. Miller
2220f55aef
Propagate errors in audit code to caller instead of using fatal().
...
If we fail to audit an otherwise successful command, return an error
from the policy. For Linux audit, sudo may be compiled with audit
support but auditing may not be setup, so we don't consider that
an error.
2014-03-26 13:00:56 -06:00
Todd C. Miller
12a1b672c0
We must include gettext.h before missing.h as it includes system
...
headers. Also add missing DEFAULT_TEXT_DOMAIN defines in sudoers
audit code that does not include sudoers.h.
2014-02-11 09:40:59 -07:00
Todd C. Miller
1b39c3758d
Need to include gettext.h for BSM audit.
2013-08-15 13:36:25 -06:00
Todd C. Miller
d6282d154a
Update copyright years.
2013-04-24 09:35:02 -04:00
Todd C. Miller
f454a852cb
audit_failure() now calls gettext itself using the sudoers locale.
2012-11-08 15:37:43 -05:00
Todd C. Miller
5d052aeb60
Do not inform the user that the command was not permitted by the
...
policy if they do not successfully authenticate. This is a regression
introduced in sudo 1.8.6.
2012-11-06 11:19:51 -05:00
Todd C. Miller
839919566e
Add debug_decl/debug_return (almost) everywhere.
...
Remove old sudo_debug() and convert users to sudo_debug_printf().
2011-10-22 14:40:21 -04:00
Todd C. Miller
35d26ae34f
Don't try to audit failure if the runas user does not exist. We don't
...
have the user's command at this point so there is nothing to audit.
Add a NULL check in audit_success() and audit_failure() just to be
on the safe side.
2011-07-27 12:11:33 -04:00
Todd C. Miller
10c3bb62c4
Make local includes consistent; use double quotes for local includes
...
except for generated ones where we use angle brackets.
Also g/c unused compat.h.
2010-09-07 16:45:19 -04:00
Todd C. Miller
f454727bb8
Merge compat.h and missing.h into missing.h
2010-08-16 14:05:44 -04:00