Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
What changed in OpenBGA Interface Engine, grouped by release with unreleased changes on
top, then by impact. Types follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Unreleased (2026-11-12 to 2026-11-23)
## Unreleased (2026-11-12 to 2026-11-24)

### High impact

Expand Down Expand Up @@ -173,6 +173,18 @@ top, then by impact. Types follow [Keep a Changelog](https://keepachangelog.com/

### Medium impact

- **Fixed:** SFTP endpoints connect to servers with RSA host keys (2026-11-24)

SFTP endpoints now connect to servers that identify themselves with an RSA host key, including
older 1024-bit keys, and sign in with RSA private keys. Before, such a server failed at connect
with "Wrong server signature". Pin the server's `SHA256:` fingerprint as for any other key.

Technical notes:

The engine's SSH library is built with RSA support: `russh` 0.65.1 → 0.65.4 with its `rsa`
feature, which adds `rsa` 0.10.0, `pkcs1` 0.8.0 and `crypto-primes` 0.7.2 (MIT or Apache-2.0)
and takes `ssh-key` 0.7.0-rc.12. `rsa` 0.10.0 is the release that fixes RUSTSEC-2023-0071.

- **Fixed:** Files are received when the engine takes them (2026-11-20)

A message read from a file (a delimited file or a PDF report) was recorded as received at the
Expand Down
74 changes: 55 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ nix = { version = "0.31.3", default-features = false, features = ["user"] }
# Reads secret values from the terminal without echo (`packie secrets set`).
rpassword = "7.5.4"
rusqlite = { version = "0.41.1", features = ["bundled"] }
russh = { version = "0.65.1", default-features = false, features = ["ring"] }
russh = { version = "0.65.4", default-features = false, features = ["ring", "rsa"] }
russh-sftp = "3.0.1"
rust_decimal = { version = "1.43.0", default-features = false, features = ["std", "serde"] }
serde = { version = "1.0.229", features = ["derive"] }
Expand All @@ -66,6 +66,8 @@ uuid = { version = "1.29.0", features = ["v7", "serde"] }
# Dev-only crates
insta = "1.49.0"
proptest = "1.12.0"
# Random RSA keys for the SFTP tests (the version ssh-key generates keys with).
rand = "0.10.3"
tempfile = "3.27.0"

[workspace.lints.rust]
Expand Down
17 changes: 17 additions & 0 deletions changelog.d/2026-11-24-sftp-rsa-host-keys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
date: 2026-11-24
type: fixed
impact: medium
title: SFTP endpoints connect to servers with RSA host keys
area: Endpoints
link: /endpoints
---
SFTP endpoints now connect to servers that identify themselves with an RSA host key, including
older 1024-bit keys, and sign in with RSA private keys. Before, such a server failed at connect
with "Wrong server signature". Pin the server's `SHA256:` fingerprint as for any other key.

## Technical notes

The engine's SSH library is built with RSA support: `russh` 0.65.1 → 0.65.4 with its `rsa`
feature, which adds `rsa` 0.10.0, `pkcs1` 0.8.0 and `crypto-primes` 0.7.2 (MIT or Apache-2.0)
and takes `ssh-key` 0.7.0-rc.12. `rsa` 0.10.0 is the release that fixes RUSTSEC-2023-0071.
1 change: 1 addition & 0 deletions crates/packie-transport/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ packie-core = { workspace = true }
nix = { workspace = true, features = ["fs"] }

[dev-dependencies]
rand = { workspace = true }
tracing-subscriber = { workspace = true }

[lints]
Expand Down
26 changes: 25 additions & 1 deletion crates/packie-transport/tests/sftp/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use russh::keys::ssh_key::LineEnding;
use serde_json::json;
use tokio::net::TcpListener;

use server::{PASSWORD, Server, fingerprint, key, transports};
use server::{PASSWORD, Server, fingerprint, key, rsa_key, transports};

fn read(path: impl AsRef<Path>) -> Vec<u8> {
fs::read(path).unwrap()
Expand Down Expand Up @@ -233,6 +233,30 @@ async fn key_authentication_uses_the_secret_store() {
assert_eq!(error.cause, "authentication rejected by the server");
}

#[tokio::test]
async fn rsa_host_and_user_keys_sign_in() {
// A server identified only by a 1024-bit RSA key, as some still are, and an RSA user key.
let client = rsa_key(2048);
let server = Server::start_with_host_key(&client, rsa_key(1024)).await;
let report = probe(&server, &json!({})).await;
assert!(report.ok, "{report:?}");

let pem = client.to_openssh(LineEnding::LF).unwrap();
let secrets = MapSecrets::new(HashMap::from([(
"sftp-key".to_owned(),
pem.as_str().to_owned(),
)]));
let auth = json!({"auth": {"method": "key", "private_key": {"secret": "sftp-key"}, "passphrase": null}});
let sink = SystemTransports::new(Arc::new(secrets))
.file_sink(&server.endpoint("/outbound", &auth))
.unwrap();
assert_eq!(
write(&*sink, "r.csv", b"rsa", OnExists::Fail).await,
"r.csv"
);
assert_eq!(read(server.dir("outbound").join("r.csv")), b"rsa");
}

#[tokio::test]
async fn a_complete_file_is_returned_and_consumed_into_processed() {
let server = Server::start(&key(9)).await;
Expand Down
13 changes: 11 additions & 2 deletions crates/packie-transport/tests/sftp/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::time::Duration;

use packie_config::EndpointConfig;
use packie_transport::{FileSink, FileSource, MapSecrets, SystemTransports, Transports};
use russh::keys::ssh_key::private::Ed25519Keypair;
use russh::keys::ssh_key::private::{Ed25519Keypair, RsaKeypair};
use russh::keys::{HashAlg, PrivateKey, PublicKey};
use russh::server::{Auth, ChannelOpenHandle, Msg, Session, VerifiedPublicKey};
use russh::{Channel, ChannelId};
Expand All @@ -32,6 +32,11 @@ pub fn key(seed: u8) -> PrivateKey {
PrivateKey::from(Ed25519Keypair::from_seed(&[seed; 32]))
}

/// A random RSA key of `bits`, for servers and users that still use RSA.
pub fn rsa_key(bits: usize) -> PrivateKey {
PrivateKey::from(RsaKeypair::random(&mut rand::rng(), bits).unwrap())
}

pub fn fingerprint(key: &PrivateKey) -> String {
key.public_key().fingerprint(HashAlg::Sha256).to_string()
}
Expand All @@ -47,10 +52,14 @@ impl Server {
/// Starts a server with `/inbound` and `/outbound`, accepting the synthetic password
/// and the public key of `client`.
pub async fn start(client: &PrivateKey) -> Self {
Self::start_with_host_key(client, key(7)).await
}

/// As [`Server::start`], identified by `host_key`.
pub async fn start_with_host_key(client: &PrivateKey, host_key: PrivateKey) -> Self {
let files = TempDir::new().unwrap();
fs::create_dir(files.path().join("inbound")).unwrap();
fs::create_dir(files.path().join("outbound")).unwrap();
let host_key = key(7);
let fingerprint = fingerprint(&host_key);
let config = Arc::new(russh::server::Config {
keys: vec![host_key],
Expand Down
4 changes: 2 additions & 2 deletions docs/operations/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ OS timing and log a warning; see the [TCP settings specification](../spec/config
| `username` | `sftp` | Required | String, 1–255 characters. |
| `auth.method` | `sftp` | Required | `password` or `key`. |
| `auth.password` | `sftp` | Required for password auth | Secret reference. |
| `auth.private_key` | `sftp` | Required for key auth | Secret reference. |
| `auth.private_key` | `sftp` | Required for key auth | Secret reference to an Ed25519, ECDSA or RSA private key. |
| `auth.passphrase` | `sftp` | Optional for key auth | Secret reference or `null`. |
| `host_key_fingerprint` | `sftp` | Required | `SHA256:` plus base64; pinned server key. |
| `host_key_fingerprint` | `sftp` | Required | `SHA256:` plus base64; pinned server key (Ed25519, ECDSA or RSA). |
| `remote_directory` | `sftp` | Required | Absolute remote path. |
| `connect_timeout_ms` | `sftp` | `10000` | Integer, 1–120,000. |
| `operation_timeout_ms` | `sftp` | `30000` | Integer, 1–600,000 per list/read/write operation. |
Expand Down
4 changes: 2 additions & 2 deletions docs/spec/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ one directory; use two endpoints for separate in and out directories.
| `host` | sftp | string | none | As `tcp_client.host`. |
| `port` | sftp | integer | `22` | 1–65535. |
| `username` | sftp | string | none | 1–255 characters. |
| `auth` | sftp | object | none | `{"method":"password","password":<secret>}` or `{"method":"key","private_key":<secret>,"passphrase":<secret or null>}`. Secrets by reference only. |
| `host_key_fingerprint` | sftp | string | none | Required server-key pin, normally `SHA256:` followed by base64. Configuration validation checks only the `SHA256:` prefix and a minimum total length of 10 bytes. A mismatch with the server's fingerprint puts the endpoint in `error` (`host_key_mismatch`). |
| `auth` | sftp | object | none | `{"method":"password","password":<secret>}` or `{"method":"key","private_key":<secret>,"passphrase":<secret or null>}`. Secrets by reference only. A private key is Ed25519, ECDSA or RSA. |
| `host_key_fingerprint` | sftp | string | none | Required server-key pin, normally `SHA256:` followed by base64. The host key may be Ed25519, ECDSA or RSA (1024 bits or more). Configuration validation checks only the `SHA256:` prefix and a minimum total length of 10 bytes. A mismatch with the server's fingerprint puts the endpoint in `error` (`host_key_mismatch`). |
| `remote_directory` | sftp | string | none | Absolute remote path. |
| `connect_timeout_ms` | sftp | integer | `10000` | 1–120,000. |
| `operation_timeout_ms` | sftp | integer | `30000` | 1–600,000. One list, read or write operation. |
Expand Down
Loading