[SRU] bail from handle_command() if _generate_command_map() fails
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Ubuntu Cloud Archive |
Invalid
|
Undecided
|
Unassigned | |||
Ussuri |
In Progress
|
Undecided
|
nikhil kshirsagar | |||
ceph (Ubuntu) | Status tracked in Mantic | |||||
Focal |
Fix Committed
|
Medium
|
nikhil kshirsagar | |||
Impish |
Won't Fix
|
Undecided
|
Unassigned | |||
Jammy |
Fix Released
|
Undecided
|
Unassigned | |||
Kinetic |
Fix Released
|
Medium
|
Unassigned | |||
Lunar |
Fix Released
|
Undecided
|
Unassigned | |||
Mantic |
Fix Released
|
Medium
|
Unassigned |
Bug Description
[Impact]
If improper json data is passed to rados using a manual curl command, or invalid json data through a script like the python eg. shown, it can end up crashing the mon. This is already fixed through https:/
[Test Plan]
Setup a ceph octopus cluster. A manual run of curl with malformed request like this results in the exception being thrown.
curl -k -H "Authorization: Basic $TOKEN" "https:/
This reproduces without restful API too.
This python script run on the mon node also will cause the exception to be thrown due to the particular json which is malformed,
root@focal-
#!/usr/bin/env python3
import json
import rados
c = rados.Rados(
c.connect()
cmd = json.dumps(
#cmd = json.dumps(
print(c.
root@focal-
(-22, b'', "bad or missing field 'caps'")
Once this exception is caught correctly as above and the error message printed due to this code, and we bail out of the function due to this SRU, the following code https:/
So therefore, setting debug level to 10 will validate that the message is never seen from _allowed_command(), i.e at the end of that function,
dout(10) << __func__ << " " << (capable ? "" : "not ") << "capable" << dendl;
Pasting the function code for reference, (https:/
bool Monitor:
const string &prefix, const cmdmap_t& cmdmap,
bool cmd_r = this_cmd-
bool cmd_w = this_cmd-
bool cmd_x = this_cmd-
bool capable = s->caps.is_capable(
g_ceph_context,
s->entity_name,
module, prefix, param_str_map,
cmd_r, cmd_w, cmd_x,
s->
dout(10) << __func__ << " " << (capable ? "" : "not ") << "capable" << dendl;
return capable;
}
So it would be a reasonable to test the SRU and verify that at loglevel 10, we do not see the https:/
[Where problems could occur]
The only potential problem with this cleanup fix is if
some additional code in the void Monitor:
[Other Info]
While the fix to catch the exception is already part of the Octopus 15.2.17 point release, (PR https:/
we need this cleanup fix that has now been also merged to master upstream through https:/
The cleanup fix bails out of the function if the exception is
thrown, therefore avoiding continuing in the function
void Monitor:
error situation.
Upstream tracker - https:/
Fixed in ceph main through https:/
Changed in ceph (Ubuntu): | |
milestone: | none → focal-updates |
Changed in ceph (Ubuntu Focal): | |
importance: | Undecided → Medium |
Changed in ceph (Ubuntu): | |
milestone: | focal-updates → none |
tags: | added: sts |
description: | updated |
description: | updated |
description: | updated |
summary: |
- [SRU] mon crashes when improper json is passed to rados + [SRU] bail from handle_command() if _generate_command_map() fails |
description: | updated |
tags: | added: se-sponsors |
Changed in ceph (Ubuntu Jammy): | |
status: | New → Fix Released |
Changed in ceph (Ubuntu Focal): | |
status: | New → In Progress |
assignee: | nobody → nikhil kshirsagar (nkshirsagar) |
Changed in ceph (Ubuntu): | |
status: | New → In Progress |
Changed in ceph (Ubuntu Kinetic): | |
status: | New → Fix Released |
Changed in ceph (Ubuntu Mantic): | |
status: | In Progress → Fix Released |
Changed in ceph (Ubuntu Lunar): | |
status: | New → Fix Released |
tags: | added: sts-sru-needed |
Changed in cloud-archive: | |
status: | New → Invalid |
tags: | removed: se-sponsors |
description: | updated |
// deleted comment //