From c46470f95ff6d82264b690db67e52f28bedba792 Mon Sep 17 00:00:00 2001 From: Isaiah Becker-Mayer Date: Wed, 27 Mar 2024 08:59:35 -0500 Subject: [PATCH 1/2] Updates RUST_VERSION and IronRDP rev to latest, adds RUST_MIN_STACK to fix ARM builds --- Cargo.lock | 57 +++++++++------------ Cargo.toml | 20 ++++---- build.assets/versions.mk | 2 +- lib/srv/desktop/rdp/rdpclient/src/client.rs | 18 ++++--- web/packages/teleport/README.md | 8 +++ web/packages/teleport/package.json | 4 +- 6 files changed, 58 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9b90f36bce8a..0c381681372a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -87,9 +87,9 @@ dependencies = [ [[package]] name = "asn1-rs" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" +checksum = "22ad1373757efa0f70ec53939aabc7152e1591cb485208052993070ac8d2429d" dependencies = [ "asn1-rs-derive", "asn1-rs-impl", @@ -102,25 +102,25 @@ dependencies = [ [[package]] name = "asn1-rs-derive" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", "synstructure", ] [[package]] name = "asn1-rs-impl" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] @@ -579,9 +579,9 @@ dependencies = [ [[package]] name = "der-parser" -version = "8.2.0" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" +checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" dependencies = [ "asn1-rs", "displaydoc", @@ -1225,7 +1225,7 @@ dependencies = [ [[package]] name = "ironrdp-async" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "bytes", "ironrdp-connector", @@ -1236,7 +1236,7 @@ dependencies = [ [[package]] name = "ironrdp-cliprdr" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "bitflags 2.5.0", "ironrdp-pdu", @@ -1248,7 +1248,7 @@ dependencies = [ [[package]] name = "ironrdp-connector" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "ironrdp-error", "ironrdp-pdu", @@ -1263,12 +1263,12 @@ dependencies = [ [[package]] name = "ironrdp-error" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" [[package]] name = "ironrdp-graphics" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "bit_field", "bitflags 2.5.0", @@ -1285,7 +1285,7 @@ dependencies = [ [[package]] name = "ironrdp-pdu" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "bit_field", "bitflags 2.5.0", @@ -1307,7 +1307,7 @@ dependencies = [ [[package]] name = "ironrdp-rdpdr" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "bitflags 2.5.0", "ironrdp-error", @@ -1319,7 +1319,7 @@ dependencies = [ [[package]] name = "ironrdp-rdpsnd" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "ironrdp-pdu", "ironrdp-svc", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "ironrdp-session" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "bitflags 2.5.0", "ironrdp-connector", @@ -1342,7 +1342,7 @@ dependencies = [ [[package]] name = "ironrdp-svc" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "bitflags 2.5.0", "ironrdp-pdu", @@ -1351,7 +1351,7 @@ dependencies = [ [[package]] name = "ironrdp-tls" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "tokio", "tokio-rustls", @@ -1361,7 +1361,7 @@ dependencies = [ [[package]] name = "ironrdp-tokio" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=c944674ecbb0952f9e7ecb964a6c79cdca669a08#c944674ecbb0952f9e7ecb964a6c79cdca669a08" +source = "git+https://github.com/Devolutions/IronRDP?rev=a1d8bb246e69af3252dcae38497f495100775c93#a1d8bb246e69af3252dcae38497f495100775c93" dependencies = [ "bytes", "ironrdp-async", @@ -2664,14 +2664,13 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", - "unicode-xid", + "syn 2.0.39", ] [[package]] @@ -2990,12 +2989,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "untrusted" version = "0.9.0" diff --git a/Cargo.toml b/Cargo.toml index c98ec9bd3f260..714161a66ed70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,13 +23,13 @@ codegen-units = 1 [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 = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } -ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } -ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } -ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } -ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } -ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } -ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } -ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } -ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08", features = ["rustls"]} -ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" } +ironrdp-cliprdr = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } +ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } +ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } +ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } +ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } +ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } +ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } +ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } +ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93", features = ["rustls"]} +ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "a1d8bb246e69af3252dcae38497f495100775c93" } diff --git a/build.assets/versions.mk b/build.assets/versions.mk index dbbd881ae56db..3b520b2989879 100644 --- a/build.assets/versions.mk +++ b/build.assets/versions.mk @@ -9,7 +9,7 @@ GOLANGCI_LINT_VERSION ?= v1.57.1 NODE_VERSION ?= 20.11.1 # Run lint-rust check locally before merging code after you bump this. -RUST_VERSION ?= 1.71.1 +RUST_VERSION ?= 1.77.0 WASM_PACK_VERSION ?= 0.12.1 LIBBPF_VERSION ?= 1.2.2 LIBPCSCLITE_VERSION ?= 1.9.9-teleport diff --git a/lib/srv/desktop/rdp/rdpclient/src/client.rs b/lib/srv/desktop/rdp/rdpclient/src/client.rs index c63c5bf4796e6..3c394fa2c7022 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/client.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/client.rs @@ -33,7 +33,7 @@ use ironrdp_pdu::input::{InputEventError, MousePdu}; use ironrdp_pdu::mcs::DisconnectReason; use ironrdp_pdu::rdp::capability_sets::MajorPlatformType; use ironrdp_pdu::rdp::RdpError; -use ironrdp_pdu::{custom_err, function, PduError, PduParsing}; +use ironrdp_pdu::{custom_err, function, PduError}; use ironrdp_rdpdr::pdu::efs::ClientDeviceListAnnounce; use ironrdp_rdpdr::pdu::RdpdrPdu; use ironrdp_rdpdr::Rdpdr; @@ -209,6 +209,7 @@ impl Client { connection_result.io_channel_id, None, None, + connection_result.connection_activation, ); Ok(Self { @@ -322,6 +323,13 @@ impl Client { ProcessorOutput::Disconnect(reason) => { return Ok(Some(reason)); } + ProcessorOutput::DeactivateAll(_) => { + // DeactivateAll is not implemented yet, but will + // be in the near future when resize support lands. + return Err(ClientError::InternalError( + "DeactivateAll not implemented".to_string(), + )); + } } } } @@ -540,11 +548,9 @@ impl Client { write_stream: &mut RdpWriteStream, event: FastPathInputEvent, ) -> ClientResult<()> { - let mut data: Vec = Vec::new(); - let input_pdu = FastPathInput(vec![event]); - input_pdu.to_buffer(&mut data)?; - - write_stream.write_all(&data).await?; + write_stream + .write_all(&ironrdp_pdu::encode_vec(&FastPathInput(vec![event]))?) + .await?; Ok(()) } diff --git a/web/packages/teleport/README.md b/web/packages/teleport/README.md index 67d18582bf682..c87f9f1b48255 100644 --- a/web/packages/teleport/README.md +++ b/web/packages/teleport/README.md @@ -10,3 +10,11 @@ then you can start your local development server: ``` $ yarn run start --target=https://example.com:3080/web ``` + +#### wasm-pack + +The [`wasm-pack`](https://github.com/rustwasm/wasm-pack) version in [build.assets/Makefile](https://github.com/gravitational/teleport/blob/master/build.assets/versions.mk#L12) (search for `WASM_PACK_VERSION`) is required to build the WebAssembly module. + +When calling `wasm-pack`, we set the environment variable `RUST_MIN_STACK=16777216`. This is necessary to avoid a `SIGSEGV` error when building the module on some systems. + +`16777216` was chosen based on [the suggestion in the rust compiler error message](https://github.com/rust-lang/rust/blob/10a7aa14fed9b528b74b0f098c4899c37c09a9c7/compiler/rustc_driver_impl/src/signal_handler.rs#L104-L106) to double the [`DEFAULT_STACK_SIZE`](https://github.com/rust-lang/rust/blob/10a7aa14fed9b528b74b0f098c4899c37c09a9c7/compiler/rustc_interface/src/util.rs#L52) value. diff --git a/web/packages/teleport/package.json b/web/packages/teleport/package.json index 10f776e488665..3069d7789f798 100644 --- a/web/packages/teleport/package.json +++ b/web/packages/teleport/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "start": "yarn build-wasm && vite", - "build-wasm": "wasm-pack build ./src/ironrdp --target web", + "build-wasm": "RUST_MIN_STACK=16777216 wasm-pack build ./src/ironrdp --target web", "build": "yarn build-wasm && vite build", "test": "npx jest", "tdd": "jest . --watch" @@ -35,4 +35,4 @@ "jest-websocket-mock": "^2.5.0", "ts-loader": "^9.4.2" } -} \ No newline at end of file +} From 5a019868d2fddfad95673d30c6560127f5a5d244 Mon Sep 17 00:00:00 2001 From: Isaiah Becker-Mayer Date: Wed, 27 Mar 2024 11:40:00 -0500 Subject: [PATCH 2/2] Adds asn1-rs, asn1-rs-derive, asn1-rs-impl, and der-parser to the allow-dependencies-licenses. This is required because their crates do not currently have valid SPDX licenses, see https://github.com/gravitational/teleport/actions/runs/8453649354/job/23156810330?pr=39895 --- .github/workflows/dependency-review.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yaml b/.github/workflows/dependency-review.yaml index cf1d6b93d4272..aa4ac1ddb7944 100644 --- a/.github/workflows/dependency-review.yaml +++ b/.github/workflows/dependency-review.yaml @@ -13,4 +13,12 @@ jobs: with: base-ref: ${{ github.event.pull_request.base.sha || 'master' }} allow-ghsas: 'GHSA-xwh9-gc39-5298' - allow-dependencies-licenses: 'pkg:cargo/curve25519-dalek-derive, pkg:cargo/ring, pkg:cargo/sspi, pkg:cargo/tokio-boring' + allow-dependencies-licenses: >- + pkg:cargo/curve25519-dalek-derive, + pkg:cargo/ring, + pkg:cargo/sspi, + pkg:cargo/tokio-boring, + pkg:cargo/asn1-rs, + pkg:cargo/asn1-rs-derive, + pkg:cargo/asn1-rs-impl, + pkg:cargo/der-parser