Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SNI and peer address on handshake error logs #1041

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/src/https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ impl HttpsSession {
sock,
token,
request_id,
peer_address,
))
};

Expand Down Expand Up @@ -232,6 +233,7 @@ impl HttpsSession {
frontend,
self.frontend_token,
request_id,
self.peer_address,
);
handshake.frontend_readiness.event = readiness.event;
// Can we remove this? If not why?
Expand Down
33 changes: 28 additions & 5 deletions lib/src/protocol/rustls.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{cell::RefCell, io::ErrorKind, rc::Rc};
use std::{cell::RefCell, io::ErrorKind, net::SocketAddr, rc::Rc};

use mio::{net::TcpStream, Token};
use rustls::ServerConnection;
Expand All @@ -21,6 +21,7 @@ pub struct TlsHandshake {
pub container_frontend_timeout: TimeoutContainer,
pub frontend_readiness: Readiness,
frontend_token: Token,
pub peer_address: Option<SocketAddr>,
pub request_id: Ulid,
pub session: ServerConnection,
pub stream: TcpStream,
Expand All @@ -37,6 +38,7 @@ impl TlsHandshake {
stream: TcpStream,
frontend_token: Token,
request_id: Ulid,
peer_address: Option<SocketAddr>,
) -> TlsHandshake {
TlsHandshake {
container_frontend_timeout,
Expand All @@ -45,6 +47,7 @@ impl TlsHandshake {
event: Ready::EMPTY,
},
frontend_token,
peer_address,
request_id,
session,
stream,
Expand Down Expand Up @@ -72,14 +75,24 @@ impl TlsHandshake {
can_read = false
}
_ => {
error!("could not perform handshake: {:?}", e);
error!(
"Session(sni={:?}, source={:?}) could not perform handshake: {:?}",
self.session.server_name(),
self.peer_address,
e
);
return SessionResult::Close;
}
},
}

if let Err(e) = self.session.process_new_packets() {
error!("could not perform handshake: {:?}", e);
error!(
"Session(sni={:?}, source={:?}) could not perform handshake: {:?}",
self.session.server_name(),
self.peer_address,
e
);
return SessionResult::Close;
}
}
Expand Down Expand Up @@ -129,14 +142,24 @@ impl TlsHandshake {
can_write = false
}
_ => {
error!("could not perform handshake: {:?}", e);
error!(
"Session(sni={:?}, source={:?}) could not perform handshake: {:?}",
self.session.server_name(),
self.peer_address,
e
);
return SessionResult::Close;
}
},
}

if let Err(e) = self.session.process_new_packets() {
error!("could not perform handshake: {:?}", e);
error!(
"Session(sni={:?}, source={:?}) could not perform handshake: {:?}",
self.session.server_name(),
self.peer_address,
e
);
return SessionResult::Close;
}
}
Expand Down
Loading