Supported authentication path for an out-of-process Rust client to a local mTLS gateway #2627
Replies: 2 comments
|
Your reading is correct: there is no For an out-of-process Rust client connecting to the default local mTLS gateway today, the public path appears to be:
use std::path::Path;
use openshell_sdk::{EdgeAuthInterceptor, OpenShellClient};
use tonic::transport::{
Certificate, ClientTlsConfig, Endpoint, Identity,
};
async fn connect_local_mtls(
endpoint: &str,
bundle: &Path,
) -> Result<OpenShellClient, Box<dyn std::error::Error>> {
let ca = tokio::fs::read(bundle.join("ca.crt")).await?;
let cert = tokio::fs::read(bundle.join("tls.crt")).await?;
let key = tokio::fs::read(bundle.join("tls.key")).await?;
let tls = ClientTlsConfig::new()
.ca_certificate(Certificate::from_pem(ca))
.identity(Identity::from_pem(cert, key));
let channel = Endpoint::from_shared(endpoint.to_owned())?
.tls_config(tls)?
.connect()
.await?;
Ok(OpenShellClient::from_parts(
channel,
EdgeAuthInterceptor::noop(),
))
}The generated tonic client is also publicly re-exported as OIDC and edge authentication are the better fit for shared or remote deployments, but they are not an automatic substitute for the default local mTLS gateway: the gateway must be configured for the chosen mode. If an endpoint requires both a client certificate and an OIDC bearer token, the custom mTLS channel can instead be passed to Plaintext loopback is therefore not required as a fallback. It is a separate, explicitly configured development or trusted-proxy mode, while the documented local default remains mTLS. I would not currently infer planned native client-certificate fields in |
|
For a local single-user gateway, use the same mTLS bundle as the CLI: ca.crt as the trust root and tls.crt/tls.key as the client identity. With mTLS auth enabled, no separate bearer-token exchange is needed. |
Uh oh!
There was an error while loading. Please reload this page.
OpenShell’s gateway authentication documentation describes mTLS as the default for local gateways without OIDC. The current SDK transport appears to support server CA configuration while leaving client-certificate mTLS to the CLI path.
What is the intended supported connection path for an out-of-process Rust client?
openshell-sdkconfiguration I missed;I want to avoid treating plaintext or unauthenticated loopback as a supported integration contract. If this is mainly a documentation gap, I would be happy to contribute a focused clarification or test.
All reactions