Skip to content

Commit b66e312

Browse files
idryomovgregkh
authored andcommitted
libceph: verify authorize reply on connect
commit 5c056fdc5b474329037f2aa18401bd73033e0ce0 upstream. 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. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Sage Weil <sage@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent edfe6a7 commit b66e312

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

net/ceph/messenger.c

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

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

2045+
if (con->auth_reply_buf) {
2046+
/*
2047+
* Any connection that defines ->get_authorizer()
2048+
* should also define ->verify_authorizer_reply().
2049+
* See get_connect_authorizer().
2050+
*/
2051+
ret = con->ops->verify_authorizer_reply(con, 0);
2052+
if (ret < 0) {
2053+
con->error_msg = "bad authorize reply";
2054+
return ret;
2055+
}
2056+
}
2057+
20452058
switch (con->in_reply.tag) {
20462059
case CEPH_MSGR_TAG_FEATURES:
20472060
pr_err("%s%lld %s feature set mismatch,"

0 commit comments

Comments
 (0)