Skip to main content

ssh_cli/ssh/
mod.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// G-UNSAFE-01 / G-SECDEV-05: pure module — no `unsafe`.
3#![forbid(unsafe_code)]
4//! SSH engine via `russh` 0.62.x.
5//!
6//! - `client`: one-shot connection, password/key/agent auth, exec with timeout and abort
7//! - `known_hosts`: TOFU fingerprints under XDG
8//! - `packing`: safe sudo/su packing for one-shot automation
9//! - `key_material`: private-key permissions + weak-RSA policy (G-SSH-03/07)
10//! - `client_handler` / `client_connect`: host-key TOFU + auth chain (G-SSH-01/04/06)
11//!
12//! ## Features
13//!
14//! The concrete [`SshClient`] is feature-gated:
15//! - **`ssh-real`** (default): real client via `russh`
16//! - without default features: stub that fails connect with a clear error
17
18pub mod client;
19pub mod connection;
20#[cfg(feature = "ssh-real")]
21pub(crate) mod client_connect;
22#[cfg(feature = "ssh-real")]
23pub(crate) mod client_handler;
24#[cfg(feature = "ssh-real")]
25pub(crate) mod connect;
26#[cfg(feature = "ssh-real")]
27pub(crate) mod key_material;
28pub mod known_hosts;
29pub mod packing;
30pub(crate) mod scp_wire;
31pub(crate) mod session_io;
32/// Pure remote path validation (G-SFTP-06/16).
33pub(crate) mod sftp_path;
34/// SFTP list/stat DTOs (always available).
35pub(crate) mod sftp_types;
36/// SFTP subsystem session + stream ops (G-SFTP; feature `ssh-real`).
37#[cfg(feature = "ssh-real")]
38pub(crate) mod sftp_session;
39
40pub use sftp_types::{SftpListEntry, SftpStat};
41
42pub use client::ExecutionOutput;
43pub use connection::ConnectionConfig;
44pub use session_io::truncate_utf8;
45/// SSH client type (real or stub depending on feature `ssh-real`).
46#[cfg_attr(docsrs, doc(cfg(feature = "ssh-real")))]
47pub use client::SshClient;
48pub use packing::{
49    append_description, pack_abort_pkill, pack_su, pack_sudo,
50    escape_shell_single_quotes, remote_abort_pattern,
51};