File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -268,6 +268,15 @@ impl OciPolicy {
268268 builder = builder. user ( ru. uid , ru. gid ) ;
269269 }
270270
271+ // Container workloads legitimately run servers (nginx, etc.). sandlock
272+ // gates bind() by default-deny (Landlock BIND_TCP), so without this an
273+ // in-container server fails bind() with EACCES and the container exits,
274+ // which in turn hangs any readiness/verification exec that waits on it.
275+ // Enable port remapping: binds are emulated on-behalf and succeed,
276+ // using the requested port when free and a fresh host port only on
277+ // conflict, so co-located sandboxes never collide on a host port.
278+ builder = builder. port_remap ( true ) ;
279+
271280 builder. build_unchecked ( ) . map_err ( Into :: into)
272281 }
273282}
@@ -718,6 +727,9 @@ mod tests {
718727 assert ! ( sandbox. chroot. is_some( ) ) ;
719728 assert ! ( sandbox. cwd. is_some( ) ) ;
720729 assert ! ( !sandbox. env. is_empty( ) ) ;
730+ // Container workloads must be able to bind ports (servers); port
731+ // remapping is enabled so bind() succeeds instead of EACCES-exiting.
732+ assert ! ( sandbox. port_remap, "OCI containers must allow port binding" ) ;
721733 }
722734
723735 #[ test]
You can’t perform that action at this time.
0 commit comments