diff options
| author | Ed Tanous <ed@tanous.net> | 2025-08-01 19:49:35 +0300 |
|---|---|---|
| committer | Ed Tanous <ed@tanous.net> | 2025-08-13 18:36:53 +0300 |
| commit | 2e3cdf87e73e50ddf2d4b915089d0598a45815ee (patch) | |
| tree | cddc4946b6635e8b26b0a7cec397d2b8e7b45848 /http | |
| parent | 834d99ba6b7b06b73378ea62f56f0b25cf80e1ec (diff) | |
| download | bmcweb-2e3cdf87e73e50ddf2d4b915089d0598a45815ee.tar.xz | |
Enable Mutual TLS for http2 connections
Passing the TLS-provided credentials from the HTTP connection to the
http2 connection got missed, and appears to break mutual TLS for http2
connections. Pass the credentials.
Tested: Mutual TLS is now functional on http2 connections as shown in
the next patch.
Change-Id: Ia2bbcd5383dae859baa96908b76f221b9c74632c
Signed-off-by: Ed Tanous <etanous@nvidia.com>
Diffstat (limited to 'http')
| -rw-r--r-- | http/http2_connection.hpp | 14 | ||||
| -rw-r--r-- | http/http_connection.hpp | 3 |
2 files changed, 10 insertions, 7 deletions
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp index bb9f3d5453..aeb46abc52 100644 --- a/http/http2_connection.hpp +++ b/http/http2_connection.hpp @@ -65,13 +65,13 @@ class HTTP2Connection : using self_type = HTTP2Connection<Adaptor, Handler>; public: - HTTP2Connection(boost::asio::ssl::stream<Adaptor>&& adaptorIn, - Handler* handlerIn, - std::function<std::string()>& getCachedDateStrF, - HttpType httpTypeIn) : + HTTP2Connection( + boost::asio::ssl::stream<Adaptor>&& adaptorIn, Handler* handlerIn, + std::function<std::string()>& getCachedDateStrF, HttpType httpTypeIn, + const std::shared_ptr<persistent_data::UserSession>& mtlsSessionIn) : httpType(httpTypeIn), adaptor(std::move(adaptorIn)), ngSession(initializeNghttp2Session()), handler(handlerIn), - getCachedDateStr(getCachedDateStrF) + getCachedDateStr(getCachedDateStrF), mtlsSession(mtlsSessionIn) {} void start() @@ -307,7 +307,7 @@ class HTTP2Connection : if constexpr (!BMCWEB_INSECURE_DISABLE_AUTH) { thisReq.session = crow::authentication::authenticate( - {}, asyncResp->res, thisReq.method(), thisReq.req, nullptr); + {}, asyncResp->res, thisReq.method(), thisReq.req, mtlsSession); if (!crow::authentication::isOnAllowlist(thisReq.url().path(), thisReq.method()) && thisReq.session == nullptr) @@ -659,6 +659,8 @@ class HTTP2Connection : Handler* handler; std::function<std::string()>& getCachedDateStr; + std::shared_ptr<persistent_data::UserSession> mtlsSession; + using std::enable_shared_from_this< HTTP2Connection<Adaptor, Handler>>::shared_from_this; diff --git a/http/http_connection.hpp b/http/http_connection.hpp index 5001c9ee08..8f03e3e1b2 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -285,7 +285,8 @@ class Connection : void upgradeToHttp2() { auto http2 = std::make_shared<HTTP2Connection<Adaptor, Handler>>( - std::move(adaptor), handler, getCachedDateStr, httpType); + std::move(adaptor), handler, getCachedDateStr, httpType, + mtlsSession); if (http2settings.empty()) { http2->start(); |
