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

out_forward: Always initialize salt with random numbers #2575

Merged
merged 1 commit into from
Sep 24, 2020
Merged
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
9 changes: 6 additions & 3 deletions plugins/out_forward/forward.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ static int secure_forward_init(struct flb_forward *ctx,
secure_forward_tls_error(ctx, ret);
return -1;
}

/* Gernerate shared key salt */
mbedtls_ctr_drbg_random(&fc->tls_ctr_drbg, fc->shared_key_salt, 16);
return 0;
}
#endif
Expand Down Expand Up @@ -520,6 +517,12 @@ static int forward_config_init(struct flb_forward_config *fc,
}
#endif

/* Generate the shared key salt */
if (flb_randombytes(fc->shared_key_salt, 16)) {
flb_plg_error(ctx->ins, "cannot generate shared key salt");
return -1;
}

mk_list_add(&fc->_head, &ctx->configs);
return 0;
}
Expand Down