fabrica

hanna/fabrica

1185 bytes
Raw
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5//! The SSH front-end: publickey auth and `exec` dispatch into pack processes.
6//!
7//! A `russh` server accepts only `publickey` auth (matching the offered key's
8//! SHA256 fingerprint against the `keys` table), handles only the `exec` channel
9//! request, and streams the channel data to and from a spawned `git`
10//! upload-pack/receive-pack process via [`git::pack`]. Anything else — a shell,
11//! a PTY, an unrecognized command — gets a friendly banner and a non-zero exit.
12
13mod command;
14mod hostkey;
15mod resolve;
16mod server;
17
18pub use crate::server::serve;
19
20/// An error from the SSH layer.
21#[derive(Debug, thiserror::Error)]
22pub enum SshError {
23 /// A filesystem or socket I/O error.
24 #[error(transparent)]
25 Io(#[from] std::io::Error),
26 /// The host key could not be generated, read, or written.
27 #[error("host key error: {0}")]
28 HostKey(String),
29 /// The russh server failed to start or run.
30 #[error("ssh server error: {0}")]
31 Server(String),
32}