Skip to content

Commit 3d7755d

Browse files
committed
Only enable the TLS listener by default if a TLS cert is specified.
Or if the default certificate path exists. This restores the pre-f764980def behavior. Also remove the non-unused TLS_CONFIGURED macro; it is would always evaluate to true for the server config.
1 parent 7650e93 commit 3d7755d

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

logsrvd/logsrvd_conf.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@
6262
# define DEFAULT_SERVER_CERT_PATH "/etc/ssl/sudo/certs/logsrvd_cert.pem"
6363
# define DEFAULT_SERVER_KEY_PATH "/etc/ssl/sudo/private/logsrvd_key.pem"
6464

65-
/* Evaluates to true if at least one TLS field is set, else false. */
66-
# define TLS_CONFIGURED(_s) \
67-
((_s).tls_key_path != NULL || (_s).tls_cert_path != NULL || \
68-
(_s).tls_cacert_path != NULL || (_s).tls_dhparams_path != NULL || \
69-
(_s).tls_ciphers_v12 != NULL || (_s).tls_ciphers_v13 != NULL || \
70-
(_s).tls_verify != -1)
71-
7265
/* Evaluates to the relay-specific TLS setting, falling back to server. */
7366
# define TLS_RELAY_STR(_c, _f) \
7467
((_c)->relay._f != NULL ? (_c)->relay._f : (_c)->server._f)
@@ -1740,8 +1733,8 @@ logsrvd_conf_apply(struct logsrvd_config *config)
17401733
/* There can be multiple addresses so we can't set a default earlier. */
17411734
#if defined(HAVE_OPENSSL)
17421735
if (TAILQ_EMPTY(&config->server.addresses.addrs)) {
1743-
/* If no listener but TLS has been configured, enable TLS listener. */
1744-
if (TLS_CONFIGURED(config->server)) {
1736+
/* TLS certificate configured, enable default TLS listener. */
1737+
if (config->server.tls_cert_path != NULL) {
17451738
if (!cb_server_listen_address(config, "*:" DEFAULT_PORT_TLS "(tls)", 0))
17461739
debug_return_bool(false);
17471740
}

0 commit comments

Comments
 (0)