Commit Graph

10082 Commits

Author SHA1 Message Date
Todd C. Miller
07a2965bab Document TCP keepalive options in the manual pages. 2020-01-22 11:07:01 -07:00
Laszlo Orban
6f3f45aa24 sudoers: disable SO_KEEPALIVE socket option based on log_server_disable_keepalive flag in sudoers 2020-01-22 10:52:18 -07:00
Laszlo Orban
38160d0ccb logserver: enable/disable SO_KEEPALIVE socket option based on tcp_keepalive configuration option in sudo_logsrvd.conf 2020-01-22 10:52:18 -07:00
Todd C. Miller
b8e1422e84 Add proper diacritical to Róbert's name. 2020-01-22 10:48:31 -07:00
Todd C. Miller
db1a9b155f Install a default sudo.conf file. 2020-01-21 13:31:07 -07:00
Todd C. Miller
dde86e585f Add support for building on OpenSSL 1.0.2.
This adds compatibility defines for some OpenSSL 1.1.x functions.
2020-01-21 13:27:40 -07:00
Todd C. Miller
a755c658a5 No need to export the validate_hostname() symbol.
We don't export symbols in convenience libraries, only installed DSOs.
2020-01-20 14:58:02 -07:00
Todd C. Miller
1ba8968211 Fix a few pointer signedness warnings on Linux. 2020-01-20 14:47:38 -07:00
Todd C. Miller
c3bd025052 Store the server host name and IP in client_closure_fill().
Also check for getpeername() and inet_ntop() failure.
2020-01-20 14:03:41 -07:00
Todd C. Miller
0d2195c374 Iterate over io_plugins list in the iolog_* wrappers.
Moving the iteration into the wrapper functions simplifies the calling code.
2020-01-07 20:05:29 -07:00
Todd C. Miller
b0a84c4292 policy_plugin is global, no need to pass it to policy_* functions. 2020-01-07 18:40:36 -07:00
Todd C. Miller
2d91555e85 Fix handling of SSL_ERROR_WANT_{READ,WRITE} during normal I/O.
If we get SSL_ERROR_WANT_WRITE during SSL_read(), we need to resume
the SSL_read(), not call SSL_write() as we were doing.  Likewise
for SSL_ERROR_WANT_READ received from SSL_write().
This introduces a flag so we call the proper callback even when
the I/O direction doesn't match the read/write calls.
2020-01-20 12:42:39 -07:00
Todd C. Miller
36fbdc48ff Add siglist.c and signame.c as dependencies for depend target.
Fixes running "make depend" in lib/util dir when siglist.c or
signame.c are not already present.
2020-01-20 10:45:20 -07:00
Todd C. Miller
5913c63642 Add abs_top_srcdir and abs_top_builddir and use them.
Configure provides absolution versions of srcdir, builddir, top_srcdir
and top_builddir.  We can use these instead of calling pwd.
2020-01-20 06:37:42 -07:00
Robert Manner
8cacaabe9b plugins/python/regress: add missing license texts 2020-01-20 06:30:20 -07:00
Robert Manner
b66ecf6e13 plugins/python: various portability improvements 2020-01-20 06:30:20 -07:00
Robert Manner
f3b7f3c0d4 plugins/python/example_{io,conversation}: avoid printing signal number
They are platform dependant, so their test would fail on some platforms.
While we could create separate plugin for the tests, I like the idea that
the examples are ensured to be working.

I believe this is a good compromise for being able to auto update the
test cases.
2020-01-20 06:30:20 -07:00
Robert Manner
40f2189586 plugins/python/regress: load the python plugin dynamically
instead of linking with it.
2020-01-20 06:30:20 -07:00
Robert Manner
d9af3b2d3a generate_test_coverage.sh: example script to ease test coverage generation
Uses lcov and genhtml to generate test coverage. It is meant to be run
in a clean directory. Extra configure options can be added as script
arguments.

Example execution:

mkdir build
cd build
../generate_test_coverage.sh --enable-python
2020-01-20 06:30:20 -07:00
Robert Manner
383ca80333 plugins/python/regress/testdata: generated data for the pyplugin tests 2020-01-20 06:30:20 -07:00
Robert Manner
5da7bd562c plugins/python/regress: adds tests for python plugin feature and examples 2020-01-20 06:30:20 -07:00
Robert Manner
0b2d0334b7 plugins/python/example_policy_plugin.py: extend user env changing example
Make the demonstration extend the environment with a new variable.
Easier to read, and makes the testing able to check for that it is working.
2020-01-20 06:30:20 -07:00
Robert Manner
185471f263 plugins/python/python_plugin_policy: fix validate() call
When calling validate() python function, TypeError exception was thrown
("argument list must be a tuple"), because the call does not have
arguments, and python does not accept empty tuple for execution. NULL
must be used instead, which was handled as argument construction failure
previously.
2020-01-20 06:30:20 -07:00
Robert Manner
35c85596d7 plugins/python/example_policy_plugin.py: make allowed_commands ordered
Storing them as "tuple" instead of "set", so they have a fix order.
This makes the output of the list() example stable. ("set" is printed out
in random order)
2020-01-20 06:30:20 -07:00
Robert Manner
2ee1dd3ec3 plugins/python: fix confusing version display
IO/Group/Policy Python API version is displayed instead of sudo version,
because that is not very meaningful in this context.

They are only displayed in verbose mode.

