MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / handle_connection

Function handle_connection

crates/openshell-supervisor-process/src/ssh.rs:165–203  ·  view source on GitHub ↗
(
    stream: tokio::net::UnixStream,
    config: Arc<russh::server::Config>,
    policy: SandboxPolicy,
    workdir: Option<String>,
    netns_fd: Option<RawFd>,
    proxy_url: Option<String>,
    ca

Source from the content-addressed store, hash-verified

163
164#[allow(clippy::too_many_arguments)]
165async fn handle_connection(
166 stream: tokio::net::UnixStream,
167 config: Arc<russh::server::Config>,
168 policy: SandboxPolicy,
169 workdir: Option<String>,
170 netns_fd: Option<RawFd>,
171 proxy_url: Option<String>,
172 ca_file_paths: Option<Arc<(PathBuf, PathBuf)>>,
173 provider_credentials: ProviderCredentialState,
174 user_environment: HashMap<String, String>,
175) -> Result<()> {
176 // Access is gated by the Unix-socket filesystem permissions (root-only),
177 // not by an application-level preface. The supervisor bridges the
178 // gateway's RelayStream directly into this socket.
179 ocsf_emit!(
180 SshActivityBuilder::new(openshell_ocsf::ctx::ctx())
181 .activity(ActivityId::Open)
182 .action(ActionId::Allowed)
183 .disposition(DispositionId::Allowed)
184 .severity(SeverityId::Informational)
185 .status(StatusId::Success)
186 .message("SSH connection accepted on supervisor Unix socket")
187 .build()
188 );
189
190 let handler = SshHandler::new(
191 policy,
192 workdir,
193 netns_fd,
194 proxy_url,
195 ca_file_paths,
196 provider_credentials,
197 user_environment,
198 );
199 russh::server::run_stream(config, stream, handler)
200 .await
201 .map_err(|err| miette::miette!("ssh stream error: {err}"))?;
202 Ok(())
203}
204
205/// Per-channel state for tracking PTY resources and I/O senders.
206///

Callers 1

run_ssh_serverFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected