Skip to content

Commit 5cb7d8d

Browse files
committed
fix(mxc): reconcile host proxy after rebase
Signed-off-by: Drew Newberry <[email protected]>
1 parent 8ec76cd commit 5cb7d8d

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

‎crates/openshell-driver-mxc/examples/run-mxc-e2e.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ try {
437437
Set-Content -Path (Join-Path $roSrc "seed.txt") -Value "read-only seed" -Encoding UTF8
438438
Ok "DemoDir=$DemoDir roSrc=$roSrc denyProbe=$denyProbe"
439439

440-
$env:OPENSHELL_DRIVERS = "mxc"
440+
$env:OPENSHELL_COMPUTE_DRIVER = "mxc"
441441
$env:OPENSHELL_MXC_SHARE_DIR = $DemoDir
442442

443443
# --- Scenario definitions -------------------------------------------------

‎crates/openshell-supervisor-network/src/proxy.rs‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ pub(crate) enum ProxyIdentityMode {
151151
/// unavailable. MXC uses this on Windows: every connection redirected to
152152
/// the per-sandbox listener is evaluated as the configured sandbox agent
153153
/// identity.
154+
#[cfg(any(not(target_os = "linux"), test))]
154155
Static {
155156
binary_path: PathBuf,
156157
binary_sha256: String,
@@ -169,6 +170,7 @@ impl ProxyIdentityMode {
169170
}
170171
}
171172

173+
#[cfg(any(not(target_os = "linux"), test))]
172174
pub(crate) fn static_binary(path: impl Into<PathBuf>) -> Result<Self> {
173175
let binary_path = path.into();
174176
let binary_sha256 = crate::procfs::file_sha256(&binary_path)?;
@@ -184,6 +186,7 @@ impl ProxyIdentityMode {
184186
Self::Procfs { entrypoint_pid, .. } => {
185187
entrypoint_pid.load(std::sync::atomic::Ordering::Acquire)
186188
}
189+
#[cfg(any(not(target_os = "linux"), test))]
187190
Self::Static { .. } => 0,
188191
}
189192
}
@@ -2698,11 +2701,14 @@ fn evaluate_endpoint_only_opa(engine: &OpaEngine, intent: EgressIntent) -> Egres
26982701
}
26992702

27002703
fn authorize_egress_intent(
2701-
_connection: crate::procfs::WorkloadProxyTcpConnection,
2704+
connection: crate::procfs::WorkloadProxyTcpConnection,
27022705
engine: &OpaEngine,
27032706
identity_mode: &ProxyIdentityMode,
27042707
intent: EgressIntent,
27052708
) -> EgressDecision {
2709+
#[cfg(not(target_os = "linux"))]
2710+
let _ = &connection;
2711+
27062712
if !crate::opa::network_binary_identity_required() {
27072713
return evaluate_endpoint_only_opa(engine, intent);
27082714
}
@@ -2713,12 +2719,13 @@ fn authorize_egress_intent(
27132719
identity_cache,
27142720
entrypoint_pid,
27152721
} => authorize_egress_intent_procfs(
2716-
_connection,
2722+
connection,
27172723
engine,
27182724
identity_cache,
27192725
entrypoint_pid,
27202726
intent,
27212727
),
2728+
#[cfg(any(not(target_os = "linux"), test))]
27222729
ProxyIdentityMode::Static {
27232730
binary_path,
27242731
binary_sha256,
@@ -2731,13 +2738,13 @@ fn authorize_egress_intent(
27312738
ancestors: Vec::new(),
27322739
cmdline_paths: Vec::new(),
27332740
};
2734-
match engine.evaluate_network_action_with_generation(&input) {
2735-
Ok((action, generation)) => EgressDecision {
2741+
match engine.authorize_egress(&input) {
2742+
Ok(authorization) => EgressDecision {
27362743
intent,
2737-
action,
2738-
policy_generation: generation,
2744+
action: authorization.action.clone(),
2745+
policy_generation: authorization.generation,
27392746
identity: ProcessIdentityEvidence::Available,
2740-
endpoint: EndpointDecision::default(),
2747+
endpoint: EndpointDecision::from_authorization(&authorization),
27412748
binary: Some(binary_path.clone()),
27422749
binary_pid: None,
27432750
ancestors: Vec::new(),
@@ -6974,10 +6981,7 @@ network_policies:
69746981
port: 443,
69756982
..Default::default()
69766983
}],
6977-
binaries: vec![NetworkBinary {
6978-
path: binary_path,
6979-
..Default::default()
6980-
}],
6984+
binaries: vec![NetworkBinary { path: binary_path }],
69816985
},
69826986
)]),
69836987
..Default::default()

0 commit comments

Comments
 (0)