pub struct EgressPolicy {
pub allowed_cidrs: Vec<String>,
pub allowed_domains: Vec<String>,
pub allowed_tcp_ports: Vec<u16>,
pub allowed_udp_ports: Vec<u16>,
pub log_denied: bool,
pub allow_dns: bool,
}Expand description
Egress policy for audited outbound network access.
When set, iptables OUTPUT chain rules restrict which destinations the
container process can connect to. Use EgressPolicy::deny_all when no
outbound connections, including DNS, should be permitted.
Fields§
§allowed_cidrs: Vec<String>Allowed destination CIDRs (e.g., “10.0.0.0/8”, “192.168.1.0/24”).
allowed_domains: Vec<String>Allowed exact DNS names. These are resolved to IPv4 /32 rules at startup.
allowed_tcp_ports: Vec<u16>Allowed destination TCP ports. Empty means all ports on allowed CIDRs.
allowed_udp_ports: Vec<u16>Allowed destination UDP ports.
log_denied: boolWhether to log denied egress attempts (rate-limited).
allow_dns: boolWhether to add implicit DNS (port 53 UDP/TCP) allow rules for configured
resolvers. Defaults to true for explicit allowlist usability.
Implementations§
Source§impl EgressPolicy
impl EgressPolicy
Sourcepub fn with_allowed_cidrs(self, cidrs: Vec<String>) -> Self
pub fn with_allowed_cidrs(self, cidrs: Vec<String>) -> Self
Allow egress to the given CIDRs on any port.
Sourcepub fn with_allowed_domains(self, domains: Vec<String>) -> Self
pub fn with_allowed_domains(self, domains: Vec<String>) -> Self
Allow egress to the given exact DNS names.
pub fn with_allowed_tcp_ports(self, ports: Vec<u16>) -> Self
pub fn with_allowed_udp_ports(self, ports: Vec<u16>) -> Self
Sourcepub fn credential_broker_only(broker: &CredentialBrokerConfig) -> Self
pub fn credential_broker_only(broker: &CredentialBrokerConfig) -> Self
Create a deny-by-default policy that only permits TCP egress to the configured host-side credential broker.
Sourcepub fn is_credential_broker_only(&self, broker: &CredentialBrokerConfig) -> bool
pub fn is_credential_broker_only(&self, broker: &CredentialBrokerConfig) -> bool
Return true when this policy permits no direct outbound route except the configured credential broker endpoint.
Trait Implementations§
Source§impl Clone for EgressPolicy
impl Clone for EgressPolicy
Source§fn clone(&self) -> EgressPolicy
fn clone(&self) -> EgressPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more