Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/out_syslog/syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,8 @@ static struct flb_config_map config_map[] = {
FLB_CONFIG_MAP_STR, "mode", "udp",
0, FLB_TRUE, offsetof(struct flb_syslog, mode),
"Set the desired transport type, the available options are tcp and udp. If you need to "
"use a TLS secure channel, choose 'tcp' mode here and enable the 'tls' option separately."
"use a TLS secure channel, choose 'tcp' mode here and enable the 'tls' option separately. "
"DTLS over udp is not supported by this plugin."
},

{
Expand Down
8 changes: 8 additions & 0 deletions plugins/out_syslog/syslog_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ struct flb_syslog *flb_syslog_config_create(struct flb_output_instance *ins,
}
}

if (ctx->parsed_mode == FLB_SYSLOG_UDP && ins->use_tls == FLB_TRUE) {
flb_plg_error(ctx->ins,
"invalid configuration: mode=udp with tls=on is unsupported "
"(DTLS is not implemented)");
flb_syslog_config_destroy(ctx);
return NULL;
}

/* syslog_format */
tmp = flb_output_get_property("syslog_format", ins);
if (tmp) {
Expand Down
28 changes: 27 additions & 1 deletion tests/runtime/out_syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,32 @@ void flb_test_malformed_longer_sd_id_rfc5424()
test_ctx_destroy(ctx);
}

void flb_test_udp_mode_rejects_tls()
{
struct test_ctx *ctx;
int ret;

ctx = test_ctx_create();
if (!TEST_CHECK(ctx != NULL)) {
TEST_MSG("test_ctx_create failed");
exit(EXIT_FAILURE);
}

ret = flb_output_set(ctx->flb, ctx->o_ffd,
"match", "*",
"mode", "udp",
"tls", "on",
NULL);
TEST_CHECK(ret == 0);

ret = flb_start(ctx->flb);
if (!TEST_CHECK(ret != 0)) {
TEST_MSG("expected startup failure for mode=udp with tls=on");
}

test_ctx_destroy(ctx);
}

TEST_LIST = {
/* rfc3164 */
/* procid_key, msgid_key, sd_key are not supported */
Expand Down Expand Up @@ -1639,6 +1665,6 @@ TEST_LIST = {
{"format_msgid_preset_rfc5424", flb_test_msgid_preset_rfc5424},
{"allow_longer_sd_id_rfc5424", flb_test_allow_longer_sd_id_rfc5424},
{"malformed_longer_sd_id_rfc5424", flb_test_malformed_longer_sd_id_rfc5424},
{"udp_mode_rejects_tls", flb_test_udp_mode_rejects_tls},
{NULL, NULL}
};

Loading