Todd C. Miller
e5834bd405
Use #include <config.h> not #include "config.h" for consistency.
...
Otherwise, some compilers may do the wrong thing in a build
dir if there is a config.h file in the source dir too.
2022-06-29 08:47:16 -06:00
Todd C. Miller
9b93961b3e
Add new log_passwords and passprompt_regex settings.
...
When logging terminal input, if log_passwords is false and any
of the regular expressions in the passprompt_regex list are found
in the terminal output, terminal input will be replaced with '*'
characters until a newline or carriage return is found in the input
or an output character is received.
2022-01-28 08:52:42 -07:00
Todd C. Miller
cc6157d7d4
Add support for WolfSSL's OpenSSL compatibility layer.
...
Based on changes from Hayden Roche
2021-10-25 13:17:57 -06:00
Todd C. Miller
87c1dd9d7d
Move include of log_server.pb-c.h into logsrvd.h and sendlog.h
...
This way there is no include file order issue with the
PROTOBUF_C_VERSION_NUMBER check.
2021-10-25 12:25:24 -06:00
Todd C. Miller
a554629d84
Flush I/O logs before we send a commit point.
...
The commit point message means we have written the data to disk so
we should not be buffering it any longer.
We do not currently fsync(2) the data after flushing, perhaps we should.
2021-10-15 19:10:34 -06:00
Todd C. Miller
9248ea6bbe
Set umask to be less restrictive before creating parent directories.
...
Otherwise we could end up creating them with a more restrictive
mode than indended. Coverity CID 221592
2021-08-14 10:49:51 -06:00
Todd C. Miller
0dd2b6442a
Add log_exit setting in the sudo_logsrvd.conf eventlog stanza
...
This causes sudo_logsrvd to log a record with the exit status or
terminating signal in response to an ExitMessage.
2021-07-09 11:08:44 -06:00
Todd C. Miller
efaa173fbe
Replace logsrvd_is_early() with logsrvd_warn_stderr().
...
This is now defined in logsrvd_conf.c which removes a dependency
on another compilation unit for the fuzzer.
2021-06-16 08:45:29 -06:00
Todd C. Miller
2c1988410e
Add support for logging server warning/error messages.
...
We can use sudo_warn_set_conversation() to set a conversation
function that either writes to a log file or calls syslog().
2021-06-13 18:27:36 -06:00
Todd C. Miller
7b33974f21
Remove logsrvd closure ERROR state and use a boolean flag instead.
...
Fixes a bug where we would not insert a journal file that failed
to relay into the queue because its state was changed from CONNECTING
to ERROR after failing to connect.
2021-06-08 19:51:54 -06:00
Todd C. Miller
f49930c62e
Make the failed relay retry interval configurable.
...
This is the amount of time to wait before trying to resend a
journal to the relay server after a connection error.
2021-05-02 06:19:32 -06:00
Todd C. Miller
177816b787
Send outgoing messages to the relay server on startup.
...
Also attempt to retry messages that could not be relayed periodically.
2021-05-01 16:27:21 -06:00
Todd C. Miller
f92bb8840c
Create journal files in an incoming directory, move to outgoing when complete.
...
This will make it possible to process completed journal files
periodically if the relay server is down.
2021-04-29 14:19:08 -06:00
Todd C. Miller
84a01d3a93
Move local iolog log functions to logsrvd_local.c
2021-04-27 14:46:27 -06:00
Todd C. Miller
761b02d34f
Use function pointers for each client message type instead of conditionals.
...
This separats out the message handler from the functions that store
or relay the message contents.
2021-04-23 16:56:21 -06:00
Todd C. Miller
64ac63918e
Add enqueue_error_message() helper function.
...
Formats and enqueues an error message and enables the write event.
2021-04-23 16:56:20 -06:00
Todd C. Miller
050e91f8d1
Forward the journaled entry after it has been stored locally.
2021-04-23 16:56:18 -06:00
Todd C. Miller
280fabac38
Stash the value of the store_first config setting in connection_closure.
...
If the configuration changes it should not affect a connection that
is already in progress.
2021-04-23 16:56:17 -06:00
Todd C. Miller
c2d3070fa1
Journal messages to disk when store_first is set in the relay section.
...
Instead of forwarding messages immediately, they are journaled
locally in wire format.
This will be used to implement relay store-and-forward mode.
2021-04-23 16:55:30 -06:00
Todd C. Miller
6f5b353e87
Add configuration for sudo_logsrvd store-and-forward mode.
...
Adds "relay_dir" and "store_first" settings to sudo_logsrvd.conf
in the [relay] section. Also adds a --with-relaydir configure
argument to change the default value (usually /var/log/logsrvd-relay.
2021-04-23 16:54:15 -06:00
Todd C. Miller
110d9667e5
Use the packed message buffer when relaying if possible.
...
There's no need to rebuild the message buffer for anything but
RestartMessage and ClientHello.
2021-04-19 09:44:37 -06:00
Todd C. Miller
935daf6b7e
Allocate the data buffer in get_free_buf() too.
...
We always know the size of the data buffer we need at allocation time.
2021-04-18 17:10:53 -06:00
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
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
30f57bcdce
Add sa_host to struct server_address as a ref counted string.
...
Also convert sa_str to ref counted string.
2021-04-06 14:44:19 -06:00
Todd C. Miller
b1c4de2088
Add support for relaying to another sudo_logsrvd via TLS.
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
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
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
db72498257
Use struct eventlog in place of struct iolog_info.
2020-10-26 15:31:41 -06:00
Todd C. Miller
b9aff696fb
No longer need eventlog-related getters in logsrvd.c
2020-10-26 15:29:44 -06:00
Todd C. Miller
8c43340474
Use libeventlog in sudo_logsrvd.
2020-10-26 15:26:02 -06:00
Todd C. Miller
707437f6cb
Refactor eventlog code into a library
2020-10-26 15:24:35 -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
bd254e1042
Read/write runchroot and runcwd entries in the JSON event log.
2020-09-01 06:26:05 -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
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
18ff60f6ff
Disable IPv4-mapped IPv6 addresses in the listener.
...
Also store the host + port string and use it in error messages.
2020-04-08 08:54:28 -06:00
Todd C. Miller
f908ddd1bf
Create a pidfile for sudo_logsrvd when not run with the -n flag.
2020-03-29 05:05:08 -06:00
Todd C. Miller
cffda82e20
Do not use JSON_ARRAY with sudo_json_add_value()
2020-03-29 05:05:08 -06:00
Todd C. Miller
9b144069fc
Store runenv in the I/O log info file too.
2020-03-29 05:05:08 -06:00
Todd C. Miller
ea9b711a70
Write an extended I/O info log in JSON format.
...
This will be used by sudoreplay if it exists to get more information
about the command being replayed.
2020-03-29 05:05:08 -06:00
Todd C. Miller
5034ea91be
Some new source files got created with my old email address.
2020-03-29 05:05:08 -06:00