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 | # | Type | Description |
|---|---|---|---|
allow | 1 | repeated string | Destinations that stay reachable where deny blocks them. |
deny | 2 | repeated string | Destinations that are blocked. |
SetSpaceEgressRequest#
Request for SpaceService.SetSpaceEgress.
| Field | # | Type | Description |
|---|---|---|---|
space | 1 | string | Space. |
egress | 2 | EgressPolicy | The 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 withall_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") plusallowanddeny; - "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 | # | Type | Description |
|---|---|---|---|
preset | 1 | string | The preset word; empty is "internet". |
localhost_ports | 2 | repeated uint32 | "localhost": the host loopback ports the Space may reach. |
all_localhost_ports | 3 | bool | "localhost": every port (the daemon's stay blocked). |
allow | 4 | repeated string | Destinations that stay reachable (addresses or CIDRs). |
deny | 5 | repeated string | Destinations that are blocked (addresses, CIDRs or "all"). |
custom_base | 6 | string | "custom": what it starts from, "internet" (empty) or "none". |
widened_by | 7 | string | Set when the Space was allowed more than its parent: who and when. |
via | 8 | string | Where 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 | # | Type | Description |
|---|---|---|---|
settings | 1 | NetworkSettings | Its settings. |
summary | 2 | string | One plain line ("Internet only"). |
widenings | 3 | repeated string | What the settings open beyond "internet", one plain line each. |
enforcement | 4 | string | "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). |
point | 5 | string | Where the rules are enforced, or why its network is cut, for people. |
note | 6 | string | Why its network is not what was asked, in plain words. |
parent | 7 | string | Its parent and its tree's top-level Space (ids); empty for a top-level Space. |
root | 8 | string | Its tree's top-level Space (id); empty for a top-level Space. |
always_blocked | 9 | repeated string | What no setting opens, in plain words. |
notice_pending | 10 | bool | An update changed its settings; say so once. |
tree_address | 11 | string | A 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_json | 12 | string | What 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 | # | Type | Description |
|---|---|---|---|
space | 1 | string | Space. |
ack_notice | 2 | bool | The caller showed the one-time notice about new network defaults: don't show it again. |
GetSpaceNetworkResponse#
Response for SpaceService.GetSpaceNetwork.
| Field | # | Type | Description |
|---|---|---|---|
network | 1 | SpaceNetworkInfo | The Space's network. |
NetworkEvent#
One kind of connection a Space tried and its network refused.
| Field | # | Type | Description |
|---|---|---|---|
reason | 1 | string | Why: "platform:metadata", "default:lan", "default:host-loopback", "user:deny", "default:none", ... |
dst | 2 | string | Where to: "169.254.169.254:80", or the rule's network ("10.0.0.0/8") where only the host's firewall counted it. |
proto | 3 | string | "tcp" or "udp" when known. |
count | 4 | uint64 | How many times. |
last_unix | 5 | uint64 | When the last one was refused (Unix seconds); 0 when unknown. |
GetSpaceNetworkLogRequest#
Request for SpaceService.GetSpaceNetworkLog.
| Field | # | Type | Description |
|---|---|---|---|
space | 1 | string | Space. |
GetSpaceNetworkLogResponse#
Response for SpaceService.GetSpaceNetworkLog.
| Field | # | Type | Description |
|---|---|---|---|
events | 1 | repeated NetworkEvent | Most recent first. |
SetSpaceNetworkRequest#
Request for SpaceService.SetSpaceNetwork.
| Field | # | Type | Description |
|---|---|---|---|
space | 1 | string | Space. |
settings | 2 | NetworkSettings | The whole settings. |
widen | 3 | bool | A child: let it be more open than its parent (recorded). |
tree | 4 | bool | Its children take the same settings (each within its parent's). |
SetSpaceNetworkResponse#
Response for SpaceService.SetSpaceNetwork.
| Field | # | Type | Description |
|---|---|---|---|
applied | 1 | string | "now" or "next_start". |
network | 2 | SpaceNetworkInfo | The 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 | # | Type | Description |
|---|---|---|---|
allow | 1 | repeated string | Destinations that stay reachable where deny blocks them. |
deny | 2 | repeated string | Destinations that are blocked. |
SetHostSpaceEgressRequest#
Request for HostSpacesService.SetHostSpaceEgress.
| Field | # | Type | Description |
|---|---|---|---|
space | 1 | string | The relay machine of the Space (or its local:<name> on the host). |
egress | 2 | HostEgressPolicy | The whole policy; empty removes it. |
SetHostSpaceEgressResponse#
Response for HostSpacesService.SetHostSpaceEgress.
| Field | # | Type | Description |
|---|---|---|---|
enforced | 1 | string | Where 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 | # | Type | Description |
|---|---|---|---|
preset | 1 | string | The preset word; empty is "internet". |
localhost_ports | 2 | repeated uint32 | "localhost": the host loopback ports the Space may reach. |
all_localhost_ports | 3 | bool | "localhost": every port. |
allow | 4 | repeated string | Destinations that stay reachable. |
deny | 5 | repeated string | Destinations that are blocked. |
custom_base | 6 | string | "custom": "internet" (empty) or "none". |
widened_by | 7 | string | Set when the Space was allowed more than its parent. |
via | 8 | string | Where its internet traffic leaves (see the daemon's NetworkSettings.via). |