From 18077f830cd64b7a3d8365e0405a15a949e42bed Mon Sep 17 00:00:00 2001 From: iliana etaoin Date: Tue, 1 Nov 2022 22:18:08 -0700 Subject: [PATCH] end-to-end-tests: swap thrussh for russh --- Cargo.lock | 358 +++++++++++++++--------- Cargo.toml | 10 - end-to-end-tests/Cargo.toml | 4 +- end-to-end-tests/src/instance_launch.rs | 12 +- 4 files changed, 234 insertions(+), 150 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4b9b27b698..38281e89067 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,17 +27,39 @@ dependencies = [ "heapless", ] +[[package]] +name = "aead" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aes" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" dependencies = [ "cfg-if 1.0.0", - "cipher", + "cipher 0.4.3", "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" +dependencies = [ + "aead 0.5.1", + "aes", + "cipher 0.4.3", "ctr", - "opaque-debug", + "ghash", + "subtle", ] [[package]] @@ -96,7 +118,7 @@ checksum = "db4ce4441f99dbd377ca8a8f57b698c44d0d6e712d8329b5040da5a64aa1ce73" dependencies = [ "base64ct", "blake2", - "password-hash 0.4.2", + "password-hash", ] [[package]] @@ -285,7 +307,7 @@ checksum = "12621b8e87feb183a6e5dbb315e49026b2229c4398797ee0ae2d1bc00aef41b9" dependencies = [ "blowfish", "crypto-mac", - "pbkdf2", + "pbkdf2 0.8.0", "sha2 0.9.9", "zeroize", ] @@ -416,21 +438,14 @@ dependencies = [ ] [[package]] -name = "block-modes" -version = "0.8.1" +name = "block-padding" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb03d1bed155d89dce0f845b7899b18a9a163e148fd004e1c28421a783e2d8e" +checksum = "0a90ec2df9600c28a01c56c4784c9207a96d2451833aeceb8cc97e4c9548bb78" dependencies = [ - "block-padding", - "cipher", + "generic-array", ] -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - [[package]] name = "blowfish" version = "0.8.0" @@ -438,7 +453,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe3ff3fc1de48c1ac2e3341c4df38b0d1bfb8fdf04632a187c8b75aaa319a7ab" dependencies = [ "byteorder", - "cipher", + "cipher 0.3.0", "opaque-debug", ] @@ -533,6 +548,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher 0.4.3", +] + [[package]] name = "cc" version = "1.0.73" @@ -567,21 +591,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ "cfg-if 1.0.0", - "cipher", + "cipher 0.3.0", "cpufeatures", "zeroize", ] +[[package]] +name = "chacha20" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fc89c7c5b9e7a02dfe45cd2367bae382f9ed31c61ca8debe5f827c420a2f08" +dependencies = [ + "cfg-if 1.0.0", + "cipher 0.4.3", + "cpufeatures", +] + [[package]] name = "chacha20poly1305" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", + "aead 0.4.3", + "chacha20 0.8.2", + "cipher 0.3.0", + "poly1305 0.7.2", "zeroize", ] @@ -637,6 +672,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "cipher" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clang-sys" version = "1.4.0" @@ -1049,6 +1094,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] @@ -1062,16 +1108,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "cryptovec" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc7fa13a6bbb2322d325292c57f4c8e7291595506f8289968a0eb61c3130bdf" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "cstr-argument" version = "0.1.2" @@ -1084,11 +1120,11 @@ dependencies = [ [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.3", ] [[package]] @@ -1606,8 +1642,8 @@ dependencies = [ "oxide-client", "rand 0.8.5", "reqwest", - "thrussh", - "thrussh-keys", + "russh", + "russh-keys", "tokio", ] @@ -2021,6 +2057,16 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "ghash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "gimli" version = "0.26.2" @@ -2170,6 +2216,12 @@ dependencies = [ "serde", ] +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + [[package]] name = "hkdf" version = "0.12.3" @@ -2445,6 +2497,16 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adab1eaa3408fb7f0c777a73e7465fd5656136fc93b670eb6df3c88c2c1344e3" +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "block-padding", + "generic-array", +] + [[package]] name = "instant" version = "0.1.12" @@ -2648,17 +2710,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "libsodium-sys" -version = "0.2.8" -source = "git+https://github.com/oxidecomputer/sodiumoxide?branch=oxide/omicron#c2546d157fe62f762300b129a2adcfdfb3bb0503" -dependencies = [ - "cc", - "libc", - "pkg-config", - "walkdir", -] - [[package]] name = "libsqlite3-sys" version = "0.25.1" @@ -3064,6 +3115,7 @@ dependencies = [ "autocfg", "num-integer", "num-traits", + "rand 0.8.5", ] [[package]] @@ -3879,17 +3931,6 @@ dependencies = [ "syn", ] -[[package]] -name = "password-hash" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e0b28ace46c5a396546bcf443bf422b57049617433d8854227352a4a9b24e7" -dependencies = [ - "base64ct", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "password-hash" version = "0.4.2" @@ -3931,11 +3972,19 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" dependencies = [ - "base64ct", "crypto-mac", - "hmac 0.11.0", - "password-hash 0.2.3", - "sha2 0.9.9", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.5", + "hmac 0.12.1", + "password-hash", + "sha2 0.10.6", ] [[package]] @@ -4142,7 +4191,30 @@ checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ "cpufeatures", "opaque-debug", - "universal-hash", + "universal-hash 0.4.1", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash 0.5.0", +] + +[[package]] +name = "polyval" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "opaque-debug", + "universal-hash 0.5.0", ] [[package]] @@ -4851,6 +4923,85 @@ dependencies = [ "regex", ] +[[package]] +name = "russh" +version = "0.34.0-beta.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a47850d2711f53330077c1ca72f7f326ec1658b68add7dbc22c384731b6adb" +dependencies = [ + "aes", + "aes-gcm", + "bitflags", + "byteorder", + "chacha20 0.9.0", + "ctr", + "curve25519-dalek", + "digest 0.10.5", + "flate2", + "futures", + "generic-array", + "hex-literal", + "hmac 0.12.1", + "log", + "num-bigint", + "once_cell", + "poly1305 0.8.0", + "rand 0.8.5", + "russh-cryptovec", + "russh-keys", + "sha1", + "sha2 0.10.6", + "subtle", + "thiserror", + "tokio", +] + +[[package]] +name = "russh-cryptovec" +version = "0.7.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89fd30a2ef98dfa621409d5bc56a2479d5810bf13a5eea3de89d859437b7e2e" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "russh-keys" +version = "0.22.0-beta.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "522f33fe55f03f9a13560533183553552ef12d4383019bac74101e3c9b34f358" +dependencies = [ + "aes", + "bcrypt-pbkdf", + "bit-vec", + "block-padding", + "byteorder", + "cbc", + "ctr", + "data-encoding", + "dirs", + "ed25519-dalek", + "futures", + "hmac 0.12.1", + "inout", + "log", + "md5", + "num-bigint", + "num-integer", + "pbkdf2 0.11.0", + "rand 0.7.3", + "rand_core 0.5.1", + "russh-cryptovec", + "serde", + "serde_derive", + "sha2 0.10.6", + "thiserror", + "tokio", + "tokio-stream", + "yasna", +] + [[package]] name = "rust-argon2" version = "1.0.0" @@ -6073,73 +6224,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "thrussh" -version = "0.33.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6540238a9adf83df6e66541c182a52acf892ab335595ca965c229ade8536f8" -dependencies = [ - "bitflags", - "byteorder", - "cryptovec", - "digest 0.9.0", - "flate2", - "futures", - "generic-array", - "log", - "rand 0.8.5", - "sha2 0.9.9", - "thiserror", - "thrussh-keys", - "thrussh-libsodium", - "tokio", -] - -[[package]] -name = "thrussh-keys" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a72cc51a2932b18d92f7289332d8564cec4a5014063722a9d3fdca52c5d8f5ab" -dependencies = [ - "aes", - "bcrypt-pbkdf", - "bit-vec", - "block-modes", - "byteorder", - "cryptovec", - "data-encoding", - "dirs", - "futures", - "hmac 0.11.0", - "log", - "md5", - "num-bigint", - "num-integer", - "pbkdf2", - "rand 0.8.5", - "serde", - "serde_derive", - "sha2 0.9.9", - "thiserror", - "thrussh-libsodium", - "tokio", - "tokio-stream", - "yasna", -] - -[[package]] -name = "thrussh-libsodium" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe89c70d27b1cb92e13bc8af63493e890d0de46dae4df0e28233f62b4ed9500" -dependencies = [ - "lazy_static", - "libc", - "libsodium-sys", - "pkg-config", - "vcpkg", -] - [[package]] name = "time" version = "0.1.44" @@ -6670,6 +6754,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "universal-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "untrusted" version = "0.7.1" diff --git a/Cargo.toml b/Cargo.toml index a39a84bfbda..9b5256357e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,13 +131,3 @@ panic = "abort" [patch.crates-io.pq-sys] git = 'https://github.com/oxidecomputer/pq-sys' branch = "oxide/omicron" - -# -# libsodium-sys is a dependency of thrussh, used in `end-to-end-tests`. We -# maintain a fork of the sodiumoxide repository to address an illumos build -# issue. See the README.oxide.md in the "omicron/oxide" branch of our fork for -# details. -# -[patch.crates-io.libsodium-sys] -git = 'https://github.com/oxidecomputer/sodiumoxide' -branch = "oxide/omicron" diff --git a/end-to-end-tests/Cargo.toml b/end-to-end-tests/Cargo.toml index 94271c31fe4..7098d3337b2 100644 --- a/end-to-end-tests/Cargo.toml +++ b/end-to-end-tests/Cargo.toml @@ -13,6 +13,6 @@ omicron-test-utils = { path = "../test-utils" } oxide-client = { path = "../oxide-client" } rand = "0.8.5" reqwest = { version = "0.11.11", default-features = false } -thrussh = "0.33.5" -thrussh-keys = "0.21.0" +russh = "0.34.0-beta.16" +russh-keys = "0.22.0-beta.7" tokio = { version = "1.20.0", features = ["macros", "rt-multi-thread"] } diff --git a/end-to-end-tests/src/instance_launch.rs b/end-to-end-tests/src/instance_launch.rs index bbb5ff09473..d013b71b378 100644 --- a/end-to-end-tests/src/instance_launch.rs +++ b/end-to-end-tests/src/instance_launch.rs @@ -12,11 +12,11 @@ use oxide_client::types::{ use oxide_client::{ ClientDisksExt, ClientInstancesExt, ClientSessionExt, ClientSystemExt, }; +use russh::{client::Session, ChannelMsg, Disconnect}; +use russh_keys::key::{KeyPair, PublicKey}; +use russh_keys::PublicKeyBase64; use std::sync::Arc; use std::time::Duration; -use thrussh::{client::Session, ChannelMsg, Disconnect}; -use thrussh_keys::key::{KeyPair, PublicKey}; -use thrussh_keys::PublicKeyBase64; use tokio::time::sleep; #[tokio::test] @@ -157,9 +157,9 @@ async fn instance_launch() -> Result<()> { PublicKey::parse(b"ssh-ed25519", &base64::decode(host_key)?)?; eprintln!("connecting ssh"); - let mut session = thrussh::client::connect( + let mut session = russh::client::connect( Default::default(), - (ip_addr, 22), + (ip_addr, 22).into(), SshClient { host_key }, ) .await?; @@ -253,7 +253,7 @@ struct SshClient { host_key: PublicKey, } -impl thrussh::client::Handler for SshClient { +impl russh::client::Handler for SshClient { type Error = anyhow::Error; type FutureUnit = Ready>; type FutureBool = Ready>;