Skip to main content
Namespace isolation is an opt-in Linux layer that runs the sandboxed command inside new kernel namespaces, on top of the normal Landlock and seccomp sandbox. It is off by default and must be explicitly enabled with the --isolate flag or the corresponding profile settings.
Or in a profile:

What each namespace does

Every request also creates a user namespace. It maps your own uid and gid to themselves, so files keep their owners and id reports your user. It is what lets an unprivileged process create the other namespaces. The capabilities the setup step holds inside that namespace do not survive into your command: the sandboxed process runs with no capabilities. Network isolation closes some of the same classes as Landlock’s scoping and network rules, but it does so on every kernel nono supports. Landlock abstract-socket scoping needs ABI V6 (Linux 6.12), and Landlock network rules cover TCP only.
Pathname Unix sockets (such as /run/user/1000/bus or /var/run/docker.sock) use filesystem paths as addresses, but they are not part of the IP network namespace. Use mounts to hide them (see Mount masks), or linux.af_unix_mediation to mediate them.

Mount masks

Below Landlock ABI 9, Landlock does not govern connect(2) to a pathname Unix socket. A sandboxed command that can name /run/user/1000/bus can reach the D-Bus session bus, or the systemd user manager, and ask it to start processes outside the sandbox. The same applies to docker.sock and other daemons that accept local connections. mounts hides these endpoints instead of mediating each connect:
The command runs in a new mount namespace in which nono covers: The rest of the filesystem is untouched; this is a mask over your machine, not a container root. A path that does not exist on the host, or that your user cannot reach, is not masked because the command could not reach it either. $XDG_RUNTIME_DIR comes from the environment, so nono masks it only when it names a directory you own; /run/user/<uid> is masked either way. Grants stay reachable. Every path the profile grants beneath a mask, including unix_socket grants, is bound back into place over the mask. To let an agent use one socket in your runtime directory, grant that socket:
A grant of a whole masked directory does not re-expose it. A /tmp grant (included in nono’s default write groups) applies to the session’s private /tmp, and a grant of $XDG_RUNTIME_DIR applies to the empty tmpfs that covers it. Grant individual paths beneath the mask instead.
Any filesystem grant beneath a mask is re-bound, not only unix_socket grants. A read-only grant of a directory under a mask makes every socket in that directory connectable, because Landlock below ABI 9 does not govern connect(2). The same applies when $TMPDIR points at a subdirectory of /tmp and the profile grants $TMPDIR. Grant the narrowest path you need.
If the working directory lies under a mask and the profile does not grant it, nono refuses to start: that directory does not exist inside the sandbox. Grant it with --allow-cwd or the profile’s workdir access, or start from another directory. Extra masks. linux.isolate.extra_masks adds paths to mask, with the usual variable expansion. It is additive: no profile layer or pack can remove a default or inherited mask.
The masks cannot be removed from inside the sandbox. The command holds no capabilities, Landlock forbids mount changes, and the kernel locks the masks in any namespace the command creates itself. Nested user and mount namespaces (for example, unshare -Um in a build tool) still work. The host can remove a mask. A mask is a mount on a host path. When a host process deletes or replaces that path, the kernel detaches the mask in every namespace. Restarting a daemon or its socket unit, or upgrading its package, does this to its socket. Logging out and back in does the same to /run/user/<uid>. nono watches the sandbox’s mount table for the whole session. If a mask disappears, or a new mount covers one, nono kills every process in the sandbox and reports which mask was lost:
The watch reacts to the kernel’s mount-change notification. That fires when the old socket is removed, which is normally before a restarted daemon creates its new one; a daemon that atomically renames a new socket over the old one leaves a window of a few milliseconds. Directory masks over a daemon’s own directory (/run/containerd, /run/podman, …) are not affected by socket restarts at all. nono why --unix-socket <path> reports when a socket is hidden by the mask. Inside a sandbox, nono why --self reports the masks that sandbox applied. mounts cannot be combined with security.capability_elevation: approved paths are opened by the supervisor outside the sandbox’s mount namespace and would bypass the masks.

Local servers on loopback

