Skip to content

Commit f43f3a1

Browse files
authored
out_syslog: fix TLS handling in config and code logic (fix fluent#5643) (fluent#5646)
The current implementation to handle a TLS session was assuming that a TLS context exists for the active instance of the plugin. Actually is the engine that decides 'when' to create the TLS context. In order to fix the issue the following changes has been made: - the 'mode' option no longer accepts 'tls' as a value. - if TLS is needed the user needs to: - set 'mode' to 'tcp' - enable TLS by adding a line like 'tls on' Signed-off-by: Eduardo Silva <[email protected]>
1 parent 7b8d984 commit f43f3a1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

plugins/out_syslog/syslog.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -871,11 +871,14 @@ static int cb_syslog_init(struct flb_output_instance *ins, struct flb_config *co
871871
}
872872
}
873873
else {
874-
io_flags = FLB_IO_TCP;
875874

876-
if (ctx->parsed_mode == FLB_SYSLOG_TLS) {
875+
/* use TLS ? */
876+
if (ins->use_tls == FLB_TRUE) {
877877
io_flags = FLB_IO_TLS;
878878
}
879+
else {
880+
io_flags = FLB_IO_TCP;
881+
}
879882

880883
if (ins->host.ipv6 == FLB_TRUE) {
881884
io_flags |= FLB_IO_IPV6;
@@ -893,8 +896,9 @@ static int cb_syslog_init(struct flb_output_instance *ins, struct flb_config *co
893896
/* Set the plugin context */
894897
flb_output_set_context(ins, ctx);
895898

896-
flb_plg_info(ctx->ins, "setup done for %s:%i",
897-
ins->host.name, ins->host.port);
899+
flb_plg_info(ctx->ins, "setup done for %s:%i (TLS=%s)",
900+
ins->host.name, ins->host.port,
901+
ins->use_tls ? "on" : "off");
898902
return 0;
899903
}
900904

@@ -987,7 +991,8 @@ static struct flb_config_map config_map[] = {
987991
{
988992
FLB_CONFIG_MAP_STR, "mode", "udp",
989993
0, FLB_TRUE, offsetof(struct flb_syslog, mode),
990-
"Set the desired transport type, the available options are tcp, tls and udp."
994+
"Set the desired transport type, the available options are tcp and udp. If you need to "
995+
"use a TLS secure channel, choose 'tcp' mode here and enable the 'tls' option separately."
991996
},
992997

993998
{

0 commit comments

Comments
 (0)