D1: lutra-deploy crate: SFTP, FTP/FTPS and folder transports, keychain secrets, known hosts, path mappings

Pure Rust (D27): russh + russh-sftp with ring, suppaftp with rustls/ring,
keyring (Windows Credential Manager, macOS Keychain). Lutra's own
known-hosts file, refuse on mismatch. In-process SFTP and FTP test
servers behind the testserver feature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-02 19:09:17 +01:00
parent 33a7185d75
commit 0644b044f2
16 changed files with 5250 additions and 13 deletions

View file

@ -0,0 +1,26 @@
//! Runs the local SFTP and FTP test servers for a live check:
//! `cargo run -p lutra-deploy --features testserver --example testserver -- DIR USER PASSWORD`.
//! Both listen on 127.0.0.1 only and serve `DIR`. Prints their ports and
//! the SFTP host key, then runs until standard input closes.
use std::io::Read;
use std::path::PathBuf;
use lutra_deploy::testserver::{FtpServer, SftpServer};
fn main() -> std::io::Result<()> {
let args: Vec<String> = std::env::args().skip(1).collect();
let [dir, user, password] = args.as_slice() else {
eprintln!("usage: testserver DIR USER PASSWORD");
std::process::exit(2);
};
let dir = PathBuf::from(dir);
std::fs::create_dir_all(&dir)?;
let sftp = SftpServer::start(&dir, user, Some(password), None, 9)?;
let ftp = FtpServer::start(&dir, user, password)?;
println!("sftp {} {} {}", sftp.addr, sftp.algorithm, sftp.fingerprint);
println!("ftp {}", ftp.addr);
let mut sink = Vec::new();
std::io::stdin().read_to_end(&mut sink)?;
Ok(())
}