Skip to content

Commit f764980

Browse files
committed
Only enable plaintext listened by default if not built with TLS support.
Previously, sudo_logsrvd would accept both TLS and plaintext connections if no "listen_address" was specified. With this change, if sudo_logsrvd.conf doesn't specify a "listen_address", the TLS listener will be enabled if built with TLS support, otherwise the plaintext listener will be enabled. There is no change in behavior when a "listen_address" is specified. Found by the ZeroPath AI Security Engineer <https://zeropath.com>
1 parent 3d467a7 commit f764980

File tree

3 files changed

+43
-25
lines changed

3 files changed

+43
-25
lines changed

docs/sudo_logsrvd.conf.man.in

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1717
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818
.\"
19-
.TH "SUDO_LOGSRVD.CONF" "@mansectform@" "September 28, 2025" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
19+
.TH "SUDO_LOGSRVD.CONF" "@mansectform@" "November 7, 2025" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
2020
.nh
2121
.if n .ad l
2222
.SH "NAME"
@@ -56,7 +56,7 @@ section contains a copy of the default
5656
file.
5757
.PP
5858
The following configuration sections are recognized:
59-
.PP
59+
.sp
6060
.RS 1n
6161
.PD 0
6262
.TP 3n
@@ -113,19 +113,29 @@ service name as defined by the system service name database.
113113
If no port is specified, port 30343 will be used for plaintext
114114
connections and port 30344 will be used for TLS connections.
115115
.sp
116-
The default value is:
116+
Multiple
117+
\fIlisten_address\fR
118+
lines may be specified to listen on more than one port or address.
119+
.sp
120+
The default value for
121+
\fIlisten_address\fR
122+
depends on whether or not TLS has been configured.
123+
If any of the TLS options have been enabled, the default is:
117124
.nf
125+
.sp
118126
.RS 12n
119-
listen_address = *:30343
120127
listen_address = *:30344(tls)
121128
.RE
122129
.fi
123130
.RS 6n
124-
which will listen on all configured network interfaces for both
125-
plaintext and TLS connections.
126-
Multiple
127-
\fIlisten_address\fR
128-
lines may be specified to listen on more than one port or interface.
131+
.sp
132+
Otherwise, the plaintext listener is enabled by default:
133+
.nf
134+
.sp
135+
.RS 12n
136+
listen_address = *:30343
137+
.RE
138+
.fi
129139
.RE
130140
.TP 6n
131141
server_log = string

docs/sudo_logsrvd.conf.mdoc.in

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1616
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1717
.\"
18-
.Dd September 28, 2025
18+
.Dd November 7, 2025
1919
.Dt SUDO_LOGSRVD.CONF @mansectform@
2020
.Os Sudo @PACKAGE_VERSION@
2121
.Sh NAME
@@ -104,16 +104,22 @@ service name as defined by the system service name database.
104104
If no port is specified, port 30343 will be used for plaintext
105105
connections and port 30344 will be used for TLS connections.
106106
.Pp
107-
The default value is:
108-
.Bd -literal -compact -offset indent
109-
listen_address = *:30343
110-
listen_address = *:30344(tls)
111-
.Ed
112-
which will listen on all configured network interfaces for both
113-
plaintext and TLS connections.
114107
Multiple
115108
.Em listen_address
116-
lines may be specified to listen on more than one port or interface.
109+
lines may be specified to listen on more than one port or address.
110+
.Pp
111+
The default value for
112+
.Em listen_address
113+
depends on whether or not TLS has been configured.
114+
If any of the TLS options have been enabled, the default is:
115+
.Bd -literal -offset indent
116+
listen_address = *:30344(tls)
117+
.Ed
118+
.Pp
119+
Otherwise, the plaintext listener is enabled by default:
120+
.Bd -literal -offset indent
121+
listen_address = *:30343
122+
.Ed
117123
.It server_log = string
118124
Where to log server warning and error messages.
119125
Supported values are

logsrvd/logsrvd_conf.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* SPDX-License-Identifier: ISC
33
*
4-
* Copyright (c) 2019-2023 Todd C. Miller <[email protected]>
4+
* Copyright (c) 2019-2025 Todd C. Miller <[email protected]>
55
*
66
* Permission to use, copy, modify, and distribute this software for any
77
* purpose with or without fee is hereby granted, provided that the above
@@ -1740,13 +1740,10 @@ logsrvd_conf_apply(struct logsrvd_config *config)
17401740
}
17411741

17421742
/* There can be multiple addresses so we can't set a default earlier. */
1743-
if (TAILQ_EMPTY(&config->server.addresses.addrs)) {
1744-
/* Enable plaintext listender. */
1745-
if (!cb_server_listen_address(config, "*:" DEFAULT_PORT, 0))
1746-
debug_return_bool(false);
17471743
#if defined(HAVE_OPENSSL)
1748-
/* If a certificate was specified, enable the TLS listener too. */
1749-
if (config->server.tls_cert_path != NULL) {
1744+
if (TAILQ_EMPTY(&config->server.addresses.addrs)) {
1745+
/* If no listener but TLS has been configured, enable TLS listener. */
1746+
if (TLS_CONFIGURED(config->server)) {
17501747
if (!cb_server_listen_address(config, "*:" DEFAULT_PORT_TLS "(tls)", 0))
17511748
debug_return_bool(false);
17521749
}
@@ -1770,7 +1767,12 @@ logsrvd_conf_apply(struct logsrvd_config *config)
17701767
}
17711768
break;
17721769
}
1770+
}
17731771
#endif /* HAVE_OPENSSL */
1772+
if (TAILQ_EMPTY(&config->server.addresses.addrs)) {
1773+
/* TLS not configured, enable plaintext listener. */
1774+
if (!cb_server_listen_address(config, "*:" DEFAULT_PORT, 0))
1775+
debug_return_bool(false);
17741776
}
17751777

17761778
#if defined(HAVE_OPENSSL)

0 commit comments

Comments
 (0)