Skip to content

Commit

Permalink
in_forward: Support empty_shared_key parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
  • Loading branch information
cosmo0920 committed Dec 3, 2024
1 parent d573777 commit 883242c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions plugins/in_forward/fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,11 @@ static struct flb_config_map config_map[] = {
0, FLB_TRUE, offsetof(struct flb_in_fw_config, buffer_max_size),
"The maximum buffer memory size used to receive a Forward message."
},
{
FLB_CONFIG_MAP_BOOL, "empty_shared_key", "false",
0, FLB_TRUE, offsetof(struct flb_in_fw_config, empty_shared_key),
"Set an empty shared key for authentication"
},
{0}
};

Expand Down
1 change: 1 addition & 0 deletions plugins/in_forward/fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct flb_in_fw_config {
flb_sds_t shared_key; /* shared key */
flb_sds_t self_hostname; /* hostname used in certificate */
struct mk_list users; /* username and password pairs */
int empty_shared_key; /* use an empty string as shared key */

int coll_fd;
struct flb_downstream *downstream; /* Client manager */
Expand Down
13 changes: 12 additions & 1 deletion plugins/in_forward/fw_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,19 @@ struct flb_in_fw_config *fw_config_init(struct flb_input_instance *i_ins)
}

/* Shared Key */
p = flb_input_get_property("empty_shared_key", i_ins);
if (p && flb_utils_bool(p)) {
config->empty_shared_key = FLB_TRUE;
}
else {
config->empty_shared_key = FLB_FALSE;
}

p = flb_input_get_property("shared_key", i_ins);
if (p) {
if (config->empty_shared_key) {
config->shared_key = flb_sds_create("");
}
else if (p) {
config->shared_key = flb_sds_create(p);
}
else {
Expand Down

0 comments on commit 883242c

Please sign in to comment.