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

Function query_tls_mode

crates/openshell-supervisor-network/src/proxy.rs:2190–2217  ·  view source on GitHub ↗

Query the TLS mode for an endpoint, independent of L7 config. This extracts `tls: skip` from the endpoint even when no `protocol` is set.

(
    engine: &OpaEngine,
    decision: &ConnectDecision,
    host: &str,
    port: u16,
)

Source from the content-addressed store, hash-verified

2188///
2189/// This extracts `tls: skip` from the endpoint even when no `protocol` is set.
2190fn query_tls_mode(
2191 engine: &OpaEngine,
2192 decision: &ConnectDecision,
2193 host: &str,
2194 port: u16,
2195) -> crate::l7::TlsMode {
2196 let has_policy = match &decision.action {
2197 NetworkAction::Allow { matched_policy } => matched_policy.is_some(),
2198 NetworkAction::Deny { .. } => false,
2199 };
2200 if !has_policy {
2201 return crate::l7::TlsMode::Auto;
2202 }
2203
2204 let input = crate::opa::NetworkInput {
2205 host: host.to_string(),
2206 port,
2207 binary_path: decision.binary.clone().unwrap_or_default(),
2208 binary_sha256: String::new(),
2209 ancestors: decision.ancestors.clone(),
2210 cmdline_paths: decision.cmdline_paths.clone(),
2211 };
2212
2213 match engine.query_endpoint_config(&input) {
2214 Ok(Some(val)) => crate::l7::parse_tls_mode(&val),
2215 _ => crate::l7::TlsMode::Auto,
2216 }
2217}
2218
2219/// When the policy endpoint host is a literal IP address, the user has
2220/// explicitly declared intent to allow that destination. Synthesize an

Callers 1

handle_tcp_connectionFunction · 0.85

Calls 2

parse_tls_modeFunction · 0.85
query_endpoint_configMethod · 0.80

Tested by

no test coverage detected