pub struct EgressProxy { /* private fields */ }Expand description
Local forward proxy that authorizes every outbound agent connection.
Reads the SNI / requested host off the wire without MITM (PRODUCT.md B.5
step 2), asks the PolicyDecisionPoint per connection, and on
Decision::Deny/Decision::Escalate issues a hard RST so zero bytes
leave the box (PRODUCT.md B.5 step 4, Part D row 1). Every decision is appended
to the signed audit log.
Fail-closed by construction: see FailMode / EgressProxy::on_error
(PRODUCT.md W0).
Implementations§
Source§impl EgressProxy
impl EgressProxy
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct an egress proxy that is fail-closed (PRODUCT.md W0) and tagged with
the current platform’s EnforcementTier.
Sourcepub async fn start(
&self,
addr: SocketAddr,
pdp: Arc<dyn PolicyDecisionPoint>,
) -> Result<()>
pub async fn start( &self, addr: SocketAddr, pdp: Arc<dyn PolicyDecisionPoint>, ) -> Result<()>
Bind the proxy listener on addr and serve forever, authorizing each
connection against pdp (PRODUCT.md B.5 — the headline path).
Per accepted connection the real implementation will, in order:
- Peek the first record to extract SNI /
CONNECThost without MITM into aPeekedHost(PRODUCT.md B.5 step 2). - Resolve the originating
ConnectionRequest::pid(SO_PEERCRED/LOCAL_PEERPID) so the PDP can fuse syscall context (PRODUCT.md B.6). - Call
pdp.authorize(&req)(PRODUCT.md B.5 step 2-3). Decision::Allow=> splice to the upstream; otherwiseSelf::hard_rst(PRODUCT.md B.5 step 4).- Append exactly one entry to the signed audit log with pid/host/decision.
Any error along the way routes through Self::on_error => fail-closed.
§Heavy deps (commented in Cargo.toml)
The wire-level work needs hyper (CONNECT proxy) and rustls/tokio-rustls
(SNI peek without interception); both land in Phase 4.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EgressProxy
impl RefUnwindSafe for EgressProxy
impl Send for EgressProxy
impl Sync for EgressProxy
impl Unpin for EgressProxy
impl UnsafeUnpin for EgressProxy
impl UnwindSafe for EgressProxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more