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
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
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
17a415ae77
Add log_exit_status sudoers option to log when a command exits.
...
This option defaults to off.
2021-07-09 11:08:44 -06:00
Todd C. Miller
95fb8eb727
Add sudoerserrorf(), a printf-style yyerror() function.
...
Use this to display a better error message when using a reserved
work in an alias definition.
2020-11-14 06:17:41 -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
fdae4bdbbb
Add support for file log line wrapping in libeventlog.
2020-10-26 16:16:46 -06:00
Todd C. Miller
d899fe5936
Use real setters for the eventlog config.
...
This makes it possible to have a base config that the callers can
modify instead of replacing the config wholesale.
2020-10-26 16:10:42 -06: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
bd1ca79cca
Add support for mailing eventlog entries and for logging raw messages.
...
These will be used by the sudoers plugin.
2020-10-26 16:10:37 -06:00
Todd C. Miller
88dcdcd11d
Fix -Wshadow warnings.
2020-09-25 15:09:45 -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
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
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
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
cdd5bb32eb
Add sudo_gai_fatal, sudo_gai_vfatal, sudo_gai_vwarn, sudo_gai_warn
...
and gai_log_warning that use gai_strerror() instead of strerror().
2018-11-05 09:08:05 -07:00
Todd C. Miller
b16912da1d
Don't include syslog.h from logging.h, just include it in the two
...
.c files it is actually needed.
2017-12-08 15:00:41 -07:00
Todd C. Miller
48fba3c2cc
update my email to Todd.Miller@sudo.ws
2017-12-03 17:53:40 -07:00
Todd C. Miller
6ba2769ba8
Add forward decl of union sudo_defs_val to silence a gcc warning.
2016-07-20 16:39:26 -06:00
Todd C. Miller
b5c2ca2fe5
Move sudoers locale callback function to locale.c and user it in
...
visudo and testsudoers.
2016-07-20 14:16:00 -06:00
Todd C. Miller
787912fa91
Check fprintf() return value in writeln_wrap() and return the number
...
of characters actually written, or -1 on error.
2016-05-14 19:38:23 -06:00
Todd C. Miller
d004b02fc6
Use non-exiting allocatings in the sudoers plugin.
2015-06-17 06:49:59 -06:00
Todd C. Miller
9d1c408b73
Non-exiting allocators for log functions. If log_allowed() fails
...
the user may not run the command. We don't try to return early for
log_failure(), log_auth_failure() or log_denial() as we would not
run the command in that case.
2015-05-27 10:55:27 -06:00
Todd C. Miller
04128f5985
Get rid of SUDO_MAIN. Modern compilers don't warn about mixing
...
extern and auto declarations unless they conflict.
2015-05-21 11:26:44 -06:00
Todd C. Miller
05a01d4c5d
Avoid using a leading underbar in defines as they are reserved in
...
ISO C.
2015-05-21 11:13:20 -06:00
Todd C. Miller
8bc70a635c
Instead of trying to make weak functions work on all platforms,
...
just use a registration function for a plugin-specific setlocale
function. The sudoers version just wraps sudoers_setlocale().
2015-05-11 14:51:32 -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
b0f1fa7d05
Rename log_warning flags and only send mail if SLOG_SEND_MAIL is
...
set instead of mailing by default like we used to.
2014-05-02 20:54:01 -06:00
Todd C. Miller
954a3e77b1
Add log_warningx
2014-05-02 16:40:30 -06:00
Todd C. Miller
cbee9cc8cb
Remove now-unused log_fatal()
2014-04-30 17:00:20 -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
ef2cff1d33
Now that we have proper number parsing functions we should store
...
T_UINT defaults values as unsigned int, not int.
2013-12-11 14:43:04 -07:00
Todd C. Miller
99b7351de0
Fix some #if vs. #ifdef and remove an extraneous semicolon.
...
Bug #624 ; from Daniel Richard G.
2013-11-17 16:15:36 -07:00
Todd C. Miller
0f091f478b
Add __printflike to audit_failure.
2013-08-18 14:21:29 -06:00
Todd C. Miller
d6282d154a
Update copyright years.
2013-04-24 09:35:02 -04:00
Todd C. Miller
1162b55040
Rename log_error() -> log_warning() for consistency with warning()/fatal()
2013-04-18 14:14:03 -04:00
Todd C. Miller
a803b4d2ec
Change multiple inclusion guards to be _SUDOERS_FOO_H
2013-03-25 11:17:46 -04:00
Todd C. Miller
90147bb605
Allow sudoers programs (visudo, sudoreplay, visudo) to use
...
plugin_error.c instead of the error.c from the front-end. This
means sudoers_setlocale() needs to be independent of the sudo_user
struct and the defaults table. The sudoers locale is now updated
via a callback.
2012-11-25 09:33:52 -05:00
Todd C. Miller
336021a9c0
Fix compilation on systems w/o setlocale()
2012-11-12 05:36:43 -05:00
Todd C. Miller
a0c53bd751
Call gettext inside log_error et al instead of having the caller do it. This way we can display any messages to the user in their own locale but log in the sudoers local.
2012-11-08 15:37:44 -05:00
Todd C. Miller
4207589fe2
Add simple locale switching to make it easy to switch from the
...
user's locale to the sudoers locale without making excessive
setlocale() calls when we don't need to.
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
8b03f3e7d0
Move log_denial() calls and logic to log_failure().
...
Move authentication failure logging to log_auth_failure().
Both of these call audit_failure() for us.
This subtly changes logging for commands that are denied by sudoers
but where the user failed to enter the correct password. Previously,
these would be logged as "N incorrect password attempts" but now
are logged as "command not allowed". Fixes bug #563
2012-07-10 12:42:33 -04:00
Todd C. Miller
44ce5720de
Remove the NO_EXIT flag to log_error() and add a log_fatal() function
...
that exits and is marked no_return. Fixes false positives from
static analyzers and is easier for humans to read too.
2012-03-26 10:59:14 -04:00
Todd C. Miller
f90731596a
Split out log file word wrap code into its own file and add unit
...
tests. Fixes an off-by one in the word wrap when the log line
length matches loglinelen.
2011-07-11 15:22:25 -04:00
Todd C. Miller
2cd108304d
Add Linux audit support.
2010-06-16 11:17:02 -04:00
Todd C. Miller
b72a530fd0
Update copyright year
2010-06-14 12:19:49 -04:00
Todd C. Miller
8ae8e8442c
Remove use of RETSIGTYPE; all modern systems have signal handlers that
...
return void.
2010-05-21 18:40:04 -04:00