From: "Max R. Carrara" <m.carrara@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox v3 3/5] rest-server: connection: log cause of TLS handshake check errors
Date: Tue, 10 Nov 2026 12:07:25 +0100 [thread overview]
Message-ID: <20261110110728.144880-4-m.carrara@proxmox.com> (raw)
In-Reply-To: <20261110110728.144880-1-m.carrara@proxmox.com>
Errors from checking for a TLS handshake were logged with only their
outermost context, which hid the underlying OS error. For example, a
failed peek was only reported as "couldn't peek into incoming TCP
stream", without saying why it failed.
Log the whole error chain on a single line instead, so that the actual
reason shows up in the logs.
Also, do not keep the error from `tokio::time::timeout` in the error
context, because it doesn't tell us any additional information.
Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
proxmox-rest-server/src/connection.rs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/proxmox-rest-server/src/connection.rs b/proxmox-rest-server/src/connection.rs
index 00ee771b..9b3c1371 100644
--- a/proxmox-rest-server/src/connection.rs
+++ b/proxmox-rest-server/src/connection.rs
@@ -489,11 +489,11 @@ impl AcceptBuilder {
"[{peer}] failed to accept connection - connection channel closed: {send_err}"
);
}
}
Err(err) => {
- log::error!("[{peer}] failed to check for TLS handshake: {err}");
+ log::error!("[{peer}] failed to check for TLS handshake: {err:#}");
}
}
}
async fn wait_for_client_tls_handshake(
@@ -550,13 +550,15 @@ impl AcceptBuilder {
})
.await
.context("couldn't peek into incoming TCP stream")
};
- tokio::time::timeout(timeout, future)
- .await
- .context("timed out while waiting for client to initiate TLS handshake")?
+ // The elapsed error carries no information beyond the timeout itself, so do not keep it as
+ // the cause.
+ tokio::time::timeout(timeout, future).await.map_err(|_| {
+ format_err!("timed out while waiting for client to initiate TLS handshake")
+ })?
}
}
/// Checks whether an [SSL 3.0 / TLS plaintext fragment][0] being part of a
/// SSL / TLS handshake is contained in the given buffer.
@@ -654,11 +656,11 @@ mod tests {
fn assert_timeout_error(result: Result<TlsHandshakeCheck, Error>) {
let err = result.expect_err("check must time out");
assert_eq!(
format!("{err:#}"),
- "timed out while waiting for client to initiate TLS handshake: deadline has elapsed",
+ "timed out while waiting for client to initiate TLS handshake",
);
}
#[tokio::test]
async fn a_tls_client_is_detected() {
--
2.47.3
next prev parent reply other threads:[~2026-11-10 11:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 11:07 [PATCH proxmox v3 0/5] Fix #6738: Improve TLS Handshake Handling & Error Logging Max R. Carrara
2026-11-10 11:07 ` [PATCH proxmox v3 1/5] rest-server: connection: use enum for TLS handshake check result Max R. Carrara
2026-11-10 11:07 ` [PATCH proxmox v3 2/5] rest-server: connection: add tests for TLS handshake check Max R. Carrara
2026-11-10 11:07 ` Max R. Carrara [this message]
2026-11-10 11:07 ` [PATCH proxmox v3 4/5] rest-server: connection: avoid dropping clients during TLS check Max R. Carrara
2026-11-10 11:07 ` [PATCH proxmox v3 5/5] fix #6738: rest-server: log early closed connections at debug level Max R. Carrara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261110110728.144880-4-m.carrara@proxmox.com \
--to=m.carrara@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.