By default an isolated command cannot use TCP even on its own loopback. nono’s normal network rules still apply inside the namespace: --block-net denies TCP sockets, and proxied mode allows a connection only to the proxy port. Dev servers, test suites that listen on 127.0.0.1, and language servers over TCP all fail. Add loopback to allow them:
With loopback, the command can bind, listen, and connect on any TCP port on 127.0.0.1 and ::1 inside the namespace. That loopback belongs only to the sandbox:
  • Nothing on the host can connect to these listeners, and the command still cannot reach host localhost services.
  • Egress is unchanged: the only way out is still the nono proxy, with the same filtering and authentication.
  • UDP, raw sockets, and netlink stay denied.
  • The proxy port is already held by nono’s bridge listener, so the command cannot take it over.
loopback requires net; on its own it is a startup error, because without the namespace it would reach the host’s localhost. --open-port, --listen-port, and --allow-connect-port stay rejected under isolation, because they refer to the host’s localhost, not the namespace’s.

Networking inside the namespace

The isolated network has no route to the host or the internet. The only way out is via the session proxy:
  • Network blocking:--block-net results in no proxy and no bridge - loopback only.
  • Proxied networking: --allow-domain, --network-profile, credentials etc: A loopback listener inside the namespace on the proxy’s port which is served from the supervisor.
Because the namespace has no other way out, the following combinations produce startup errors for safe informative failure, rather than silent.

Merging and precedence

linux.isolate fields merge by logical OR across extends, packs, and the CLI. Any layer can turn a namespace on, and no layer can turn one off. --isolate adds to a profile’s isolation; it cannot remove it. extra_masks lists merge by deduplicated append.

Host requirements and failure

nono probes the host at startup by actually creating the namespaces in a scratch process. If the host refuses, nono stops with an error that names the step that failed and the likely cause. Some common causes include:
  • Ubuntu 23.10 and later restrict unprivileged user namespaces with AppArmor (kernel.apparmor_restrict_unprivileged_userns = 1). Allow nono specifically by installing an AppArmor profile, for example /etc/apparmor.d/nono:
    Adjust the path to where your nono binary is installed, then run sudo apparmor_parser -r /etc/apparmor.d/nono. This lets any local user obtain an unprivileged user namespace through nono, the same trade Ubuntu makes for its bubblewrap profile.
  • Containers. Docker’s and Kubernetes’ default seccomp profiles block unshare. See Externally provisioned namespaces.
  • Hardened kernels with kernel.unprivileged_userns_clone = 0 or user.max_user_namespaces = 0.
  • Mount restrictions. With mounts, a security module (AppArmor or SELinux mount rules) or a seccomp filter that blocks the mount API (fsopen, fsmount, move_mount) refuses the mask. The error names the path and step that failed.

Externally provisioned namespaces

Where unprivileged user namespaces cannot be enabled, create the namespace outside nono with the privileges you already have and run an unchanged nono inside it, without --isolate. Examples: sudo ip netns exec, systemd-run -p PrivateNetwork=yes, or the container itself. nono never runs privileged setup code itself.

Limits

  • Linux only. On macOS, linux.isolate is ignored and --isolate is not available. Seatbelt’s deny-default profile covers the socket classes independently.
  • nono run and nono shell only. nono wrap has no supervisor to create the namespaces or serve the proxy bridge, so it rejects profiles that set linux.isolate.
  • Supplementary groups appear as nobody inside the namespace, because only your primary uid and gid are mapped. The kernel still applies your real groups for file access.
  • Kernel attack surface. Unprivileged user namespaces expose more kernel code to the sandboxed process. See the security model.
  • loopback is Linux-only. On macOS a profile that relies on it for a local server still needs network.listen_port.
  • Masks are fixed at launch. A socket created under an unmasked path after the session starts is not masked, and a granted path that does not exist at launch cannot be re-bound. A host change that removes a mask ends the session (see above). The watch stops when the sandboxed command exits, so a background process that outlives the command is no longer protected by it.
  • mounts hides GUI and agent sockets. X11, Wayland and ssh-agent sockets under masked paths are unreachable unless granted.
  • Not yet available: a SOCKS5 route for non-HTTP TCP, and reverse forwarding for listen ports. These are planned under NEP-0004.