rdp: update to newer ironrdp

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2024-07-23 12:38:39 +04:00
parent 7e78eee0e8
commit dc080909fe
4 changed files with 32 additions and 80 deletions

View File

@ -1,2 +1,6 @@
[alias]
xtask = "run --package xtask --"
[patch."https://github.com/Devolutions/IronRDP"]
ironrdp = { path = "../IronRDP/crates/ironrdp" }

73
Cargo.lock generated
View File

@ -2211,7 +2211,6 @@ checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c"
[[package]]
name = "ironrdp"
version = "0.5.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"ironrdp-cliprdr",
"ironrdp-connector",
@ -2224,7 +2223,6 @@ dependencies = [
[[package]]
name = "ironrdp-acceptor"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"ironrdp-async",
"ironrdp-connector",
@ -2236,7 +2234,6 @@ dependencies = [
[[package]]
name = "ironrdp-ainput"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"bitflags 2.6.0",
"ironrdp-dvc",
@ -2248,7 +2245,6 @@ dependencies = [
[[package]]
name = "ironrdp-async"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"bytes",
"ironrdp-connector",
@ -2259,7 +2255,6 @@ dependencies = [
[[package]]
name = "ironrdp-cliprdr"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"bitflags 2.6.0",
"ironrdp-pdu",
@ -2271,7 +2266,6 @@ dependencies = [
[[package]]
name = "ironrdp-connector"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"ironrdp-error",
"ironrdp-pdu",
@ -2286,7 +2280,6 @@ dependencies = [
[[package]]
name = "ironrdp-displaycontrol"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"ironrdp-dvc",
"ironrdp-pdu",
@ -2297,7 +2290,6 @@ dependencies = [
[[package]]
name = "ironrdp-dvc"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"ironrdp-pdu",
"ironrdp-svc",
@ -2308,12 +2300,10 @@ dependencies = [
[[package]]
name = "ironrdp-error"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
[[package]]
name = "ironrdp-graphics"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"bit_field",
"bitflags 2.6.0",
@ -2330,7 +2320,6 @@ dependencies = [
[[package]]
name = "ironrdp-pdu"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"bit_field",
"bitflags 2.6.0",
@ -2352,7 +2341,6 @@ dependencies = [
[[package]]
name = "ironrdp-rdpsnd"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"bitflags 2.6.0",
"ironrdp-pdu",
@ -2363,7 +2351,6 @@ dependencies = [
[[package]]
name = "ironrdp-server"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"anyhow",
"async-trait",
@ -2378,14 +2365,13 @@ dependencies = [
"ironrdp-svc",
"ironrdp-tokio",
"tokio",
"tokio-rustls 0.26.0",
"tokio-rustls",
"tracing",
]
[[package]]
name = "ironrdp-session"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"ironrdp-connector",
"ironrdp-displaycontrol",
@ -2400,7 +2386,6 @@ dependencies = [
[[package]]
name = "ironrdp-svc"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"bitflags 2.6.0",
"ironrdp-pdu",
@ -2409,7 +2394,6 @@ dependencies = [
[[package]]
name = "ironrdp-tokio"
version = "0.1.0"
source = "git+https://github.com/Devolutions/IronRDP#abc0ee0617fcdcda3f0ace3ffd292251979d1910"
dependencies = [
"bytes",
"ironrdp-async",
@ -3463,10 +3447,8 @@ dependencies = [
"keycodemap",
"pixman-sys",
"qemu-display",
"rustls 0.21.12",
"rustls-pemfile",
"tokio",
"tokio-rustls 0.24.1",
"tracing",
"tracing-subscriber",
]
@ -3799,18 +3781,6 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "rustls"
version = "0.21.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [
"log 0.4.22",
"ring",
"rustls-webpki 0.101.7",
"sct",
]
[[package]]
name = "rustls"
version = "0.23.11"
@ -3821,18 +3791,19 @@ dependencies = [
"log 0.4.22",
"once_cell",
"rustls-pki-types",
"rustls-webpki 0.102.6",
"rustls-webpki",
"subtle",
"zeroize",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.4"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
dependencies = [
"base64 0.21.7",
"base64 0.22.1",
"rustls-pki-types",
]
[[package]]
@ -3841,16 +3812,6 @@ version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d"
[[package]]
name = "rustls-webpki"
version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "rustls-webpki"
version = "0.102.6"
@ -3887,16 +3848,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "sct"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "sec1"
version = "0.7.3"
@ -4419,23 +4370,13 @@ dependencies = [
"syn 2.0.72",
]
[[package]]
name = "tokio-rustls"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
"rustls 0.21.12",
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
dependencies = [
"rustls 0.23.11",
"rustls",
"rustls-pki-types",
"tokio",
]

View File

@ -13,11 +13,13 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
keycodemap = { path = "../keycodemap" }
bytes = "1.6"
pixman-sys = "0.1.0"
rustls = { version = "0.21" }
rustls-pemfile = "1.0"
rustls-pemfile = "2.1"
tokio = { version = "1.37", features = ["full"] }
tokio-rustls = "0.24"
anyhow = "1.0"
clap = { version = "4.5", features = ["derive", "cargo"] }
async-trait = "0.1"
ironrdp = { git = "https://github.com/Devolutions/IronRDP", features = ["server", "svc", "cliprdr"] }
ironrdp = { git = "https://github.com/Devolutions/IronRDP", features = [
"server",
"svc",
"cliprdr",
] }

View File

@ -2,12 +2,12 @@ mod clipboard;
mod display;
mod input;
use anyhow::Error;
use anyhow::{anyhow, Context, Error};
use ironrdp::server::tokio_rustls::{rustls, TlsAcceptor};
use qemu_display::zbus;
use rustls::ServerConfig;
use rustls_pemfile::{certs, pkcs8_private_keys};
use std::{fs::File, io::BufReader, sync::Arc};
use tokio_rustls::TlsAcceptor;
use ironrdp::server::RdpServer;
@ -33,7 +33,8 @@ impl Server {
.cert
.as_ref()
.zip(self.args.key.as_ref())
.map(|(cert, key)| acceptor(cert, key).unwrap());
.map(|(cert, key)| acceptor(cert, key).unwrap())
.ok_or_else(|| anyhow!("Failed to setup TLS"))?;
let handler = InputHandler::connect(self.dbus.clone()).await?;
let display = DisplayHandler::connect(self.dbus.clone()).await?;
@ -41,7 +42,7 @@ impl Server {
let mut server = RdpServer::builder()
.with_addr((self.args.address, self.args.port))
.with_tls(tls.unwrap())
.with_tls(tls)
.with_input_handler(handler)
.with_display_handler(display)
.with_cliprdr_factory(Some(Box::new(clipboard)))
@ -52,13 +53,17 @@ impl Server {
}
fn acceptor(cert_path: &str, key_path: &str) -> Result<TlsAcceptor, Error> {
let cert = certs(&mut BufReader::new(File::open(cert_path)?))?[0].clone();
let key = pkcs8_private_keys(&mut BufReader::new(File::open(key_path)?))?[0].clone();
let cert = certs(&mut BufReader::new(File::open(cert_path)?))
.next()
.context("no certificate")??;
let key = pkcs8_private_keys(&mut BufReader::new(File::open(key_path)?))
.next()
.context("no private key")?
.map(rustls::pki_types::PrivateKeyDer::from)?;
let mut server_config = ServerConfig::builder()
.with_safe_defaults()
let mut server_config = rustls::ServerConfig::builder()
.with_no_client_auth()
.with_single_cert(vec![rustls::Certificate(cert)], rustls::PrivateKey(key))
.with_single_cert(vec![cert], key)
.expect("bad certificate/key");
// This adds support for the SSLKEYLOGFILE env variable (https://wiki.wireshark.org/TLS#using-the-pre-master-secret)