Example plugins express it more concrete that they are displaying their
version, not the API version.
2020-01-20 06:30:20 -07:00
Robert Manner
87d76f4bbc plugins/python/example_conversation.py: make log path configurable
Similarly to IO plugin example. (It is easier to test it this way.)
2020-01-20 06:30:20 -07:00
Robert Manner
591d57ad28 plugins/python/example_io_plugin.py: fix backtrace during destructor
If the plugin fails to open the file for writing, constructor will raise
an exception and exit before creating the "_log" member variable.
So the destructor will also raise a backtrace. (Which python ignores, but
dumps out to stderr.)
2020-01-20 06:30:20 -07:00
Robert Manner
5be81eb25b plugins/python/python_plugin_common: raise debug level for module import 2020-01-20 06:30:20 -07:00
Robert Manner
8eab169098 plugins/python/example_debugging: fix typo in comment 2020-01-20 06:30:20 -07:00
Todd C. Miller
1093e7bc4b Rebuild dependencies after hostcheck.c include changes. 2020-01-19 09:11:06 -07:00
Todd C. Miller
47d9504716 Add debugging statements to certificate checks. 2020-01-18 12:57:24 -07:00
Todd C. Miller
5a86073bd0 Portability fixes and correct path to hostcheck.h in MANIFEST.
Include sys/socket.h for getpeername().
Link with -lnsl on Solaris to get inet_pton().
2020-01-18 11:32:45 -07:00
Todd C. Miller
d2b7148b6c Using "libtool --clean" to remove regular files is slow.
We only need to use libtool's clean mode to remove files created by libtool.
2020-01-18 05:53:55 -07:00
Laszlo Orban
a6916c2199 do server identity validation in iolog plugin 2020-01-18 05:49:54 -07:00
Laszlo Orban
829fb9db84 do client identity validation in logserver 2020-01-18 05:49:54 -07:00
Laszlo Orban
8d111db602 implement host validation for the audit server SSL certificates 2020-01-18 05:49:54 -07:00
Laszlo Orban
de02745a3f save a pointer to the currently connected audit server in the closure object 2020-01-18 05:49:54 -07:00
Todd C. Miller
7ceeca1eb0 Add examples/sudo.conf to ignore files. 2020-01-17 12:01:25 -07:00
Todd C. Miller
0ab02b8a16 Fix mdoc lint warnings by removing .Pp before and after .Ss. 2020-01-17 09:47:52 -07:00
Todd C. Miller
c9f26ebbb4 Remove whitespace at the end of the line in example sudo.conf 2020-01-17 09:47:52 -07:00
Todd C. Miller
9b12b21eaa Fix TLS accept when SSL_accept() returns SSL_ERROR_WANT_WRITE.
We need to switch from SUDO_EV_READ to SUDO_EV_WRITE for this case.
2020-01-16 17:37:46 -07:00
Todd C. Miller
36b3362b99 Fix TLS connect when SSL_connect returns SSL_ERROR_WANT_READ.
We need to switch from SUDO_EV_WRITE to SUDO_EV_READ for this case.
Also make the tls connect events private to tls_timed_connect()
with their own closure.  There is no need to store them in the
client closure.
2020-01-16 17:37:45 -07:00
Todd C. Miller
fb9d7d8cc6 Store submit time in struct iolog_info.
Fixes missing time stamp in remote I/O log info file.
2020-01-16 17:37:36 -07:00
Todd C. Miller
9e12b71776 Treat EROFS (like EACCES) as a non-fatal error in dir_is_writable().
Fixes sudoedit on macOS 10.15 and above where the root file system
is mounted read-only.  See https://support.apple.com/en-us/HT210650.
From Dan Villiom Podlaski Christiansen.  Bug #913
2020-01-16 13:55:32 -07:00
Todd C. Miller
161750fc56 Really fix flushing of data in client_close().
Now that we call fmt_exit_message() from client_close() we do not
need to try to determine whether the read or write events were
pending in the old base.

We can't tell anyway because the active flag in the event was cleared
when the old sudo event base was destroyed.  It is correct to enable
both the read and write events after formatting the ExitMessage.
2020-01-15 14:47:42 -07:00
Todd C. Miller
bbb9520c3a Use SUDOERS_DEBUG_* not SUDO_DEBUG_* in debug_decl() for the sudoers plugin. 2020-01-15 14:11:18 -07:00
Todd C. Miller
405d26f5b8 Wrap calls to plugin event callbacks to use the plugin's debug instance.
Otherwise, the debug output in a plugin's event callback will go
to the sudo debug file, not sudoers.
2020-01-15 14:05:08 -07:00
Todd C. Miller
41242e121f FreeBSD is missing SIGLWP (aka SIGTHR) in sys_signame[].
Don't test SIGLWP on FreeBSD where it is reserved for the thread
library and is not listed in sys_signame[].
2020-01-15 10:27:54 -07:00
Todd C. Miller
aed69fb471 We want to use DT_RUNPATH in preference to DT_RPATH in ELF binaries.
Otherwise, LD_LIBRARY_PATH does not work when running the tests.
The GNU linker's --enable-new-dtags can be used to do this.
We don't do this on NetBSD where RPATH already supports LD_LIBRARY_PATH.
2020-01-15 10:13:54 -07:00
Todd C. Miller
e7eef9c3a5 Fix reference counting when both sudoers policy and I/O log are loaded.
If both sudoers policy and I/O log plugins are loaded, debug_files
will be empty when the I/O plugin is initialized.  This changes the
logic to always increase the reference count if the instance is valid.
2020-01-14 17:50:40 -07:00