mirror of
https://github.com/ceph/ceph
synced 2024-12-22 03:22:00 +00:00
rgw: Policies now properly evaluate the X-Forwarded-For header.
Signed-off-by: John Gibson <jgibson@mitre.org>
This commit is contained in:
parent
e02facbf5c
commit
5f7d9c4ff6
@ -607,7 +607,16 @@ rgw::IAM::Environment rgw_build_iam_environment(RGWRados* store,
|
||||
i = m.find("REMOTE_ADDR");
|
||||
}
|
||||
if (i != m.end()) {
|
||||
e.emplace("aws:SourceIp", i->second);
|
||||
const string* ip = &(i->second);
|
||||
string temp;
|
||||
if (remote_addr_param == "HTTP_X_FORWARDED_FOR") {
|
||||
const auto comma = ip->find(',');
|
||||
if (comma != string::npos) {
|
||||
temp.assign(*ip, 0, comma);
|
||||
ip = &temp;
|
||||
}
|
||||
}
|
||||
e.emplace("aws:SourceIp", *ip);
|
||||
}
|
||||
|
||||
i = m.find("HTTP_USER_AGENT"); {
|
||||
|
Loading…
Reference in New Issue
Block a user