From 83c9465c374dda501a5ad2ee3e06d95e421287f9 Mon Sep 17 00:00:00 2001 From: Yves Rutschle Date: Tue, 3 Mar 2026 22:34:36 +0100 Subject: [PATCH] sanity check that proxyprotocol is compiled in when used by listening endpoints --- sslh-main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sslh-main.c b/sslh-main.c index 035c3de..f9e7063 100644 --- a/sslh-main.c +++ b/sslh-main.c @@ -253,6 +253,18 @@ static void config_sanity_proxyprotocol(const struct sslhcfg_protocols_item* pro #endif } +static void config_sanity_listen_proxyprotocol(const struct sslhcfg_listen_item* endpoint) +{ +#ifndef HAVE_PROXYPROTOCOL + if (endpoint->proxyprotocol) { + print_message(msg_config_error, "listen on host: \"%s\"; port: \"%s\": " + "Uses proxyprotocol, but libproxyprotocol support was not compiled in.\n" + endpoint->host, endpoint->port); + exit(1); + } +#endif +} + void config_sanity_check(struct sslhcfg_item* cfg) { size_t i; @@ -265,6 +277,10 @@ void config_sanity_check(struct sslhcfg_item* cfg) } #endif + for (i = 0; i < cfg->listen_len; i++) { + config_sanity_listen_proxyprotocol(&cfg->listen[i]); + } + for (i = 0; i < cfg->protocols_len; ++i) { if (strcmp(cfg->protocols[i].name, "tls") != 0) { if (cfg->protocols[i].sni_hostnames_len) {