-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TLS endpoint port propagation in gossip (#1708)
* Fix TLS endpoint port propagation in gossip * Support QUIC port propagation * Log common name upon TLS/QUIC connection
- Loading branch information
Showing
3 changed files
with
58 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,14 @@ | |
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
use std::{cell::UnsafeCell, convert::TryInto, fmt, net::SocketAddr, sync::Arc, time::Duration}; | ||
use std::{ | ||
cell::UnsafeCell, | ||
convert::TryInto, | ||
fmt::{self, Debug}, | ||
net::SocketAddr, | ||
sync::Arc, | ||
time::Duration, | ||
}; | ||
|
||
use async_trait::async_trait; | ||
use time::OffsetDateTime; | ||
|
@@ -426,7 +433,12 @@ impl LinkManagerUnicastTrait for LinkManagerUnicastTls { | |
format!("{host}:{local_port}"), | ||
endpoint.metadata(), | ||
)?; | ||
|
||
let endpoint = EndPoint::new( | ||
locator.protocol(), | ||
locator.address(), | ||
locator.metadata(), | ||
endpoint.config(), | ||
)?; | ||
self.listeners | ||
.add_listener(endpoint, local_addr, task, token) | ||
.await?; | ||
|
@@ -491,14 +503,14 @@ async fn accept_task( | |
match get_cert_chain_expiration(&tls_conn.peer_certificates())? { | ||
exp @ Some(_) => maybe_expiration_time = exp, | ||
None => tracing::warn!( | ||
"Cannot monitor expiration for TLS link {:?} => {:?} : client does not have certificates", | ||
"Cannot monitor expiration for TLS link {:?} => {:?}: client does not have certificates", | ||
src_addr, | ||
dst_addr, | ||
), | ||
} | ||
} | ||
|
||
tracing::debug!("Accepted TLS connection on {:?}: {:?}", src_addr, dst_addr); | ||
tracing::debug!("Accepted TLS connection on {:?}: {:?}. {:?}.", src_addr, dst_addr, auth_identifier); | ||
// Create the new link object | ||
let link = Arc::<LinkUnicastTls>::new_cyclic(|weak_link| { | ||
let mut expiration_manager = None; | ||
|
@@ -606,6 +618,16 @@ struct TlsAuthId { | |
auth_value: Option<String>, | ||
} | ||
|
||
impl Debug for TlsAuthId { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
write!( | ||
f, | ||
"Common Name: {}", | ||
self.auth_value.as_deref().unwrap_or("None") | ||
) | ||
} | ||
} | ||
|
||
impl From<TlsAuthId> for LinkAuthId { | ||
fn from(value: TlsAuthId) -> Self { | ||
LinkAuthId::builder() | ||
|