Skip to content

Commit

Permalink
crimson/net: sign message and check it if authorizer is available
Browse files Browse the repository at this point in the history
Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Apr 28, 2019
1 parent 1d30bb4 commit 0478623
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/crimson/net/ProtocolV1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ seastar::future<> ProtocolV1::write_message(MessageRef msg)
auto& header = msg->get_header();
header.src = messenger.get_myname();
msg->encode(conn.features, messenger.get_crc_flags());
if (session_security) {
session_security->sign_message(msg.get());
}
bufferlist bl;
bl.append(CEPH_MSGR_TAG_MSG);
bl.append((const char*)&header, sizeof(header));
Expand Down Expand Up @@ -774,6 +777,16 @@ seastar::future<> ProtocolV1::read_message()
::decode(m.footer, p);
auto msg = ::decode_message(nullptr, 0, m.header, m.footer,
m.front, m.middle, m.data, nullptr);
if (!msg) {
logger().debug("decode message failed");
return;
}
if (session_security) {
if (session_security->check_message_signature(msg)) {
logger().debug("signature check failed");
return;
}
}
// TODO: set time stamps
msg->set_byte_throttler(conn.policy.throttler_bytes);

Expand Down

0 comments on commit 0478623

Please sign in to comment.