]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
RGW\logging: adding transport layer fields
authorAli Masarwa <amasarwa@redhat.com>
Tue, 14 Jan 2025 15:42:48 +0000 (17:42 +0200)
committerAli Masarwa <amasarwa@redhat.com>
Tue, 21 Jan 2025 08:45:37 +0000 (10:45 +0200)
Signed-off-by: Ali Masarwa <amasarwa@redhat.com>
src/rgw/rgw_asio_frontend.cc
src/rgw/rgw_bucket_logging.cc

index 30e1e77fd151ea45f494e1a0d1fdc49dd4d061c8..e4f01d816a0eba94e7b97e59706e160ef273d7d9 100644 (file)
@@ -323,6 +323,16 @@ void handle_connection(boost::asio::io_context& context,
                                   rgw::io::add_conlen_controlling(
                                     &real_client))));
       RGWRestfulIO client(cct, &real_client_io);
+      // getting ssl_cipher and tls_version
+      if(is_ssl) {
+        ceph_assert(typeid(Stream) == typeid(boost::asio::ssl::stream<tcp::socket&>));
+        const SSL * native_handle = reinterpret_cast<const SSL *>(stream.native_handle());
+        const auto ssl_cipher = SSL_CIPHER_get_name(SSL_get_current_cipher(native_handle));
+        const auto tls_version = SSL_get_version(native_handle);
+        auto& client_env = client.get_env();
+        client_env.set("SSL_CIPHER", ssl_cipher);
+        client_env.set("TLS_VERSION", tls_version);
+      }
       optional_yield y = null_yield;
       if (cct->_conf->rgw_beast_enable_async) {
         y = optional_yield{yield};
index 50eaa5478b49af40e2dff62d16e5474d51130dac..e43196f9d482714c3dc4e2cac06fc5df0cb8a5aa 100644 (file)
@@ -419,11 +419,11 @@ int log_record(rgw::sal::Driver* driver,
 
   switch (conf.logging_type) {
     case LoggingType::Standard:
-      record = fmt::format("{} {} [{:%d/%b/%Y:%H:%M:%S %z}] {} {} {} {} {} \"{} {}{}{} HTTP/1.1\" {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}",
+      record = fmt::format("{} {} [{:%d/%b/%Y:%H:%M:%S %z}] {} {} {} {} {} \"{} {}{}{} HTTP/1.1\" {} {} {} {} {} {} {} \"{}\" {} {} {} {} {} {} {} {} {}",
         dash_if_empty(bucket_owner),
         dash_if_empty(bucket_name),
         t,
-        "-", // no requester IP
+        s->info.env->get("REMOTE_ADDR", "-"),
         dash_if_empty(user_or_account),
         dash_if_empty(s->req_id),
         op_name,
@@ -443,10 +443,10 @@ int log_record(rgw::sal::Driver* driver,
         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") : "-",
         aws_version,
-        "-", // TODO: SSL cipher. e.g. "ECDHE-RSA-AES128-GCM-SHA256"
+        s->info.env->get("SSL_CIPHER", "-"),
         auth_type,
         dash_if_empty(fqdn),
-        "-", // TODO: TLS version. e.g. "TLSv1.2" or "TLSv1.3"
+        s->info.env->get("TLS_VERSION", "-"),
         "-", // no access point ARN
         (s->has_acl_header) ? "Yes" : "-");
       break;