The network interface
one interface for users for app developers
Client network access through AppArmor and seccomp rules. The slot is implicit on every system and nothing in the rule denies so the plug auto-connects at install on classic and on Ubuntu Core. Listening for connections and configuring the network are separate interfaces.
On the map: a postern south of the gatehouse
01 What network grants
Client network access: name lookups, IPv4 and IPv6 sockets and the system certificates through AppArmor, a few extra system calls through seccomp. Listening is network-bind; configuring the network is network-control.
On the gateway, acme-agent sends its readings to a server, the one named in its server setting. To reach it, the snap needs the network plug. What that grants is client access. Its AppArmor rules let the agent look up names, open IPv4 and IPv6 sockets, and read the system's certificates for TLS. Its seccomp rules add a few system calls, such as bind. What network doesn't give is the server side, listening for connections and accepting them: that's network-bind. And changing how the network itself is set up is network-control.
02 Auto-connects everywhere general version
The rule only places the slot on the system; with no deny rules, network auto-connects at install on every system. The implicit slot is on the snapd snap where it is installed; state records it as core and the CLI shows system.
Unlike home, network asks for nothing. Its rule in the base declaration only says where the slot lives: on the system. Nothing in it denies, so installation, connection and auto-connection all fall back to allowed. On the gateway, the plug connects the moment acme-agent is installed, and on a laptop just the same. The slot is implicit: snapd makes it itself, and no snap.yaml declares it. It used to sit on the core snap. Where the snapd snap is installed, that snap carries it now, while the state still says core and the command line says system.
03 Connected everywhere for users in place of the general version
Connected automatically on every system. The system's slot shows as :network. Disconnecting is possible and remembered across refreshes.
On the gateway, acme-agent was connected to the network the moment it was installed, and the same happens on any laptop or desktop. snap connections shows it: acme-agent's network plug is connected to :network. There's no snap name before the colon, because the slot belongs to the system itself. If you want an app off the network, snap disconnect does that, and snapd remembers your choice, so a refresh won't reconnect it.
Read more
What you give a snap
Name lookups, outgoing connections and the system's certificates; not listening for connections.
for app developers for snapd developers
What the plug allows
| Through | Allows |
|---|---|
| AppArmor | the nameservice abstraction (name lookups and IPv4 and IPv6 stream and datagram sockets), /run/systemd/resolve/stub-resolv.conf, /etc/mdns.allow, netlink datagram sockets, the Resolve* calls of systemd-resolved and the dynamic-user lookups of systemd over D-Bus, the ssl_certs abstraction, two /proc/sys/net values, and running nc as a client |
| seccomp | bind, socket for AF_NETLINK with NETLINK_ROUTE, and socket for AF_CONN (SCTP in user space) |
Without the plug, AppArmor denies IPv4 and IPv6 sockets. connect and socket for most families are already in the default seccomp filter; listen and accept are not.
Neighbours
| Interface | Adds | Auto-connects |
|---|---|---|
network | client access | yes |
network-bind | listen, accept, accept4: operating as a server. a socket-activated service needs it | yes |
network-status | asking whether the system is online | yes |
network-observe | reading network state | no |
network-control | changing network configuration | no |
The rest of the family is in the network family.
Connecting
- The plug connects when the snap is installed, on classic systems and on Ubuntu Core.
snap connections <snap>shows the slot as:network.snap disconnect <snap>:networkcuts the app off. Because the connection was automatic, snapd records it as undesired and a refresh does not reconnect it.snap connect <snap>:networkconnects it again.
for app developers
The rule and the implicit slot
The base declaration says only allow-installation: slot-snap-type: [core] for the slot. With no deny rules, connection and auto-connection fall back to allowed.
The slot is implicit on classic and on Ubuntu Core. Where the snapd snap is installed, snapd hosts the implicit slots on it; the state records them on core, as before the snapd snap existed, and the API and snap command show them on system. A request may name the slot as :network, system:network or core:network.
Further reading
- The network interface: the published reference entry.
- The network-bind interface: the server side.
- Connect interfaces: listing, connecting and disconnecting plugs.
Roads from here
INTERFACES AND CONFINEMENT
- Interfaces — back to interfaces
- The home interface — another single interface with a stricter rule
- The content interface — another single interface
- Confinement — the profiles behind it: AppArmor and seccomp
- Interfaces for users — how to disconnect it and connect it again
INTERFACE FAMILIES · every interface, grouped by what it touches
- "Interfaces: network" — the whole network family including network-bind and network-control