SUDO_LOGSRVD(8)
โจ SUDO_LOGSRVD(8) โจ
manual name: sudo_logsrvd, section 8, System Manager's Manual ๐
๐ NAME ๐
sudo_logsrvd โ sudo event and I/O log server ๐ฆ
๐ SYNOPSIS ๐
sudo_logsrvd [-hnV] [-f file] [-R percentage]
๐ธ DESCRIPTION ๐ธ
okay so sudo_logsrvd is a high-performance log server that accepts event and I/O logs from sudo ๐ญ๐ฅ it's giving centralized logging energy, bestie. You can use it to collect all your sudo logs in one place. The server has two modes of operation: local and relay โจ. By default, sudo_logsrvd stores the logs locally, but it can also be configured to relay them to another server that supports the sudo_logsrv.proto(5) protocol ๐ง.
When it's not relaying, event log entries can be logged either via syslog(3) or to a local file ๐. I/O logs stored locally by sudo_logsrvd can be replayed with the sudoreplay(8) utility, the same way you'd replay logs generated directly by the sudoers plugin ๐ฌ slay.
The server also supports restarting interrupted log transfers ๐ so a dropped connection doesn't mean starting over. To tell completed I/O logs apart from incomplete ones, the I/O log timing file is set to be read-only once the log is complete ๐. Lowkey genius.
Configuration parameters for sudo_logsrvd can be specified in the sudo_logsrvd.conf(5) file, or in whatever file you pass via the -f option ๐.
sudo_logsrvd rereads its configuration file when it receives SIGHUP ๐, and it writes server state to the debug file (if one is configured) when it receives SIGUSR1 ๐ฃ. Main character signals, honestly ๐.
The options are as follows:
-f file,--file=fileโ tells it to read the configuration from file instead of the default,/etc/sudo_logsrvd.conf๐-h,--helpโ shows a short help message on the standard output, then exits ๐-n,--no-forkโ runssudo_logsrvdin the foreground instead of detaching from the terminal and turning into a daemon ๐-R percentage,--random-drop=percentageโ for each message, there's a percentage chance the server will drop the connection ๐. This is only meant for debugging how well a client can restart a connection, so don't go using it in real life, periodt ๐ซ-V,--versionโ prints thesudo_logsrvdversion and exits โจ
๐ Securing server connections ๐
Real talk: the I/O log data sent tosudo_logsrvdmay contain sensitive information, like passwords ๐ฑ. It should be secured using Transport Layer Security (TLS) ๐. Doing that requires a signed certificate on the server and, iftls_checkpeeris enabled insudo_logsrvd.conf(5), a signed certificate on the client as well ๐ซถ.
The certificates can be signed by a well-known Certificate Authority (CA), or you can use a private CA ๐ฐ. Instructions for creating a private CA are included below in the โEXAMPLESโ section ๐.
๐ Debugging sudo_logsrvd ๐
sudo_logsrvd supports a flexible debugging framework ๐ง , configured through Debug lines in the sudo.conf(5) file ๐ ๏ธ.
For more information on configuring sudo.conf(5), check out its manual ๐ (iykyk, it's the same vibe as this one).
โจ EXAMPLES โจ
๐ Creating self-signed certificates
Okay so, unless you're using certificates signed by a well-known Certificate Authority (or a local enterprise CA), you'll need to make your very own CA that can sign the certificates used by sudo_logsrvd, sudo_sendlog, and the sudoers plugin. ๐ The following steps use the openssl(1) command to create keys and certificates.
๐ธ Initial setup
First, we need to make a directory structure to store the CA's files. We'll create a brand new hierarchy in /etc/ssl/sudo for this purpose. ๐
# mkdir /etc/ssl/sudo
# cd /etc/ssl/sudo
# mkdir certs csr newcerts private
# chmod 700 private
# touch index.txt
# echo 1000 > serial
The serial and index.txt files are used to keep track of signed certificates. ๐
Next, we need to make a copy of the openssl.conf file and customize it for our new CA. The path to openssl.cnf is system-dependent, but /etc/ssl/openssl.cnf is the most common location. ๐ง You'll need to adjust the example below if yours lives somewhere else on your system.
# cp /etc/ssl/openssl.cnf .
Now edit the openssl.cnf file in the current directory and make sure it contains โcaโ, โCA_defaultโ, โv3_caโ, and โusr_certโ sections. ๐
Those sections should include at least the following settings:
[ ca ]
default_ca = CA_default
[ CA_default ]
dir = /etc/ssl/sudo
certs = $dir/certs
database = $dir/index.txt
certificate = $dir/cacert.pem
serial = $dir/serial
[ v3_ca ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer
basicConstraints = critical,CA:true
keyUsage = cRLSign, keyCertSign
[ usr_cert ]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, \
keyEncipherment
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
If your openssl.conf file already has a โCA_defaultโ section, you may only need to modify the โdirโ setting, and enable the โkeyUsageโ settings if they're commented out. โจ
๐ Creating the CA key and certificate
To create and sign our own certificates, we need a private key and a certificate for the root of the CA. ๐ First, create the private key and protect it with a pass phrase:
# openssl genrsa -aes256 -out private/cakey.pem 4096
# chmod 400 private/cakey.pem
Next, generate the root certificate, using appropriate values for the site-specific fields: ๐
# openssl req -config openssl.cnf -key private/cakey.pem \
-new -x509 -days 7300 -sha256 -extensions v3_ca \
-out cacert.pem
Enter pass phrase for private/cakey.pem:
You are about to be asked to enter information that will be
incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name
or a DN.
There are quite a few fields but you can leave some blank.
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Colorado
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgets Pty Ltd]:sudo
Organizational Unit Name (eg, section) []:sudo Certificate Authority
Common Name (e.g., server FQDN or YOUR name) []:sudo Root CA
Email Address []:
# chmod 444 cacert.pem
Finally, verify the root certificate: ๐
# openssl x509 -noout -text -in cacert.pem
๐ฆ Creating and signing certificates
Heads up, the server and client certificates get signed by the root CA we just made. ๐ซถ Usually the root CA isn't used to sign server/client certificates directly. Instead, intermediate certificates are created and signed with the root CA, and those intermediate certs are used to sign CSRs (Certificate Signing Request). In this example we'll skip that part for simplicity's sake and sign the CSRs with the root CA. ๐
First, generate the private key without a pass phrase.
# openssl genrsa -out private/logsrvd_key.pem 2048
# chmod 400 private/logsrvd_key.pem
Next, create a certificate signing request (CSR) for the server's certificate. The organization name must match the name given in the root certificate. The common name should be either the server's IP address or a fully qualified domain name. ๐ฎ
# openssl req -config openssl.cnf -key private/logsrvd_key.pem -new \
-sha256 -out csr/logsrvd_csr.pem
Enter pass phrase for private/logsrvd_key.pem:
You are about to be asked to enter information that will be
incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name
or a DN.
There are quite a few fields but you can leave some blank.
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Colorado
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgets Pty Ltd]:sudo
Organizational Unit Name (eg, section) []:sudo log server
Common Name (e.g., server FQDN or YOUR name) []:logserver.example.com
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Now sign the CSR that was just created: ๐
# openssl ca -config openssl.cnf -days 375 -notext -md sha256 \
-in csr/logsrvd_csr.pem -out certs/logsrvd_cert.pem
Using configuration from openssl.cnf
Enter pass phrase for ./private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 4096 (0x1000)
Validity
Not Before: Nov 11 14:05:05 2019 GMT
Not After : Nov 20 14:05:05 2020 GMT
Subject:
countryName = US
stateOrProvinceName = Colorado
organizationName = sudo
organizationalUnitName = sudo log server
commonName = logserve.example.com
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key Encipherment
X509v3 Subject Key Identifier:
4C:50:F9:D0:BE:1A:4C:B2:AC:90:76:56:C7:9E:16:AE:E6:9E:E5:B5
X509v3 Authority Key Identifier:
keyid:D7:91:24:16:B1:03:06:65:1A:7A:6E:CF:51:E9:5C:CB:7A:95:3E:0C
Certificate is to be certified until Nov 20 14:05:05 2020 GMT (375 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
Finally, verify the new certificate: โ
# openssl verify -CAfile cacert.pem certs/logsrvd_cert.pem
certs/logsrvd_cert.pem: OK
The /etc/ssl/sudo/certs directory now holds a signed and verified certificate for use with sudo_logsrvd. ๐ฅณ
To generate a client certificate, just repeat the process above using a different file name. ๐
๐ Configuring sudo_logsrvd to use TLS
To use TLS for client/server communication, both sudo_logsrvd and the sudoers plugin need to be configured to use TLS. ๐ก๏ธ Configuring sudo_logsrvd for TLS takes the following settings, assuming the same path names we used earlier:
# Listen on port 30344 for TLS connections to any address.
listen_address = *:30344(tls)
# Path to the certificate authority bundle file in PEM format.
tls_cacert = /etc/ssl/sudo/cacert.pem
# Path to the server's certificate file in PEM format.
tls_cert = /etc/ssl/sudo/certs/logsrvd_cert.pem
# Path to the server's private key file in PEM format.
tls_key = /etc/ssl/sudo/private/logsrvd_key.pem
โ ๏ธ The root CA cert (cacert.pem) must be installed on the system runningsudo_logsrvd. If peer authentication is enabled on the client, a copy ofcacert.pemmust be present on the client system too.
๐ SEE ALSO ๐
sudo.conf(5),sudo_logsrv.proto(5),sudo_logsrvd.conf(5),sudoers(5),sudo(8),sudo_sendlog(8),sudoreplay(8)
๐งโ๐คโ๐ง AUTHORS ๐งโ๐คโ๐ง
Okay, so, many people have worked on sudo over the years ๐ this version consists of code written primarily by:
Todd C. Miller
Check out the CONTRIBUTORS.md file in the sudo distribution (https://www.sudo.ws/about/contributors/) for an exhaustive list of people who have contributed to sudo. ๐
๐ BUGS ๐
If you believe you've found a bug in sudo_logsrvd, you can either file a bug report in the sudo bug database, https://bugzilla.sudo.ws/, or open an issue at https://github.com/sudo-project/sudo/issues. ๐ชฒ If you'd rather use email, messages may be sent to the sudo-workers mailing list, https://www.sudo.ws/mailman/listinfo/sudo-workers (public) or <sudo@sudo.ws> (private).
๐จ Please do NOT report security vulnerabilities through public GitHub issues, Bugzilla, or mailing lists! Instead, report them via email to <Todd.Miller@sudo.ws>. You may encrypt your message with PGP if you'd like, using the key found at https://www.sudo.ws/dist/PGPKEYS.
๐ SUPPORT ๐
Limited free support is available via the sudo-users mailing list. See https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search the archives. ๐ซ
๐ DISCLAIMER ๐
sudo_logsrvd is provided โAS ISโ, and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. ๐
โโ๏ธ See the LICENSE.md file distributed with sudo or https://www.sudo.ws/about/license/ for complete details.
Bestie, that's the whole thing! ๐ We're in the sudo 1.9.17p2 era, last updated July 14, 2024, and this page lives in its SUDO_LOGSRVD(8) home forever. ๐ฆ๐
๐ฆ where this page comes from
- alpine 3.24: sudo-doc 1.9.17_p2-r2 ยท custom ISC
- arch rolling: sudo 1.9.17.p2-6 ยท custom
- fedora 43: sudo-logsrvd 1.9.17-7.p2.fc43 ยท ISC
- fedora 44: sudo-logsrvd 1.9.17-10.p2.fc44 ยท ISC
- fedora 44: sudo-logsrvd 1.9.17-7.p2.fc44 ยท ISC
- nixos 26.05: sudo 1.9.17p2
- nixpkgs unstable: sudo 1.9.17p2
- ubuntu questing: sudo 1.9.17p2-1ubuntu1
- ubuntu questing: sudo 1.9.17p2-1ubuntu1.1 ยท ISC
- ubuntu resolute: sudo 1.9.17p2-1ubuntu3 ยท ISC
- ubuntu resolute: sudo 1.9.17p2-1ubuntu3.2 ยท ISC
- ubuntu stonking: sudo 1.9.17p2-7ubuntu5 ยท ISC
- ๐ the page's license: ISC
- Copyright (c) 2019-2024 Todd C. Miller <Todd.Miller@sudo.ws>
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms