Egress policies

EgressPolicy: which destinations a Space may open connections to, enforced by the host outside the guest.

The egress policy CreateSpaceRequest.egress and SpaceService.SetSpaceEgress take and Space.egress returns, and its host form for HostSpacesService.SetHostSpaceEgress.

Source: libs/cua/proto/cua/daemon/v1/egress.proto, libs/cua/proto/cua/env/v1/host_egress.proto.

Types in cua/daemon/v1/egress.proto#

EgressPolicy#

Which destinations a Space may open connections to. Everything is allowed unless a rule says otherwise: every deny entry blocks that destination, every allow entry is an exception that wins over deny (deny "all" with allow "1.1.1.1" leaves only 1.1.1.1 reachable), and an allow list with no deny blocks nothing. Entries are IPv4/IPv6 addresses or CIDRs; "all" is 0.0.0.0/0 and ::/0; a hostname is refused. DNS works only while the resolver's address is not blocked (or is allowed). Loopback, replies to connections made to the guest and IPv6 neighbor discovery are never filtered.

Field#TypeDescription
allow1repeated stringDestinations that stay reachable where deny blocks them.
deny2repeated stringDestinations that are blocked.

SetSpaceEgressRequest#

Request for SpaceService.SetSpaceEgress.

Field#TypeDescription
space1stringSpace.
egress2EgressPolicyThe whole policy; empty removes it.

SetSpaceEgressResponse#

Response for SpaceService.SetSpaceEgress.

No fields.

NetworkSettings#

A Space's network settings: a preset, the user's own lists, and what the host compiles them to. Space.network_settings and CreateSpaceRequest.network_settings carry it. The presets:

  • "internet" (the default): the public internet and the Space's own tree; the host, the local network, cloud metadata, other trees and the daemon are blocked;
  • "none": no network;
  • "localhost": "internet", plus the host's loopback on localhost_ports (every port only with all_localhost_ports; the ports go with "localhost+lan" too);
  • "lan": "internet", plus the local network (not the host itself);
  • "localhost+lan": "internet", plus both of the above (the two extras are independent; this is the one preset with both);
  • "custom": custom_base ("internet" or "none") plus allow and deny;
  • "unprotected": everything but cloud metadata, other trees and the daemon.

allow and deny apply on top of any preset but "none": an allow is an exception to a deny and to the default blocks (not the host itself, which only "localhost" opens).

Field#TypeDescription
preset1stringThe preset word; empty is "internet".
localhost_ports2repeated uint32"localhost": the host loopback ports the Space may reach.
all_localhost_ports3bool"localhost": every port (the daemon's stay blocked).
allow4repeated stringDestinations that stay reachable (addresses or CIDRs).
deny5repeated stringDestinations that are blocked (addresses, CIDRs or "all").
custom_base6string"custom": what it starts from, "internet" (empty) or "none".
widened_by7stringSet when the Space was allowed more than its parent: who and when.
via8stringWhere its internet traffic leaves ("Exit through"): empty or "internet" for its own network, "this-machine" (the hotspot), "space:<id>" (a Space of its tree) or socks5://host:port. With an exit the Space's own internet is closed, and the exit applies its rules first. A child keeps its parent's exit.

SpaceNetworkInfo#

A Space's network as cua network show says it.

Field#TypeDescription
settings1NetworkSettingsIts settings.
summary2stringOne plain line ("Internet only").
widenings3repeated stringWhat the settings open beyond "internet", one plain line each.
enforcement4string"enforced" (rules on the host, outside the guest), "no_network" (its runtime can't protect it yet, so it has none), "open" (No protection) or "refused"; empty when unknown (a Space another machine runs).
point5stringWhere the rules are enforced, or why its network is cut, for people.
note6stringWhy its network is not what was asked, in plain words.
parent7stringIts parent and its tree's top-level Space (ids); empty for a top-level Space.
root8stringIts tree's top-level Space (id); empty for a top-level Space.
always_blocked9repeated stringWhat no setting opens, in plain words.
notice_pending10boolAn update changed its settings; say so once.
tree_address11stringA VM's address in its tree (198.19.0.0/16): what the other members of its tree connect to. Empty for a container (its tree's members reach it on their tree's own network) and for a Space another machine runs.
topology_json12stringWhat cua network show --json prints as topology, as JSON text: the hint written into the guest (/etc/cua/network.json: its name and address, its tree's members, the host and the ports it may reach there, its policy and its exit) plus the exit's and the host ports' state and the path its traffic takes to other machines. Empty when unknown (an older daemon).

GetSpaceNetworkRequest#

Request for SpaceService.GetSpaceNetwork.

Field#TypeDescription
space1stringSpace.
ack_notice2boolThe caller showed the one-time notice about new network defaults: don't show it again.

GetSpaceNetworkResponse#

Response for SpaceService.GetSpaceNetwork.

Field#TypeDescription
network1SpaceNetworkInfoThe Space's network.

NetworkEvent#

One kind of connection a Space tried and its network refused.

Field#TypeDescription
reason1stringWhy: "platform:metadata", "default:lan", "default:host-loopback", "user:deny", "default:none", ...
dst2stringWhere to: "169.254.169.254:80", or the rule's network ("10.0.0.0/8") where only the host's firewall counted it.
proto3string"tcp" or "udp" when known.
count4uint64How many times.
last_unix5uint64When the last one was refused (Unix seconds); 0 when unknown.

GetSpaceNetworkLogRequest#

Request for SpaceService.GetSpaceNetworkLog.

Field#TypeDescription
space1stringSpace.

GetSpaceNetworkLogResponse#

Response for SpaceService.GetSpaceNetworkLog.

Field#TypeDescription
events1repeated NetworkEventMost recent first.

SetSpaceNetworkRequest#

Request for SpaceService.SetSpaceNetwork.

Field#TypeDescription
space1stringSpace.
settings2NetworkSettingsThe whole settings.
widen3boolA child: let it be more open than its parent (recorded).
tree4boolIts children take the same settings (each within its parent's).

SetSpaceNetworkResponse#

Response for SpaceService.SetSpaceNetwork.

Field#TypeDescription
applied1string"now" or "next_start".
network2SpaceNetworkInfoThe Space's network after the change.

Types in cua/env/v1/host_egress.proto#

HostEgressPolicy#

Which destinations a Space may open connections to: every deny entry blocks that destination, every allow entry is an exception that wins over deny. Entries are IPv4/IPv6 addresses or CIDRs; "all" is 0.0.0.0/0 and ::/0; a hostname is refused.

Field#TypeDescription
allow1repeated stringDestinations that stay reachable where deny blocks them.
deny2repeated stringDestinations that are blocked.

SetHostSpaceEgressRequest#

Request for HostSpacesService.SetHostSpaceEgress.

Field#TypeDescription
space1stringThe relay machine of the Space (or its local:<name> on the host).
egress2HostEgressPolicyThe whole policy; empty removes it.

SetHostSpaceEgressResponse#

Response for HostSpacesService.SetHostSpaceEgress.

Field#TypeDescription
enforced1stringWhere the policy is enforced: "host"; empty after a removal.

HostNetworkSettings#

A Space's network settings (cua.daemon.v1.NetworkSettings), as CreateHostSpaceRequest.network_settings carries them to the host that creates the Space and enforces them.

Field#TypeDescription
preset1stringThe preset word; empty is "internet".
localhost_ports2repeated uint32"localhost": the host loopback ports the Space may reach.
all_localhost_ports3bool"localhost": every port.
allow4repeated stringDestinations that stay reachable.
deny5repeated stringDestinations that are blocked.
custom_base6string"custom": "internet" (empty) or "none".
widened_by7stringSet when the Space was allowed more than its parent.
via8stringWhere its internet traffic leaves (see the daemon's NetworkSettings.via).