Skip to content

Commit 5c056fd

Browse files
committed
libceph: verify authorize reply on connect
After sending an authorizer (ceph_x_authorize_a + ceph_x_authorize_b), the client gets back a ceph_x_authorize_reply, which it is supposed to verify to ensure the authenticity and protect against replay attacks. The code for doing this is there (ceph_x_verify_authorizer_reply(), ceph_auth_verify_authorizer_reply() + plumbing), but it is never invoked by the the messenger. AFAICT this goes back to 2009, when ceph authentication protocols support was added to the kernel client in 4e7a5dc ("ceph: negotiate authentication protocol; implement AUTH_NONE protocol"). The second param of ceph_connection_operations::verify_authorizer_reply is unused all the way down. Pass 0 to facilitate backporting, and kill it in the next commit. Cc: stable@vger.kernel.org Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Sage Weil <sage@redhat.com>
1 parent 5418d0a commit 5c056fd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

net/ceph/messenger.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,19 @@ static int process_connect(struct ceph_connection *con)
20272027

20282028
dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
20292029

2030+
if (con->auth_reply_buf) {
2031+
/*
2032+
* Any connection that defines ->get_authorizer()
2033+
* should also define ->verify_authorizer_reply().
2034+
* See get_connect_authorizer().
2035+
*/
2036+
ret = con->ops->verify_authorizer_reply(con, 0);
2037+
if (ret < 0) {
2038+
con->error_msg = "bad authorize reply";
2039+
return ret;
2040+
}
2041+
}
2042+
20302043
switch (con->in_reply.tag) {
20312044
case CEPH_MSGR_TAG_FEATURES:
20322045
pr_err("%s%lld %s feature set mismatch,"

0 commit comments

Comments
 (0)