Todd C. Miller
3dce67ec10
Relay ChangeWindowSize and CommandSuspend events too.
2021-04-17 07:59:13 -06:00
Todd C. Miller
163a5f08b5
Move relay configuration into its own section and add TLS options.
...
TLS options in the relay section will be used if specified, otherwise
the TLS options from the server section are used.
2021-04-08 19:14:05 -06:00
Todd C. Miller
25d4dd8e6d
Add "server" and "relay" to getters/callbacks specific to server and relay.
2021-04-08 19:09:55 -06:00
Todd C. Miller
90770794db
Remove struct logsrvd_tls_config.
...
Now that the SSL context is initialized in logsrvd_conf.c there's
no need to export TLS configuration other than tls_check_peer.
2021-04-08 18:07:59 -06:00
Todd C. Miller
9779996c3c
No longer need struct logsrvd_tls_runtime, use SSL_CTX instead.
2021-04-08 15:39:26 -06:00
Todd C. Miller
990fa4f5ad
Move allocation of the TLS context to logsrvd_conf_apply().
...
This way we get certificate errors at configuration time, not after.
It also means that a change to the config file that renders the TLS
settings invalid will no longer cause the server to exit. The new
config will just be ignored as if there was a syntax error.
2021-04-08 15:31:33 -06:00
Todd C. Miller
37e8b58684
In schedule_commit_point() do not free the closure on error.
...
It is the caller's responsibility to free resources on error.
Coverity CID 220557
2021-04-06 19:13:33 -06:00
Todd C. Miller
86c815fd61
Add logsrvd_conf_cleanup() to free the conf data structures on exit.
...
There is no longer a need to do anything in shutdown_cb() other
than break out of the event loop.
2021-04-06 14:44:19 -06:00
Todd C. Miller
d60b8a791c
Add a relay mode to sudo_logsrvd where it forwards instead of stores.
...
Relay hosts are be specified in the server section of sudo_logsrvd.conf.
2021-04-06 14:44:19 -06:00
Todd C. Miller
343100307d
Split most of server_commit_cb() out into schedule_commit_point().
...
This allows it to be used by the relay code too.
2021-04-06 14:44:19 -06:00
Todd C. Miller
533fcc3f02
Try to send an error message to client for some client_msg_cb() failures.
2021-04-06 14:44:19 -06:00
Todd C. Miller
8101b23e54
Rename listen_address -> server_address and add reference counting.
...
This will be used by the upcoming relay mode.
2021-04-06 14:44:19 -06:00
Todd C. Miller
71e5275a1c
Move common TLS initialization code to tls_init.c.
2021-03-10 16:29:27 -07:00
Todd C. Miller
7bb5eef9d9
Use a tailq of write buffers instead of a single one per connection.
...
This allows us to queue up multiple messages for writing like the
sudoers client supports. Currently, each connection has its own
free list. In the future we may want a single free list with low
and high water marks.
2021-04-06 14:30:16 -06:00
Todd C. Miller
1c6080f135
Remove unused tls parameter, we now use a per-address tls flag.
2021-03-05 14:48:08 -07:00
Todd C. Miller
d452678787
Log peer address in sudo_logsrvd JSON-format logs.
...
The peer that connected to us might not be the same host where the
log entry originated.
2021-03-02 18:37:35 -07:00
Todd C. Miller
dceab7d756
Break up the long help string into multiple printf() statements.
...
AIX xlc compiler doesn't like cpp directives in between strings.
Also fixes a complaint from cppcheck and makes translation easier.
2021-01-28 08:53:25 -07:00
Todd C. Miller
f6452c7caf
Avoid potential use after free with eventlog-only connections.
...
Coverity CID 215884.
2021-01-02 10:43:34 -07:00
Todd C. Miller
c5a7f0eb42
When shutting down the server, close non-I/O log connections immediately.
...
Avoids a timeout during server shutdown while the server waits for
active connections to close.
2020-12-03 14:40:30 -07:00
Todd C. Miller
293911eed6
Don't try to unlink a NULL pointer.
2020-11-24 09:53:54 -07:00
Todd C. Miller
0f6d581abd
If pid_file is set to an empty value, disable the use of a pid file.
2020-11-24 09:43:00 -07:00
Todd C. Miller
d0042eda9e
Don't overwrite sudo_logsrvd.pid if it is a symbolic link.
2020-11-24 09:00:25 -07:00
Todd C. Miller
deb217adf9
On SIGHUP, deregister the old debug instance before registering a new one.
...
Otherwise, if debugging is enabled we will get an extra log instance
each time sudo_logsrvd reeives SIGHUP which results in duplicate
lines in the debug log.
2020-11-10 19:36:55 -07:00
Todd C. Miller
9779009fae
Add info_msgs to AlertMessage and populate it.
...
This lets us log eventlog info along with the alert if it is available.
2020-11-09 17:15:11 -07:00
Todd C. Miller
f1ded289e1
Avoid early return in handle_accept() if expect_iobufs not set.
2020-11-04 05:15:07 -07:00
Todd C. Miller
e0c2635fb3
Apply Google inclusive language guidelines.
...
Also replace backwards with backward.
2020-10-30 10:15:30 -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
4652698f8e
struct eventlog contains submit_time, no need to pass it in directly.
2020-10-26 15:43:02 -06:00
Todd C. Miller
c0e91d7586
Add an errstr argument to eventlog_alert().
2020-10-26 15:41:47 -06:00
Todd C. Miller
db72498257
Use struct eventlog in place of struct iolog_info.
2020-10-26 15:31:41 -06:00
Todd C. Miller
8c43340474
Use libeventlog in sudo_logsrvd.
2020-10-26 15:26:02 -06:00
Todd C. Miller
e92d10011e
Rename sa_len -> sa_size to avoid a conflict on UnixWare and others.
...
On some systems, sa_len is a #define for 4.4BSD compatibility.
2020-09-04 16:06:37 -06:00
Todd C. Miller
eaa95acb31
Post-process protoc-c files to avoid depending on anonymous unions.
...
Based on a patch from Michael Osipov.
GitHub issue #60
2020-09-04 13:17:51 -06:00
Todd C. Miller
961a4afe67
Fix some warnings from pvs-studio
2020-08-12 13:45:09 -06:00
Todd C. Miller
cbad17a994
Move inclusion of compat headers up with the system headers.
...
Now that sudo_dso_public is defined in config.h we don't need sudo_compat.h
before including the compat headers.
2020-08-12 10:07:07 -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
076d0376db
We no longer need to include sudo_gettext.h before sudo_compat.h
2020-08-12 09:50:35 -06:00
Todd C. Miller
84f0ae0cb8
Use PACKAGE_VERSION instead of 0.1 as the client and server version.
2020-05-18 11:33:13 -06:00
Todd C. Miller
d2686dde0c
Rename FLUSHED state to FINISHED
...
This makes more sense when receiving event-only logs.
2020-05-13 09:30:05 -06:00
Todd C. Miller
0337f5b735
Fix handling of connections without associated I/O logs.
...
This fixes reject events as well as accept events without the
expect_iobufs flag set.
2020-05-13 07:40:47 -06:00
Todd C. Miller
fc79cbc317
Only enable TLS listener by default if we have a cert for it.
...
We want the log server to work with the default configuration. If
the default certificate path exists, it will be used with the default
listener. If the user explicitly enabled a TLS listener we always
attempt to use it. If TLS was specified but no cert file was set,
the default location will be used (and an error will occur if the
cert cannot be loaded).
2020-05-08 16:07:55 -06:00
Todd C. Miller
0cf2e09e0c
Apply spelling fixes.
...
Fixes from PR #30 (ka7) and Bug #925 (fossies.org codespell)
2020-05-06 09:27:43 -06:00
Todd C. Miller
6901fc97ac
Add a ClientHello message that client sends to the server.
...
This makes it easier to detect a plaintext client sending to a
TLS port. Without this, the TLS server will be silent as it
waits for the client to initiate the TLS connection.
2020-05-05 13:23:26 -06:00
Todd C. Miller
1f8da42f9a
Warn about tls errors during startup so the user has a clue.
...
We write messages to stderr until we become a daemon.
2020-05-05 13:23:26 -06:00
Todd C. Miller
e5f8214c0a
Remove the tls parameter from the ServerHello message.
...
The TLS connection is now initiated before ServerHello is received.
2020-05-05 13:23:26 -06:00
Todd C. Miller
1659d96c55
Use port 30343 for plaintext and port 30344 for TLS.
...
For TLS connections we now do the TLS handshake immediately before
the ServerHello message. This lets the client recieve an alert
from the server is there is a handshake error after the TLS connect
has succeeded. It also means that the contents of the ServerHello
are protected from a man-in-the-middle attack.
2020-05-05 13:23:26 -06:00
Todd C. Miller
2ab8f2a732
Check for tls_config->dhparams_path being non-NULL before using it.
2020-04-28 10:52:08 -06:00
Laszlo Orban
481427f9f0
add missing shudown of TLS connection
2020-04-17 07:00:19 -06:00
Todd C. Miller
ce92674cc2
Reload sudo.conf upon SIGUP
...
This makes it possible to update the Debug settings in sudo.conf and
have them take effect on reload.
2020-04-08 10:19:55 -06:00
Todd C. Miller
69b6783be6
Store the result of ERR_get_error() so we can use it for both warn and debug.
...
Otherwise, only the debug framework gets the actual error and the
user won't see the problem.
2020-04-08 09:26:41 -06:00