Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_forward: Support empty_shared_key parameter #9681

Merged
merged 2 commits into from
Dec 6, 2024
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
7 changes: 6 additions & 1 deletion plugins/in_forward/fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ static struct flb_config_map config_map[] = {
},
{
FLB_CONFIG_MAP_STR, "shared_key", NULL,
0, FLB_FALSE, 0,
0, FLB_TRUE, offsetof(struct flb_in_fw_config, shared_key),
"Shared key for authentication"
},
{
Expand Down 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
11 changes: 5 additions & 6 deletions plugins/in_forward/fw_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,11 @@ struct flb_in_fw_config *fw_config_init(struct flb_input_instance *i_ins)
}

/* Shared Key */
p = flb_input_get_property("shared_key", i_ins);
if (p) {
config->shared_key = flb_sds_create(p);
}
else {
config->shared_key = NULL;
if (config->empty_shared_key) {
if (config->shared_key) {
flb_sds_destroy(config->shared_key);
}
config->shared_key = flb_sds_create("");
}

/* Self Hostname */
Expand Down
Loading