Skip to content

Commit

Permalink
main: Open-code internode encryption misconfig warning
Browse files Browse the repository at this point in the history
There's a warning message printed when internode encryption is
set up "incorrectly". The incorrectness "if" uses local variables
that soon will be moved away. This patch makes the check rely
purely on the config.

Signed-off-by: Pavel Emelyanov <[email protected]>
  • Loading branch information
xemul committed Aug 20, 2021
1 parent aa88527 commit 33c70e5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -806,11 +806,15 @@ int main(int ac, char** av) {
mscfg.encrypt = netw::messaging_service::encrypt_what::rack;
}

if (clauth && (mscfg.encrypt == netw::messaging_service::encrypt_what::dc || mscfg.encrypt == netw::messaging_service::encrypt_what::rack)) {
startlog.warn("Setting require_client_auth is incompatible with 'rack' and 'dc' internode_encryption values."
" To ensure that mutual TLS authentication is enforced, please set internode_encryption to 'all'. Continuing with"
" potentially insecure configuration."
);
const auto& seo = cfg->server_encryption_options();
if (utils::is_true(utils::get_or_default(seo, "require_client_auth", "false"))) {
auto encrypt = utils::get_or_default(seo, "internode_encryption", "none");
if (encrypt == "dc" || encrypt == "rack") {
startlog.warn("Setting require_client_auth is incompatible with 'rack' and 'dc' internode_encryption values."
" To ensure that mutual TLS authentication is enforced, please set internode_encryption to 'all'. Continuing with"
" potentially insecure configuration."
);
}
}

sstring compress_what = cfg->internode_compression();
Expand Down

0 comments on commit 33c70e5

Please sign in to comment.