bumped russh to 0.44

This commit is contained in:
Eugene 2024-07-18 09:49:04 +02:00
parent ebb6956b82
commit 0ed2104974
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
13 changed files with 31 additions and 35 deletions

11
Cargo.lock generated
View file

@ -3729,9 +3729,9 @@ dependencies = [
[[package]] [[package]]
name = "russh" name = "russh"
version = "0.44.0-beta.5" version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f5827ad9882c902e17911af4db2995bf6247e333f6615668a39df31d94262cd" checksum = "69d007dc79831fd2bbe5a388daa13fa48c5d2c6f6ceb74a08b13fb1450c3468a"
dependencies = [ dependencies = [
"aes", "aes",
"aes-gcm", "aes-gcm",
@ -3781,9 +3781,9 @@ dependencies = [
[[package]] [[package]]
name = "russh-keys" name = "russh-keys"
version = "0.44.0-beta.5" version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e86b69bb1b6a00b3ce02a6d4e9152a4bc39350847e9170c19caa9bc3e363a608" checksum = "fb8c0bfe024d4edd242f65a2ac6c8bf38a892930050b9eb90909d8fc2c413c8d"
dependencies = [ dependencies = [
"aes", "aes",
"async-trait", "async-trait",
@ -5584,7 +5584,7 @@ dependencies = [
"poem", "poem",
"poem-openapi", "poem-openapi",
"regex", "regex",
"russh-keys", "russh",
"rust-embed", "rust-embed",
"sea-orm", "sea-orm",
"serde", "serde",
@ -5787,7 +5787,6 @@ dependencies = [
"ed25519-dalek", "ed25519-dalek",
"futures", "futures",
"russh", "russh",
"russh-keys",
"sea-orm", "sea-orm",
"thiserror", "thiserror",
"time", "time",

View file

@ -24,8 +24,7 @@ poem-openapi = { version = "2.0", features = [
"uuid", "uuid",
"static-files", "static-files",
] } ] }
russh-keys = { version = "0.44.0-beta.5", features = ["legacy-ed25519-pkcs8-parser"] } russh = { version = "0.44.0", features = ["legacy-ed25519-pkcs8-parser"] }
# russh-keys = { version = "0.23.0-beta.1", path = "../../russh/russh-keys" }
rust-embed = "8.3" rust-embed = "8.3"
sea-orm = { version = "0.12.2", features = [ sea-orm = { version = "0.12.2", features = [
"runtime-tokio-rustls", "runtime-tokio-rustls",

View file

@ -3,7 +3,7 @@ use std::sync::Arc;
use poem::web::Data; use poem::web::Data;
use poem_openapi::payload::Json; use poem_openapi::payload::Json;
use poem_openapi::{ApiResponse, Object, OpenApi}; use poem_openapi::{ApiResponse, Object, OpenApi};
use russh_keys::PublicKeyBase64; use russh::keys::PublicKeyBase64;
use serde::Serialize; use serde::Serialize;
use tokio::sync::Mutex; use tokio::sync::Mutex;
use warpgate_common::WarpgateConfig; use warpgate_common::WarpgateConfig;

View file

@ -14,10 +14,8 @@ dialoguer = "0.10"
curve25519-dalek = "4.0.0" # pin due to build fail on x86 curve25519-dalek = "4.0.0" # pin due to build fail on x86
ed25519-dalek = "2.0.0" # pin due to build fail on x86 in 2.1 ed25519-dalek = "2.0.0" # pin due to build fail on x86 in 2.1
futures = "0.3" futures = "0.3"
russh = { version = "0.44.0-beta.5" } russh = { version = "0.44.0", features = ["legacy-ed25519-pkcs8-parser"] }
# russh = { version = "0.35.0-beta.6", path = "../../russh/russh"} # russh = { version = "0.35.0-beta.6", path = "../../russh/russh"}
russh-keys = { version = "0.44.0-beta.5", features = ["legacy-ed25519-pkcs8-parser"] }
# russh-keys = { version = "0.23.0-beta.1", path = "../../russh/russh-keys" }
sea-orm = { version = "0.12.2", features = [ sea-orm = { version = "0.12.2", features = [
"runtime-tokio-rustls", "runtime-tokio-rustls",
], default-features = false } ], default-features = false }

View file

@ -1,8 +1,8 @@
use async_trait::async_trait; use async_trait::async_trait;
use russh::client::{Msg, Session}; use russh::client::{Msg, Session};
use russh::keys::key::PublicKey;
use russh::keys::PublicKeyBase64;
use russh::Channel; use russh::Channel;
use russh_keys::key::PublicKey;
use russh_keys::PublicKeyBase64;
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
use tokio::sync::oneshot; use tokio::sync::oneshot;
use tracing::*; use tracing::*;

View file

@ -16,8 +16,8 @@ pub use error::SshClientError;
use futures::pin_mut; use futures::pin_mut;
use handler::ClientHandler; use handler::ClientHandler;
use russh::client::Handle; use russh::client::Handle;
use russh::keys::key::PublicKey;
use russh::{kex, Preferred, Sig}; use russh::{kex, Preferred, Sig};
use russh_keys::key::PublicKey;
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}; use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
use tokio::sync::{oneshot, Mutex}; use tokio::sync::{oneshot, Mutex};
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
@ -47,7 +47,7 @@ pub enum ConnectionError {
Io(#[from] std::io::Error), Io(#[from] std::io::Error),
#[error(transparent)] #[error(transparent)]
Key(#[from] russh_keys::Error), Key(#[from] russh::keys::Error),
#[error(transparent)] #[error(transparent)]
Ssh(#[from] russh::Error), Ssh(#[from] russh::Error),

View file

@ -1,5 +1,5 @@
use russh_keys::key::KeyPair; use russh::keys::key::KeyPair;
use russh_keys::PublicKeyBase64; use russh::keys::PublicKeyBase64;
pub trait PublicKeyAsOpenSSH { pub trait PublicKeyAsOpenSSH {
fn as_openssh(&self) -> String; fn as_openssh(&self) -> String;

View file

@ -2,8 +2,8 @@ use std::fs::{create_dir_all, File};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use russh_keys::key::{KeyPair, SignatureHash}; use russh::keys::key::{KeyPair, SignatureHash};
use russh_keys::{encode_pkcs8_pem, load_secret_key}; use russh::keys::{encode_pkcs8_pem, load_secret_key};
use tracing::*; use tracing::*;
use warpgate_common::helpers::fs::{secure_directory, secure_file}; use warpgate_common::helpers::fs::{secure_directory, secure_file};
use warpgate_common::WarpgateConfig; use warpgate_common::WarpgateConfig;
@ -41,7 +41,7 @@ pub fn generate_host_keys(config: &WarpgateConfig) -> Result<()> {
Ok(()) Ok(())
} }
pub fn load_host_keys(config: &WarpgateConfig) -> Result<Vec<KeyPair>, russh_keys::Error> { pub fn load_host_keys(config: &WarpgateConfig) -> Result<Vec<KeyPair>, russh::keys::Error> {
let path = get_keys_path(config); let path = get_keys_path(config);
let mut keys = Vec::new(); let mut keys = Vec::new();
@ -90,7 +90,7 @@ pub fn generate_client_keys(config: &WarpgateConfig) -> Result<()> {
Ok(()) Ok(())
} }
pub fn load_client_keys(config: &WarpgateConfig) -> Result<Vec<KeyPair>, russh_keys::Error> { pub fn load_client_keys(config: &WarpgateConfig) -> Result<Vec<KeyPair>, russh::keys::Error> {
let path = get_keys_path(config); let path = get_keys_path(config);
let mut keys = Vec::new(); let mut keys = Vec::new();
@ -105,7 +105,7 @@ pub fn load_client_keys(config: &WarpgateConfig) -> Result<Vec<KeyPair>, russh_k
/// russh 0.43 has a bug that generates incorrect PKCS#8 encoding for Ed25519 keys /// russh 0.43 has a bug that generates incorrect PKCS#8 encoding for Ed25519 keys
/// This will preemptively try to correctly re-encode and save the key /// This will preemptively try to correctly re-encode and save the key
fn load_and_maybe_resave_ed25519_key<P: AsRef<Path>>(p: P) -> Result<KeyPair, russh_keys::Error> { fn load_and_maybe_resave_ed25519_key<P: AsRef<Path>>(p: P) -> Result<KeyPair, russh::keys::Error> {
let key = load_secret_key(&p, None)?; let key = load_secret_key(&p, None)?;
if let KeyPair::Ed25519(_) = &key { if let KeyPair::Ed25519(_) = &key {
if let Ok(f) = File::create(p) { if let Ok(f) = File::create(p) {

View file

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use russh_keys::key::PublicKey; use russh::keys::key::PublicKey;
use russh_keys::PublicKeyBase64; use russh::keys::PublicKeyBase64;
use sea_orm::{ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter}; use sea_orm::{ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter};
use tokio::sync::Mutex; use tokio::sync::Mutex;
use uuid::Uuid; use uuid::Uuid;

View file

@ -14,7 +14,7 @@ use async_trait::async_trait;
pub use client::*; pub use client::*;
pub use common::*; pub use common::*;
pub use keys::*; pub use keys::*;
use russh_keys::PublicKeyBase64; use russh::keys::PublicKeyBase64;
pub use server::run_server; pub use server::run_server;
use uuid::Uuid; use uuid::Uuid;
use warpgate_common::{ProtocolName, SshHostKeyVerificationMode, Target, TargetOptions}; use warpgate_common::{ProtocolName, SshHostKeyVerificationMode, Target, TargetOptions};

View file

@ -34,10 +34,10 @@ pub async fn run_server(services: Services, address: SocketAddr) -> Result<()> {
event_buffer_size: 100, event_buffer_size: 100,
preferred: Preferred { preferred: Preferred {
key: Cow::Borrowed(&[ key: Cow::Borrowed(&[
russh_keys::key::ED25519, russh::keys::key::ED25519,
russh_keys::key::RSA_SHA2_256, russh::keys::key::RSA_SHA2_256,
russh_keys::key::RSA_SHA2_512, russh::keys::key::RSA_SHA2_512,
russh_keys::key::SSH_RSA, russh::keys::key::SSH_RSA,
]), ]),
..<_>::default() ..<_>::default()
}, },

View file

@ -2,9 +2,9 @@ use std::fmt::Debug;
use async_trait::async_trait; use async_trait::async_trait;
use bytes::Bytes; use bytes::Bytes;
use russh::keys::key::PublicKey;
use russh::server::{Auth, Handle, Msg, Session}; use russh::server::{Auth, Handle, Msg, Session};
use russh::{Channel, ChannelId, Pty, Sig}; use russh::{Channel, ChannelId, Pty, Sig};
use russh_keys::key::PublicKey;
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
use tokio::sync::oneshot; use tokio::sync::oneshot;
use tracing::*; use tracing::*;
@ -181,7 +181,7 @@ impl russh::server::Handler for ServerHandler {
async fn auth_publickey_offered( async fn auth_publickey_offered(
&mut self, &mut self,
user: &str, user: &str,
key: &russh_keys::key::PublicKey, key: &russh::keys::key::PublicKey,
) -> Result<Auth, Self::Error> { ) -> Result<Auth, Self::Error> {
let user = Secret::new(user.to_string()); let user = Secret::new(user.to_string());
let (tx, rx) = oneshot::channel(); let (tx, rx) = oneshot::channel();
@ -205,7 +205,7 @@ impl russh::server::Handler for ServerHandler {
async fn auth_publickey( async fn auth_publickey(
&mut self, &mut self,
user: &str, user: &str,
key: &russh_keys::key::PublicKey, key: &russh::keys::key::PublicKey,
) -> Result<Auth, Self::Error> { ) -> Result<Auth, Self::Error> {
let user = Secret::new(user.to_string()); let user = Secret::new(user.to_string());
let (tx, rx) = oneshot::channel(); let (tx, rx) = oneshot::channel();

View file

@ -12,9 +12,9 @@ use anyhow::{Context, Result};
use bimap::BiMap; use bimap::BiMap;
use bytes::Bytes; use bytes::Bytes;
use futures::{Future, FutureExt}; use futures::{Future, FutureExt};
use russh::keys::key::{PublicKey, SignatureHash};
use russh::keys::PublicKeyBase64;
use russh::{CryptoVec, MethodSet, Sig}; use russh::{CryptoVec, MethodSet, Sig};
use russh_keys::key::{PublicKey, SignatureHash};
use russh_keys::PublicKeyBase64;
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
use tokio::sync::{broadcast, oneshot, Mutex}; use tokio::sync::{broadcast, oneshot, Mutex};
use tracing::*; use tracing::*;