return info.method;
}
+
+void get_aws_version_and_auth_type(const req_state* s, string& aws_version, string& auth_type)
+{
+ const char* http_auth = s->info.env->get("HTTP_AUTHORIZATION");
+ if (http_auth && http_auth[0]) {
+ auth_type = "AuthHeader";
+ /* Authorization in Header */
+ if (!strncmp(http_auth, AWS4_HMAC_SHA256_STR,
+ strlen(AWS4_HMAC_SHA256_STR))) {
+ /* AWS v4 */
+ aws_version = "SigV4";
+ } else if (!strncmp(http_auth, "AWS ", 4)) {
+ /* AWS v2 */
+ aws_version = "SigV2";
+ }
+ } else {
+ auth_type = "QueryString";
+ if (s->info.args.get("x-amz-algorithm") == AWS4_HMAC_SHA256_STR) {
+ /* AWS v4 */
+ aws_version = "SigV4";
+ } else if (!s->info.args.get("AWSAccessKeyId").empty()) {
+ /* AWS v2 */
+ aws_version = "SigV2";
+ }
+ }
+}
} // namespace rgw::auth::s3
const AWSEngine::VersionAbstractor::string_to_sign_t& string_to_sign);
std::string get_canonical_method(const DoutPrefixProvider *dpp, RGWOpType op_type, const req_info& info);
+
+void get_aws_version_and_auth_type(const req_state* s, string& aws_version, string& auth_type);
} /* namespace s3 */
} /* namespace auth */
} /* namespace rgw */
#include "rgw_xml.h"
#include "rgw_sal.h"
#include "rgw_op.h"
+#include "rgw_auth_s3.h"
#define dout_subsys ceph_subsys_rgw
bucket_name = s->bucket->get_name();
}
+ using namespace rgw::auth::s3;
+ string aws_version("-");
+ string auth_type("-");
+ rgw::auth::s3::get_aws_version_and_auth_type(s, aws_version, auth_type);
+
switch (conf.logging_type) {
case LoggingType::Standard:
record = fmt::format("{} {} [{:%d/%b/%Y:%H:%M:%S %z}] {} {} {} {} {} \"{} {}{}{} HTTP/1.1\" {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}",
dash_if_zero(size),
"-", // no total time when logging record
std::chrono::duration_cast<std::chrono::milliseconds>(s->time_elapsed()),
- "-", // TODO: referer
- "-", // TODO: user agent
+ s->info.env->get("HTTP_REFERER", "-"),
+ s->info.env->get("HTTP_USER_AGENT", "-"),
dash_if_empty_or_null(obj, obj->get_instance()),
s->info.x_meta_map.contains("x-amz-id-2") ? s->info.x_meta_map.at("x-amz-id-2") : "-",
- "-", // TODO: Signature Version (SigV2 or SigV4)
+ aws_version,
"-", // TODO: SSL cipher. e.g. "ECDHE-RSA-AES128-GCM-SHA256"
- "-", // TODO: Auth type. e.g. "AuthHeader"
+ auth_type,
dash_if_empty(fqdn),
"-", // TODO: TLS version. e.g. "TLSv1.2" or "TLSv1.3"
"-", // no access point ARN