egress: the forward chain accepts the flows the host publishes for the agents
On a host with the egress intercept on, the forward chain rejected an agent's traffic to the queue once the queue ran as a pod: the pod's hostPort rewrites the destination to the pod, and the packet then leaves the bridge for the cluster. The chain now accepts TCP that the host's NAT redirected whose original destination is the bridge's address at a published port, which the queue adds when it runs in the cluster. Everything else from the bridge to the cluster stays refused. The nats switch test runs with the intercept on.
This commit is contained in:
parent
e29a8e71f3
commit
e7ccc41652
2 changed files with 121 additions and 9 deletions
|
|
@ -228,7 +228,11 @@ holds the container back until the pod has gone.
|
|||
read before the DNAT: a packet for the node's address and the client port is
|
||||
dropped unless it arrives on the host's loopback, the hive bridge or a pod
|
||||
interface, or unless `deploy.nats.openFirewall` is on. The container's port
|
||||
has that reach.
|
||||
has that reach. The hostPort sends the bridge's agents to the cluster, which a
|
||||
host with the egress intercept on refuses, so the module also adds the port to
|
||||
`egress.publishedPorts`
|
||||
([the egress chain](../networking/network.md#agent-bridge-egress-log)): agents
|
||||
reach the pod through the published port and no other way.
|
||||
- **The exporter's port.** The exporter's port has no `hostPort`: a ClusterIP
|
||||
Service, `swarm-nats-metrics`, fronts it, and the gateway's `/metrics`
|
||||
location on the host dials the Service's name through nginx's `resolver` (the
|
||||
|
|
|
|||
|
|
@ -757,6 +757,18 @@ also refuses the flow.
|
|||
`reject` doesn't stop an agent from reaching them when they run on another
|
||||
host. The forge and matrix gateways need no line: the hive's resolver answers
|
||||
their names with the bridge address, which the forward chain never sees.
|
||||
- **Published services.** After the `agent_allow` rule the chain accepts TCP
|
||||
that the host's own NAT redirected (`ct status dnat`) when the flow's
|
||||
original destination (`ct original`) is the bridge's address at a port in
|
||||
`services.hyperhive.deploy.hive-controller.egress.publishedPorts`, in both
|
||||
modes, so such a flow leaves no count and no line. A module that publishes a
|
||||
port adds it: the queue in the cluster adds its client port, because the
|
||||
pod's `hostPort` rewrites the destination to the pod and the packet then
|
||||
leaves the bridge for the cluster. An agent dials the queue's name, which the
|
||||
hive's resolver answers with the bridge's address. A flow to the pod's own
|
||||
address has no redirect, and one to the node's address has another original
|
||||
destination, so both stay refused. The set is empty, and the chain has no
|
||||
such rule, while no module publishes a port.
|
||||
- **What `reject` refuses.** Everything from the bridge to the uplink that the
|
||||
chain didn't exempt or allow, whether a flow is new or not: TCP on any port
|
||||
but the 80 and 443 that squid takes, UDP (DNS to an outside resolver, QUIC
|
||||
|
|
|
|||
Loading…
Reference in a new issue