diff --git a/Cargo.lock b/Cargo.lock index 048e6d1..7e882db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3016,6 +3016,7 @@ dependencies = [ "crc", "log", "rand 0.8.8", + "rustls-native-certs", "serde", "serde_json", "stun", diff --git a/vendor/webrtc-ice/Cargo.toml b/vendor/webrtc-ice/Cargo.toml index 1aaf591..ab69a0a 100644 --- a/vendor/webrtc-ice/Cargo.toml +++ b/vendor/webrtc-ice/Cargo.toml @@ -45,6 +45,9 @@ package = "webrtc-mdns" [dependencies.rand] version = "0.8" +[dependencies.rustls-native-certs] +version = "0.8" + [dependencies.serde] version = "1" features = ["derive"] diff --git a/vendor/webrtc-ice/PATCHES.md b/vendor/webrtc-ice/PATCHES.md index 75cd9fe..5f3c1e8 100644 --- a/vendor/webrtc-ice/PATCHES.md +++ b/vendor/webrtc-ice/PATCHES.md @@ -11,3 +11,6 @@ the TURN servers but whose TCP goes through an HTTP proxy. application with `set_relay_transport`), adds TLS for `turns:`, and exposes the stream to the unchanged `turn` client as datagrams: one STUN message or ChannelData frame (with its 4-byte TCP padding) per read. `agent_gather.rs` uses it for `ProtoType::Tcp` URLs. UDP gathering is unchanged. + +TLS trusts the system certificate store (`rustls-native-certs`, as OpenSSL does) plus the bundled +Mozilla roots. A name mismatch is accepted only when the TURN URL is an IP literal. diff --git a/vendor/webrtc-ice/src/agent/turn_tcp.rs b/vendor/webrtc-ice/src/agent/turn_tcp.rs index b82059e..38e5697 100644 --- a/vendor/webrtc-ice/src/agent/turn_tcp.rs +++ b/vendor/webrtc-ice/src/agent/turn_tcp.rs @@ -86,7 +86,10 @@ async fn tls_connect(tcp: TcpStream, host: &str) -> Result, String> { use tokio_rustls::rustls::{self, client::WebPkiServerVerifier, pki_types::ServerName}; let provider = Arc::new(rustls::crypto::ring::default_provider()); + // System store first (it holds any CA the host's administrator added, e.g. for a TLS-inspecting + // proxy, as OpenSSL would use), then the bundled Mozilla roots. let mut roots = rustls::RootCertStore::empty(); + roots.add_parsable_certificates(rustls_native_certs::load_native_certs().certs); roots.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned()); let inner = WebPkiServerVerifier::builder_with_provider(Arc::new(roots), provider.clone()).build() .map_err(|e| format!("TURN TLS setup: {e}"))?;