From a5d3e8788b729cf408feb3cef59229e9e67eb82d Mon Sep 17 00:00:00 2001 From: Eric Wang <37554696+ericwang401@users.noreply.github.com> Date: Sun, 28 Jan 2024 14:29:29 -0600 Subject: [PATCH] Add TLS verification toggle --- .env.docker.example | 4 +- .env.example | 4 +- README.md | 2 +- package.json | 1 + src-rust/Cargo.lock | 222 ++++++++++++++++++++++++- src-rust/Cargo.toml | 3 +- src-rust/src/app.rs | 10 +- src-rust/src/util/api/http.rs | 2 +- src-rust/src/util/api/proxmox.rs | 23 ++- src-rust/src/util/broadcast_config.rs | 8 +- src-rust/src/util/terminals/novnc.rs | 14 +- src-rust/src/util/terminals/xtermjs.rs | 13 +- 12 files changed, 286 insertions(+), 20 deletions(-) diff --git a/.env.docker.example b/.env.docker.example index a607bc2..3befc28 100644 --- a/.env.docker.example +++ b/.env.docker.example @@ -1,3 +1,5 @@ COTERM_URL= CONVOY_URL= -TOKEN= \ No newline at end of file +COTERM_TOKEN= + +DANGEROUS_DISABLE_TLS_VERIFICATION=false \ No newline at end of file diff --git a/.env.example b/.env.example index 2fac341..24ad652 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,7 @@ CONVOY_URL= -TOKEN= +COTERM_TOKEN= + +DANGEROUS_DISABLE_TLS_VERIFICATION=false # For development purposes... BACKEND_URL= \ No newline at end of file diff --git a/README.md b/README.md index ac625e2..ae63d75 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Svelte, Coterm is built for performance, and every millisecond counts. ## Quick start ``` -docker run -p 3000:3000 -e CONVOY_URL="" -e TOKEN="" ghcr.io/convoypanel/coterm:latest +docker run -p 3000:3000 -e CONVOY_URL="" -e COTERM_TOKEN="" ghcr.io/convoypanel/coterm:latest ``` The port can be modified by editing the first number to a different value. For example, if you want to broadcast on port diff --git a/package.json b/package.json index 2ad1967..3baa6f5 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "scripts": { "dev": "vite dev", + "dev:backend": "cargo watch -- cargo run --manifest-path=\"./src-rust/Cargo.toml\"", "build": "vite build", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", diff --git a/src-rust/Cargo.lock b/src-rust/Cargo.lock index b3c288e..7be3d8a 100644 --- a/src-rust/Cargo.lock +++ b/src-rust/Cargo.lock @@ -209,6 +209,7 @@ dependencies = [ "dotenv", "futures-util", "jsonwebtoken", + "native-tls", "reqwest", "serde", "serde_json", @@ -276,12 +277,43 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -657,6 +689,12 @@ version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + [[package]] name = "lock_api" version = "0.4.9" @@ -716,6 +754,24 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -772,12 +828,50 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +[[package]] +name = "openssl" +version = "0.10.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-sys" +version = "0.9.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "overload" version = "0.1.1" @@ -802,7 +896,7 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.45.0", ] @@ -854,6 +948,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkg-config" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -917,6 +1017,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "reqwest" version = "0.11.16" @@ -985,6 +1094,19 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustix" +version = "0.38.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "rustls" version = "0.20.8" @@ -1294,6 +1416,19 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "tempfile" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall 0.4.1", + "rustix", + "windows-sys 0.52.0", +] + [[package]] name = "thiserror" version = "1.0.40" @@ -1396,6 +1531,16 @@ dependencies = [ "syn 2.0.15", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.23.4" @@ -1438,10 +1583,12 @@ checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" dependencies = [ "futures-util", "log", + "native-tls", "rustls 0.22.1", "rustls-native-certs", "rustls-pki-types", "tokio", + "tokio-native-tls", "tokio-rustls 0.25.0", "tungstenite 0.21.0", ] @@ -1609,6 +1756,7 @@ dependencies = [ "http 1.0.0", "httparse", "log", + "native-tls", "rand", "rustls 0.22.1", "rustls-pki-types", @@ -1695,6 +1843,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" @@ -1867,6 +2021,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -1897,6 +2060,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -1909,6 +2087,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -1921,6 +2105,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -1933,6 +2123,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -1945,6 +2141,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -1957,6 +2159,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -1969,6 +2177,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -1981,6 +2195,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winreg" version = "0.10.1" diff --git a/src-rust/Cargo.toml b/src-rust/Cargo.toml index 5f61e97..27a910d 100644 --- a/src-rust/Cargo.toml +++ b/src-rust/Cargo.toml @@ -15,7 +15,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.96" tokio = { version = "1.27.0", features = ["full"] } tower-http = { version = "0.5.0", features = ["cors", "fs"] } -tokio-tungstenite = { version = "0.21.0", features = ["rustls-tls-native-roots"] } +tokio-tungstenite = { version = "0.21.0", features = ["rustls-tls-native-roots", "native-tls"] } futures-util = "0.3.28" dotenv = "0.15.0" reqwest = { version = "0.11.6", features = ["rustls-tls", "json"], default-features = false } @@ -24,3 +24,4 @@ jsonwebtoken = "8.3.0" axum-extra = { version = "0.9.0", features = ["cookie"] } tracing = "0.1.37" tracing-subscriber = "0.3.18" +native-tls = "0.2.11" diff --git a/src-rust/src/app.rs b/src-rust/src/app.rs index 0d71278..d91a2a1 100644 --- a/src-rust/src/app.rs +++ b/src-rust/src/app.rs @@ -1,5 +1,6 @@ use axum::Router; use dotenv::var; +use tracing::warn; use crate::routes; use crate::util::broadcast_config::create_assets_service; @@ -12,12 +13,19 @@ pub struct AppState { } pub async fn create_app() -> Router { - let token_env = var("TOKEN").expect("TOKEN is not set."); + let token_env = var("COTERM_TOKEN").expect("COTERM_TOKEN is not set."); let token_cloned = token_env.clone(); let mut token_combined = token_cloned.split("|"); let token_id = token_combined.next().expect("Your Coterm configuration is missing a properly formatted token value."); let token = token_combined.next().expect("Your Coterm configuration is missing a properly formatted token value."); + let do_not_verify_tls = var("DANGEROUS_DISABLE_TLS_VERIFICATION") + .unwrap_or("false".to_string()) + .to_lowercase() == "true"; + if do_not_verify_tls { + warn!("TLS verification is disabled. This is dangerous and should only be used for testing purposes.\nYou are vulnerable to man-in-the-middle attacks. This is very irresponsible if you are providing this for end users."); + } + let state = AppState { token_combined: token_env, token: token.to_owned(), diff --git a/src-rust/src/util/api/http.rs b/src-rust/src/util/api/http.rs index f9e70a0..08b485b 100644 --- a/src-rust/src/util/api/http.rs +++ b/src-rust/src/util/api/http.rs @@ -5,7 +5,7 @@ pub fn get_headers_with_authorization() -> HeaderMap { let mut headers = HeaderMap::new(); headers.insert("Content-Type", "application/json".parse().unwrap()); headers.insert("Accept", "application/json".parse().unwrap()); - headers.insert("Authorization", format!("Bearer {}", var("TOKEN").expect("TOKEN is not set.")).parse().unwrap()); + headers.insert("Authorization", format!("Bearer {}", var("COTERM_TOKEN").expect("COTERM_TOKEN is not set.")).parse().unwrap()); headers } \ No newline at end of file diff --git a/src-rust/src/util/api/proxmox.rs b/src-rust/src/util/api/proxmox.rs index f3590fb..ec83d87 100644 --- a/src-rust/src/util/api/proxmox.rs +++ b/src-rust/src/util/api/proxmox.rs @@ -1,6 +1,8 @@ +use dotenv::var; +use native_tls::TlsConnector; +use tokio_tungstenite::Connector; use tokio_tungstenite::tungstenite::handshake::client::{generate_key, Request}; use tokio_tungstenite::tungstenite::http::header::{CONNECTION, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_PROTOCOL, SEC_WEBSOCKET_VERSION, UPGRADE}; -use tokio_tungstenite::tungstenite::http::request::Builder; use urlencoding::encode; use crate::util::api::novnc::NoVncCredentials; @@ -11,13 +13,24 @@ pub enum Credentials { NoVnc(NoVncCredentials), } -pub fn build_ws_request(credentials: Credentials) -> Builder { +pub fn build_ws_request(credentials: Credentials) -> (Request, Connector) { let mut request = Request::builder() .header(SEC_WEBSOCKET_KEY, generate_key()) .header(SEC_WEBSOCKET_VERSION, "13") .header(SEC_WEBSOCKET_PROTOCOL, "binary") .header(CONNECTION, "Upgrade") - .header(UPGRADE, "websocket"); + .header(UPGRADE, "websocket") + ; + + let do_not_verify_tls = var("DANGEROUS_DISABLE_TLS_VERIFICATION") + .unwrap_or("false".to_string()) + .to_lowercase() == "true"; + let tls_connector = TlsConnector::builder() + .danger_accept_invalid_hostnames(do_not_verify_tls) + .danger_accept_invalid_certs(do_not_verify_tls) + .build() + .unwrap(); + let tls_connector = Connector::NativeTls(tls_connector); match credentials { Credentials::NoVnc(credentials) => { @@ -54,5 +67,7 @@ pub fn build_ws_request(credentials: Credentials) -> Builder { } } - request + let request = request.body(()).unwrap(); + + (request, tls_connector) } \ No newline at end of file diff --git a/src-rust/src/util/broadcast_config.rs b/src-rust/src/util/broadcast_config.rs index 58302b9..8e3072b 100644 --- a/src-rust/src/util/broadcast_config.rs +++ b/src-rust/src/util/broadcast_config.rs @@ -2,6 +2,7 @@ use std::path::PathBuf; use dotenv::var; use tower_http::services::ServeDir; +use tracing::warn; pub fn get_broadcast_port() -> u16 { return var("BACKEND_PORT").unwrap_or("3000".to_string()).parse().unwrap(); @@ -10,13 +11,18 @@ pub fn get_broadcast_port() -> u16 { pub fn create_assets_service() -> ServeDir { let public_dir = PathBuf::from("public"); let build_dir = PathBuf::from("../build"); + let static_dir = PathBuf::from("../static"); if public_dir.exists() { return ServeDir::new(public_dir); } else if build_dir.exists() { return ServeDir::new(build_dir); + } else if static_dir.exists() { + warn!("Using static directory for assets. This is not recommended for production use."); + + return ServeDir::new(static_dir); } else { - panic!("No asset directory found"); + panic!("No viable asset directory found"); } } diff --git a/src-rust/src/util/terminals/novnc.rs b/src-rust/src/util/terminals/novnc.rs index d471e86..23f677c 100644 --- a/src-rust/src/util/terminals/novnc.rs +++ b/src-rust/src/util/terminals/novnc.rs @@ -16,11 +16,17 @@ use crate::util::websocket::{convert_axum_to_tungstenite, convert_tungstenite_to pub async fn start_novnc_proxy(server_uuid: String, client_ws: WebSocket) { let credentials = create_novnc_credentials(server_uuid).await.unwrap(); - let (remote_ws, _) = tokio_tungstenite::connect_async( - build_ws_request( - Credentials::NoVnc(credentials.clone()) - ).body(()).unwrap() + + let (request, connector) = build_ws_request( + Credentials::NoVnc(credentials.clone()) + ); + let (remote_ws, _) = tokio_tungstenite::connect_async_tls_with_config( + request, + None, + false, + Some(connector), ).await.unwrap(); + let (client_sender, client_receiver) = client_ws.split(); let (remote_sender, remote_receiver) = remote_ws.split(); diff --git a/src-rust/src/util/terminals/xtermjs.rs b/src-rust/src/util/terminals/xtermjs.rs index 1752121..c7325eb 100644 --- a/src-rust/src/util/terminals/xtermjs.rs +++ b/src-rust/src/util/terminals/xtermjs.rs @@ -1,6 +1,7 @@ use axum::extract::ws::WebSocket; use futures_util::{SinkExt, StreamExt}; use tokio::join; +use tokio_tungstenite::Connector; use tokio_tungstenite::tungstenite::Message as TMessage; use crate::util::api::proxmox::{build_ws_request, Credentials}; @@ -10,10 +11,14 @@ use crate::util::websocket::{convert_axum_to_tungstenite, convert_tungstenite_to pub async fn start_xtermjs_proxy(server_uuid: String, client_ws: WebSocket) { let credentials = create_xtermjs_credentials(server_uuid).await.unwrap(); - let (remote_ws, _) = tokio_tungstenite::connect_async( - build_ws_request( - Credentials::XTerm(credentials.clone()) - ).body(()).unwrap() + let (request, connector) = build_ws_request( + Credentials::XTerm(credentials.clone()) + ); + let (remote_ws, _) = tokio_tungstenite::connect_async_tls_with_config( + request, + None, + false, + Some(connector), ).await.unwrap(); let (mut client_sender, mut client_receiver) = client_ws.split();