mirror of
https://codeberg.org/spire/dispenser.git
synced 2026-06-03 10:04:07 +02:00
fix ssh password auth
This commit is contained in:
parent
47335719f3
commit
b521da12c6
3 changed files with 9 additions and 9 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -1764,9 +1764,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thrussh"
|
name = "thrussh"
|
||||||
version = "0.35.1"
|
version = "0.34.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "addf63d9ce535faca8a869a234de46c6018e9fa4b7e65597ca64e457bb8d128e"
|
checksum = "0eb7f634184fe86d7a9fd587d9350137508cba7b77626a7785db2ca695ebc503"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ toml = "0.8.8"
|
||||||
tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread", "signal"] }
|
tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread", "signal"] }
|
||||||
camino = "1.1.6"
|
camino = "1.1.6"
|
||||||
petname = "1.1.3"
|
petname = "1.1.3"
|
||||||
thrussh = "0.35.1"
|
thrussh = "0.34.0" # 0.35.1 broke password auth?
|
||||||
thrussh-keys = "0.22.1"
|
thrussh-keys = "0.22.1"
|
||||||
futures-util = "0.3.30"
|
futures-util = "0.3.30"
|
||||||
pretty_env_logger = "0.5.0"
|
pretty_env_logger = "0.5.0"
|
||||||
|
|
|
||||||
12
src/ssh.rs
12
src/ssh.rs
|
|
@ -11,7 +11,7 @@ use thrussh::client::Handle;
|
||||||
use thrussh::*;
|
use thrussh::*;
|
||||||
use thrussh_keys::key::PublicKey;
|
use thrussh_keys::key::PublicKey;
|
||||||
use tokio::time::{sleep, timeout};
|
use tokio::time::{sleep, timeout};
|
||||||
use tracing::instrument;
|
use tracing::{info, instrument};
|
||||||
|
|
||||||
struct Client {}
|
struct Client {}
|
||||||
|
|
||||||
|
|
@ -77,14 +77,14 @@ impl Debug for SshSession {
|
||||||
impl SshSession {
|
impl SshSession {
|
||||||
#[instrument(skip(auth))]
|
#[instrument(skip(auth))]
|
||||||
pub async fn open(ip: IpAddr, auth: &CreatedAuth) -> Result<Self, SshError> {
|
pub async fn open(ip: IpAddr, auth: &CreatedAuth) -> Result<Self, SshError> {
|
||||||
timeout(Duration::from_secs(5 * 60), async move {
|
timeout(Duration::from_secs(10 * 60), async move {
|
||||||
loop {
|
loop {
|
||||||
sleep(Duration::from_secs(1)).await;
|
sleep(Duration::from_secs(5)).await;
|
||||||
match SshSession::open_impl(ip, auth).await {
|
match SshSession::open_impl(ip, auth).await {
|
||||||
Ok(ssh) => return Ok(ssh),
|
Ok(ssh) => return Ok(ssh),
|
||||||
Err(
|
Err(err @ (SshError::ConnectionTimeout | SshError::Refused)) => {
|
||||||
SshError::ConnectionTimeout | SshError::Refused | SshError::Unauthorized,
|
info!(error = ?err, "ssh server not ready yes");
|
||||||
) => {}
|
}
|
||||||
Err(e) => return Err(e),
|
Err(e) => return Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue