Background
There are two AWS EC2 machines running Ubuntu 20.04. One is an AMD64 machine the other is an ARM64 machine. Both have two processors. Both have 1 GiB of RAM. Both machines have the same key-pair for SSH.
I can shell-in to both macines from a Windows 10 client using the ssh
installed in the Windows / System32 / OpenSSH directory. I assume this version came with the operating system. All good.
I can shell-in to both machines from a Windows 10 client using the ssh
that comes with Git for Windows. All good.
I can shell-in from a Debian 10 client using the operating system provided ssh
. All good.
Rust Program
use std::net::TcpStream;
use std::path::Path;
use ssh2::{Session, TraceFlags};
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!();
let mut session = Session::new()?;
session.trace(
TraceFlags::AUTH |
TraceFlags::CONN |
TraceFlags::ERROR |
TraceFlags::KEX |
TraceFlags::PUBLICKEY |
TraceFlags::SCP |
TraceFlags::SFTP |
//TraceFlags::SOCKET |
//TraceFlags::TRANS |
TraceFlags::empty()
);
// amd
//session.set_tcp_stream(TcpStream::connect("{address of the happy machine}:22")?);
// ARM
session.set_tcp_stream(TcpStream::connect("{address of the sad machine}:22")?);
session.handshake()?;
let private_key = Path::new("general-purpose.pem");
session
.userauth_pubkey_file("ubuntu", None, private_key, None)?;
println!();
Ok(())
}
Cargo.toml for Linux
[package]
name = "junk"
version = "0.1.0"
edition = "2021"
[dependencies]
ssh2 = { version = "0.9.3" }
Cargo.toml for Windows
[package]
name = "junk"
version = "0.1.0"
edition = "2021"
[dependencies]
ssh2 = { version = "0.9.3", features = ["vendored-openssl", "openssl-on-win32"] }
Troubles
The program above works correctly when connecting to the AMD64 machine when run under Windows 10. It works correctly when connecting to the AMD64 machine when run under Debian 10. All good.
The program fails when connecting to the ARM64 machine when run under Windows 10. It fails when connecting to the ARM64 machine when run under Debian 10. The error is...
Error: Error { code: Session(-18), msg: "Username/PublicKey combination invalid" }
I tried updating the operating system on the ARM64 machine. That made no difference.
Have I seriously found a bug in the libssh2 stack?