Skip to content
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
459 changes: 383 additions & 76 deletions Cargo.lock

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ lto = "thin"
[workspace.dependencies]
# Note: To use a local IronRDP repository as a crate (for example, ironrdp-cliprdr), define the dependency as follows:
# ironrdp-cliprdr = { path = "/path/to/local/IronRDP/crates/ironrdp-cliprdr" }
ironrdp-cliprdr = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-core = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-displaycontrol = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-dvc = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2", features = [
ironrdp-cliprdr = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-core = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-displaycontrol = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-dvc = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }
ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d", features = [
"rustls",
] }
ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "dd221bf22401c4635798ec012724cba7e6d503b2" }
ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "a0a3e750c9e4ee9c73b957fbcb26dbc59e57d07d" }

26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ bpf-bytecode:
endif

.PHONY: rdpclient
rdpclient:
rdpclient: rustup-toolchain-warning
ifeq ("$(with_rdpclient)", "yes")
$(RDPCLIENT_ENV) \
cargo build -p rdp-client $(if $(FIPS),--features=fips) --release --locked $(CARGO_TARGET)
Expand All @@ -504,7 +504,7 @@ export ironrdp_package_json
.PHONY: build-ironrdp-wasm
build-ironrdp-wasm: ironrdp = web/packages/shared/libs/ironrdp
build-ironrdp-wasm: ensure-wasm-deps
cargo build --package ironrdp --lib --target $(CARGO_WASM_TARGET) --release
RUSTFLAGS='--cfg getrandom_backend="wasm_js"' cargo build --package ironrdp --lib --target $(CARGO_WASM_TARGET) --release
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New rustflag required by getrandom for wasm targets.
https://docs.rs/getrandom/latest/getrandom/#opt-in-backends

wasm-opt target/$(CARGO_WASM_TARGET)/release/ironrdp.wasm -o target/$(CARGO_WASM_TARGET)/release/ironrdp.wasm -O
wasm-bindgen target/$(CARGO_WASM_TARGET)/release/ironrdp.wasm --out-dir $(ironrdp)/pkg --typescript --target web
printenv ironrdp_package_json > $(ironrdp)/pkg/package.json
Expand Down Expand Up @@ -1866,7 +1866,7 @@ ensure-js-deps:
ifeq ($(WEBASSETS_SKIP_BUILD),1)
ensure-wasm-deps:
else
ensure-wasm-deps: ensure-wasm-bindgen ensure-wasm-opt
ensure-wasm-deps: rustup-toolchain-warning ensure-wasm-bindgen ensure-wasm-opt

WASM_BINDGEN_VERSION = $(shell awk ' \
$$1 == "name" && $$3 == "\"wasm-bindgen\"" { in_pkg=1; next } \
Expand Down Expand Up @@ -1923,6 +1923,26 @@ rustup-set-version: ; # obsoleted by toolchain file
rustup-install-target-toolchain:
rustup target add $(RUST_TARGET_ARCH)


define rust_toolchain_warning
The active Rust toolchain version does not match the toolchain required
to build Teleport. This is likely caused by a directory override. You
can inspect your current overrides with 'rustup show active-toolchain'
and clear directory overrides with 'rustup override unset'
endef
export rust_toolchain_warning

# inspect the current active toolchain and display a warning if it doesn't
# match the version defined in our toolchain file.
.PHONY: rustup-toolchain-warning
rustup-toolchain-warning: EXPECTED = $(shell $(MAKE) print-rust-toolchain-version)
rustup-toolchain-warning:
@if [ "$(shell rustup show active-toolchain | cut -d'-' -f1)" != "$(EXPECTED)" ]; then \
echo -en "\033[31m";\
echo "$$rust_toolchain_warning";\
echo -en "\033[0m";\
fi

# changelog generates PR changelog between the provided base tag and the tip of
# the specified branch.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/srv/desktop/rdp/rdpclient/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tokio-boring = { git = "https://github.com/gravitational/boring", rev = "9989730
utf16string = "0.2.0"
uuid = { version = "1.16.0", features = ["v4"] }
url = "2.5.7"
picky = { version = "7.0.0-rc.11", default-features = false }
picky = { version = "7.0.0-rc.17", default-features = false }
picky-asn1-der = "0.5.2"
picky-asn1-x509 = "0.14.6"
reqwest = { version = "0.12", default-features = false }
Expand Down
31 changes: 20 additions & 11 deletions lib/srv/desktop/rdp/rdpclient/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ use ironrdp_pdu::input::fast_path::{
use ironrdp_pdu::input::mouse::PointerFlags;
use ironrdp_pdu::input::{InputEventError, MousePdu};
use ironrdp_pdu::nego::NegoRequestData;
use ironrdp_pdu::rdp::capability_sets::MajorPlatformType;
use ironrdp_pdu::rdp::client_info::PerformanceFlags;
use ironrdp_pdu::rdp::capability_sets::{
client_codecs_capabilities, BitmapCodecs, MajorPlatformType,
};
use ironrdp_pdu::rdp::client_info::{PerformanceFlags, TimezoneInfo};
use ironrdp_pdu::rdp::RdpError;
use ironrdp_pdu::PduError;
use ironrdp_pdu::PduResult;
Expand All @@ -60,7 +62,7 @@ use ironrdp_session::SessionErrorKind::Reason;
use ironrdp_session::{reason_err, SessionError, SessionResult};
use ironrdp_svc::{SvcMessage, SvcProcessor, SvcProcessorMessages};
use ironrdp_tokio::{single_sequence_step_read, Framed, FramedWrite, TokioStream};
use log::debug;
use log::{debug, error};
use rand::{Rng, TryRngCore};
use std::error::Error;
use std::fmt::{Debug, Display, Formatter};
Expand Down Expand Up @@ -195,11 +197,11 @@ impl Client {
});
let drdynvc_client = DrdynvcClient::new().with_dynamic_channel(display_control);

let mut connector = ironrdp_connector::ClientConnector::new(connector_config.clone())
.with_server_addr(server_socket_addr)
.with_static_channel(drdynvc_client) // require for resizing
.with_static_channel(Rdpsnd::new(Box::new(NoopRdpsndBackend {}))) // required for rdpdr to work
.with_static_channel(rdpdr); // required for smart card + directory sharing
let mut connector =
ironrdp_connector::ClientConnector::new(connector_config.clone(), server_socket_addr)
.with_static_channel(drdynvc_client) // require for resizing
.with_static_channel(Rdpsnd::new(Box::new(NoopRdpsndBackend {}))) // required for rdpdr to work
.with_static_channel(rdpdr); // required for smart card + directory sharing

if params.allow_clipboard {
connector = connector.with_static_channel(Cliprdr::new(Box::new(
Expand Down Expand Up @@ -377,7 +379,6 @@ impl Client {
&mut read_stream,
sequence.as_mut(),
&mut buf,
None,
)
.await?;

Expand Down Expand Up @@ -671,7 +672,7 @@ impl Client {
event: FastPathInputEvent,
) -> ClientResult<()> {
write_stream
.write_all(&encode_vec(&FastPathInput(vec![event]))?)
.write_all(&encode_vec(&FastPathInput::single(event))?)
.await?;
Ok(())
}
Expand Down Expand Up @@ -1387,6 +1388,8 @@ fn create_config(params: &ConnectParams, pin: String, cgo_handle: CgoHandle) ->
},
enable_tls: true,
enable_credssp: params.ad && params.nla,
enable_audio_playback: false,
timezone_info: TimezoneInfo::default(),
credentials: Credentials::SmartCard {
config: params.ad.then(|| SmartCardIdentity {
csp_name: "Microsoft Base Smart Card Crypto Provider".to_string(),
Expand All @@ -1413,13 +1416,19 @@ fn create_config(params: &ConnectParams, pin: String, cgo_handle: CgoHandle) ->
// Changing this to 16 gets us uncompressed bitmaps on machines configured like
// https://github.com/Devolutions/IronRDP/blob/55d11a5000ebd474c2ddc294b8b3935554443112/README.md?plain=1#L17-L36
color_depth: 32,
// Try to configure the client to use remotefx only. This should never fail in practice, but just in
// case we'll log an error and fall back to defaults.
codecs: client_codecs_capabilities(&["remotefx"]).unwrap_or_else(|err| {
error!("Failed to configure client for remotefx: {}", err);
BitmapCodecs::default()
}),
}),
dig_product_id: "".to_string(),
// `client_dir` is apparently unimportant, however most RDP clients hardcode this value (including FreeRDP):
// https://github.com/FreeRDP/FreeRDP/blob/4e24b966c86fdf494a782f0dfcfc43a057a2ea60/libfreerdp/core/settings.c#LL49C34-L49C70
client_dir: "C:\\Windows\\System32\\mstscax.dll".to_string(),
platform: MajorPlatformType::UNSPECIFIED,
no_server_pointer: false,
enable_server_pointer: true,
autologon: true,
pointer_software_rendering: false,
// Send the username in the request cookie, which is sent in the initial connection request.
Expand Down
2 changes: 2 additions & 0 deletions lib/srv/desktop/rdp/rdpclient/src/cliprdr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ impl CliprdrBackend for TeleportCliprdrBackend {
".cliprdr"
}

fn on_ready(&mut self) {}

fn client_capabilities(&self) -> ClipboardGeneralCapabilityFlags {
trace!("CLIPRDR: client_capabilities");
ClipboardGeneralCapabilityFlags::USE_LONG_FORMAT_NAMES
Expand Down
2 changes: 1 addition & 1 deletion lib/srv/desktop/rdp/rdpclient/src/rdpdr/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl UnixPath {
}

pub fn last(&self) -> Option<&str> {
self.path.split('/').last()
self.path.split('/').next_back()
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.81.0"
channel = "1.86.0"
targets = [ "wasm32-unknown-unknown" ]
18 changes: 1 addition & 17 deletions web/packages/shared/components/CanvasRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,5 @@ function makeBitmapFrameRenderer(
): (frame: BitmapFrame) => void {
const ctx = canvas.getContext('2d');

// Buffered rendering logic
let bitmapBuffer: BitmapFrame[] = [];
const renderBuffer = () => {
if (bitmapBuffer.length) {
for (let i = 0; i < bitmapBuffer.length; i++) {
if (bitmapBuffer[i].image_data.data.length != 0) {
const bmpFrame = bitmapBuffer[i];
ctx.putImageData(bmpFrame.image_data, bmpFrame.left, bmpFrame.top);
}
}
bitmapBuffer = [];
}
requestAnimationFrame(renderBuffer);
};
requestAnimationFrame(renderBuffer);

return frame => bitmapBuffer.push(frame);
return frame => ctx.putImageData(frame.image_data, frame.left, frame.top);
}
3 changes: 2 additions & 1 deletion web/packages/shared/libs/ironrdp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ crate-type = ["cdylib"]

[dependencies]
console_error_panic_hook = "0.1.7"
getrandom = { version = "0.2", features = ["js"] }
getrandom1 = { package = "getrandom", version = "0.2", features = ["js"] }
getrandom2 = { package = "getrandom", version = "0.3", features = ["wasm_js"]}
ironrdp-session.workspace = true
ironrdp-pdu.workspace = true
ironrdp-core.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion web/packages/shared/libs/ironrdp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl FastPathProcessor {
user_channel_id,
// These should be set to the same values as they're set to in the
// `Config` object in lib/srv/desktop/rdp/rdpclient/src/client.rs.
no_server_pointer: false,
enable_server_pointer: true,
pointer_software_rendering: false,
}
.build(),
Expand Down
Loading