Skip to content

Commit a96f309

Browse files
authored
Merge pull request ceph#64349 from nbalacha/wip-nbalacha-71731
rgw: fix bucket logging AuthType field
2 parents 790d430 + 517ab76 commit a96f309

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

doc/radosgw/bucket_logging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ based on `AWS Logging Record Format`_.
241241
- host id taken from "x-amz-id-2" (or dash if empty)
242242
- signature version (or dash if empty)
243243
- cipher suite (or dash if empty)
244-
- authentication type (or dash if empty)
244+
- authentication type ("AuthHeader" for regular auth, "QueryString" for presigned URL or dash if unauthenticated)
245245
- host header (or dash if empty)
246246
- TLS version (or dash if empty)
247247
- access point ARN (not supported, always a dash)

src/rgw/rgw_auth_s3.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,13 +1757,18 @@ void get_aws_version_and_auth_type(const req_state* s, string& aws_version, stri
17571757
aws_version = "SigV2";
17581758
}
17591759
} else {
1760-
auth_type = "QueryString";
1761-
if (s->info.args.get("x-amz-algorithm") == AWS4_HMAC_SHA256_STR) {
1760+
if (!s->info.args.get("x-amz-credential").empty()) {
1761+
auth_type = "QueryString";
1762+
if (s->info.args.get("x-amz-algorithm") == AWS4_HMAC_SHA256_STR) {
17621763
/* AWS v4 */
1763-
aws_version = "SigV4";
1764-
} else if (!s->info.args.get("AWSAccessKeyId").empty()) {
1764+
aws_version = "SigV4";
1765+
} else if (!s->info.args.get("AWSAccessKeyId").empty()) {
17651766
/* AWS v2 */
1766-
aws_version = "SigV2";
1767+
aws_version = "SigV2";
1768+
}
1769+
} else {
1770+
// Unauthenticated
1771+
auth_type.clear();
17671772
}
17681773
}
17691774
}

src/rgw/rgw_bucket_logging.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ int log_record(rgw::sal::Driver* driver,
572572
s->info.x_meta_map.contains("x-amz-id-2") ? s->info.x_meta_map.at("x-amz-id-2") : "-",
573573
aws_version,
574574
s->info.env->get("SSL_CIPHER", "-"),
575-
auth_type,
575+
dash_if_empty(auth_type),
576576
dash_if_empty(fqdn),
577577
s->info.env->get("TLS_VERSION", "-"),
578578
"-", // no access point ARN

0 commit comments

Comments
 (0)