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
1 change: 1 addition & 0 deletions rust/Cargo.lock

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

150 changes: 150 additions & 0 deletions rust/crates/diagnostics/src/catalog_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1281,12 +1281,111 @@ pub static EVENTS: &[EventMetadata] = &[
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.connection.cleaned",
channel: "remote",
level: LogLevel::Info,
message: "Remote connection {ended}",
fields: &[
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "duration", field_type: FieldType::Duration, required: true, description: "Lifetime of the established connection from the completed handshake until release", reason: None },
FieldMetadata { name: "ended", field_type: FieldType::Token, required: true, description: "How the session was released: shutdown, closed (stdio server ended with the client), detached (daemon kept running) or lost", reason: None },
],
span: None,
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.connection.connect.failed",
channel: "remote",
level: LogLevel::Warn,
message: "Remote connection failed",
fields: &[
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "duration", field_type: FieldType::Duration, required: true, description: "Monotonic time from remote.connection.connect.started to remote.connection.connect.failed, encoded in milliseconds", reason: None },
FieldMetadata { name: "error", field_type: FieldType::Error, required: true, description: "Failure that ended the remote.connection.connect operation, retaining its error code and domain without unredacted private details", reason: None },
FieldMetadata { name: "outcome", field_type: FieldType::Token, required: false, description: "How the attempt ended without a failure: connected, or cancelled by the user before the session opened", reason: None },
FieldMetadata { name: "persistent", field_type: FieldType::Bool, required: false, description: "Whether the server is a persistent daemon session that survives this client disconnecting", reason: None },
FieldMetadata { name: "resumed", field_type: FieldType::Bool, required: false, description: "Whether this connection reattached to an existing persistent session, i.e. a reconnect", reason: None },
FieldMetadata { name: "server_version", field_type: FieldType::Version, required: false, description: "Version the remote server reported in server.hello once the handshake succeeded", reason: None },
FieldMetadata { name: "stage", field_type: FieldType::Token, required: false, description: "Connection step that failed: probe, artifact, deploy, handshake, authentication, network or connect", reason: None },
FieldMetadata { name: "transport", field_type: FieldType::Token, required: true, description: "How the client reached the server: ssh, command (any spawned transport chain) or streams (caller-supplied pipes)", reason: None },
],
span: Some(SpanPhase::Failed),
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.connection.connect.finished",
channel: "remote",
level: LogLevel::Info,
message: "Remote connection finished",
fields: &[
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "duration", field_type: FieldType::Duration, required: true, description: "Monotonic time from remote.connection.connect.started to remote.connection.connect.finished, encoded in milliseconds", reason: None },
FieldMetadata { name: "outcome", field_type: FieldType::Token, required: false, description: "How the attempt ended without a failure: connected, or cancelled by the user before the session opened", reason: None },
FieldMetadata { name: "persistent", field_type: FieldType::Bool, required: false, description: "Whether the server is a persistent daemon session that survives this client disconnecting", reason: None },
FieldMetadata { name: "resumed", field_type: FieldType::Bool, required: false, description: "Whether this connection reattached to an existing persistent session, i.e. a reconnect", reason: None },
FieldMetadata { name: "server_version", field_type: FieldType::Version, required: false, description: "Version the remote server reported in server.hello once the handshake succeeded", reason: None },
FieldMetadata { name: "stage", field_type: FieldType::Token, required: false, description: "Connection step that failed: probe, artifact, deploy, handshake, authentication, network or connect", reason: None },
FieldMetadata { name: "transport", field_type: FieldType::Token, required: true, description: "How the client reached the server: ssh, command (any spawned transport chain) or streams (caller-supplied pipes)", reason: None },
],
span: Some(SpanPhase::Finished),
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.connection.connect.started",
channel: "remote",
level: LogLevel::Debug,
message: "Remote connection started",
fields: &[
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "outcome", field_type: FieldType::Token, required: false, description: "How the attempt ended without a failure: connected, or cancelled by the user before the session opened", reason: None },
FieldMetadata { name: "persistent", field_type: FieldType::Bool, required: false, description: "Whether the server is a persistent daemon session that survives this client disconnecting", reason: None },
FieldMetadata { name: "resumed", field_type: FieldType::Bool, required: false, description: "Whether this connection reattached to an existing persistent session, i.e. a reconnect", reason: None },
FieldMetadata { name: "server_version", field_type: FieldType::Version, required: false, description: "Version the remote server reported in server.hello once the handshake succeeded", reason: None },
FieldMetadata { name: "stage", field_type: FieldType::Token, required: false, description: "Connection step that failed: probe, artifact, deploy, handshake, authentication, network or connect", reason: None },
FieldMetadata { name: "transport", field_type: FieldType::Token, required: true, description: "How the client reached the server: ssh, command (any spawned transport chain) or streams (caller-supplied pipes)", reason: None },
],
span: Some(SpanPhase::Started),
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.connection.interrupted",
channel: "remote",
level: LogLevel::Warn,
message: "Remote connection interrupted: {cause}",
fields: &[
FieldMetadata { name: "cause", field_type: FieldType::Token, required: true, description: "Why the server stream ended without a shutdown request: eof, protocol, overflow, or an I/O error kind", reason: None },
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "duration", field_type: FieldType::Duration, required: true, description: "Time the connection had been established before the stream ended unexpectedly", reason: None },
],
span: None,
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.connection.shell_started",
channel: "remote",
level: LogLevel::Info,
message: "Remote shell answered the probe for {target}",
fields: &[
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "target", field_type: FieldType::Token, required: true, description: "Server build target matching the probed system, e.g. x86_64-unknown-linux-musl, or unsupported; authentication has succeeded", reason: None },
],
span: None,
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.forward.accept_failed",
channel: "remote",
level: LogLevel::Warn,
message: "Port forward accept failed",
fields: &[
FieldMetadata { name: "connection", field_type: FieldType::Id, required: false, description: "Random per-connection log identifier of the forward's session; never a host, user name or session token", reason: None },
FieldMetadata { name: "error", field_type: FieldType::Error, required: true, description: "Fixed summary and stable failure category from remote.forward.accept_failed; never error display text", reason: None },
FieldMetadata { name: "stage", field_type: FieldType::Token, required: true, description: "Controlled remote.forward.accept_failed operation stage; excludes paths and peer input", reason: None },
],
Expand All @@ -1300,13 +1399,46 @@ pub static EVENTS: &[EventMetadata] = &[
level: LogLevel::Warn,
message: "Forwarded connection failed",
fields: &[
FieldMetadata { name: "connection", field_type: FieldType::Id, required: false, description: "Random per-connection log identifier of the forward's session; never a host, user name or session token", reason: None },
FieldMetadata { name: "error", field_type: FieldType::Error, required: true, description: "Fixed summary and stable failure category from remote.forward.connection_failed; never error display text", reason: None },
FieldMetadata { name: "stage", field_type: FieldType::Token, required: true, description: "Controlled remote.forward.connection_failed operation stage; excludes paths and peer input", reason: None },
],
span: None,
rate: 12,
owner: "lithe-core",
},
EventMetadata {
id: "remote.forward.removed",
channel: "remote",
level: LogLevel::Info,
message: "Port forward on local port {local_port} removed",
fields: &[
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "connections", field_type: FieldType::Int, required: true, description: "Number of local connections the forward accepted during its lifetime", reason: None },
FieldMetadata { name: "duration", field_type: FieldType::Duration, required: true, description: "Time from starting the forward until its acceptor stopped", reason: None },
FieldMetadata { name: "local_port", field_type: FieldType::Int, required: true, description: "Local TCP port the forward stopped listening on", reason: None },
],
span: None,
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.forward.started",
channel: "remote",
level: LogLevel::Info,
message: "Port forward started on local port {local_port}",
fields: &[
FieldMetadata { name: "bind_scope", field_type: FieldType::Token, required: true, description: "Whether the local listener is bound to loopback only or to a network-reachable address", reason: None },
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "local_port", field_type: FieldType::Int, required: true, description: "Local TCP port the forward listens on, after the system chose one for port 0", reason: None },
FieldMetadata { name: "remote_port", field_type: FieldType::Int, required: false, description: "Remote TCP port the forward reaches; absent for unix sockets, and the remote host is never logged", reason: None },
FieldMetadata { name: "target_kind", field_type: FieldType::Token, required: true, description: "Remote endpoint family the forward opens: tcp for host and port, unix for a socket path", reason: None },
FieldMetadata { name: "target_scope", field_type: FieldType::Token, required: false, description: "Whether the remote TCP host is a loopback name or address, or another network host", reason: None },
],
span: None,
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.process.cleanup_failed",
channel: "remote",
Expand All @@ -1332,6 +1464,24 @@ pub static EVENTS: &[EventMetadata] = &[
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.server.deploy_finished",
channel: "remote",
level: LogLevel::Info,
message: "Remote server {action} after {verification} verification",
fields: &[
FieldMetadata { name: "action", field_type: FieldType::Token, required: true, description: "Deployment result: reused when the private installed binary already matched, uploaded otherwise", reason: None },
FieldMetadata { name: "bytes", field_type: FieldType::Bytes, required: false, description: "Size of the server binary sent over the connection; present only when it was uploaded", reason: None },
FieldMetadata { name: "connection", field_type: FieldType::Id, required: true, description: "Random per-connection log identifier that correlates this connection's lines; never a host, user name or session token", reason: None },
FieldMetadata { name: "duration", field_type: FieldType::Duration, required: true, description: "Time from sending the install request until the remote confirmed the installed binary", reason: None },
FieldMetadata { name: "server_version", field_type: FieldType::Version, required: true, description: "Version of the bundled server artifact the client offered for this deployment", reason: None },
FieldMetadata { name: "target", field_type: FieldType::Token, required: true, description: "Server build target that was installed or reused, e.g. aarch64-unknown-linux-musl", reason: None },
FieldMetadata { name: "verification", field_type: FieldType::Token, required: true, description: "How the remote checked the binary: sha256 computed by the host's own tool, or identity (matching size and self-reported identity) when the host has no hash tool", reason: None },
],
span: None,
rate: 60,
owner: "lithe-core",
},
EventMetadata {
id: "remote.session.cleanup_failed",
channel: "remote",
Expand Down
9 changes: 9 additions & 0 deletions rust/crates/remote/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ sha2 = { version = "0.10", optional = true }
libc = { version = "0.2", optional = true }
trash = { version = "5.2.6", default-features = false, features = ["chrono"], optional = true }

# Tests check every lifecycle fact against the log catalog Core validates with.
# Only tests use it: the server and the client stay free of Core crates.
[dev-dependencies]
lithe-diagnostics = { path = "../diagnostics" }

[[bin]]
name = "lithe-remote-server"
path = "src/bin/lithe-remote-server.rs"
Expand Down Expand Up @@ -62,3 +67,7 @@ required-features = ["client", "server"]
[[test]]
name = "persistence"
required-features = ["client", "server"]

[[test]]
name = "connection_log"
required-features = ["client", "server"]
Loading
Loading