Skip to main content

EgressProxy

Struct EgressProxy 

Source
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

Source

pub fn new() -> Self

Construct an egress proxy that is fail-closed (PRODUCT.md W0) and tagged with the current platform’s EnforcementTier.

Source

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:

  1. Peek the first record to extract SNI / CONNECT host without MITM into a PeekedHost (PRODUCT.md B.5 step 2).
  2. Resolve the originating ConnectionRequest::pid (SO_PEERCRED / LOCAL_PEERPID) so the PDP can fuse syscall context (PRODUCT.md B.6).
  3. Call pdp.authorize(&req) (PRODUCT.md B.5 step 2-3).
  4. Decision::Allow => splice to the upstream; otherwise Self::hard_rst (PRODUCT.md B.5 step 4).
  5. 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§

Source§

impl Default for EgressProxy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more