In chroot builds, use a private network namespace
In chroot builds, use a private network namespace

On Linux it's possible to run a process in its own network namespace,
meaning that it gets its own set of network interfaces, disjunct from
the rest of the system.  We use this to completely remove network
access to chroot builds, except that they get a private loopback
interface.  This means that:

- Builders cannot connect to the outside network or to other processes
  on the same machine, except processes within the same build.

- Vice versa, other processes cannot connect to processes in a chroot
  build, and open ports/connections do not show up in "netstat".

- If two concurrent builders try to listen on the same port (e.g. as
  part of a test), they no longer conflict with each other.

This was inspired by the "PrivateNetwork" flag in systemd.

aucampia/nix,offlinehacker/nix,vcunat/nix,shlevy/nix,rowhit/nix,rycee/nix,ttuegel/nix,ehmry/nix,vcunat/nix,bennofs/nix,joelmo/nix,ehmry/nix,ysangkok/nix,vcunat/nix,garbas/nix,vizanto/nix,edolstra/nix,peti/nix,layus/nix,dtzWill/nix,rycee/nix,NixOS/nix,peti/nix,NixOS/nix,zimbatm/nix,shlevy/nix,bennofs/nix,acowley/nix,bennofs/nix,garbas/nix,edolstra/nix,bjornfor/nix,ehmry/nix,edolstra/nix,dtzWill/nix,tchajed/nix,zimbatm/nix,joelmo/nix,peti/nix,wmertens/nix,pikajude/nix,jcumming/nix,rowhit/nix,zimbatm/nix,gridaphobe/nix,garbas/nix,dtzWill/nix,garbas/nix,wmertens/nix,layus/nix,acowley/nix,nbp/nix,tchajed/nix,puffnfresh/nix,NixOS/nix,puffnfresh/nix,dtzWill/nix,nbp/nix,puffnfresh/nix,dezgeg/nix,gridaphobe/nix,aucampia/nix,jcumming/nix,edolstra/nix,bjornfor/nix,rycee/nix,shlevy/nix,ttuegel/nix,rowhit/nix,rowhit/nix,gridaphobe/nix,edolstra/nix,shlevy/nix,garbas/nix,dezgeg/nix,ehmry/nix,tchajed/nix,bjornfor/nix,peti/nix,aucampia/nix,layus/nix,peti/nix,nbp/nix,acowley/nix,jcumming/nix,vizanto/nix,bjornfor/nix,layus/nix,nbp/nix,ehmry/nix,wmertens/nix,vizanto/nix,pikajude/nix,ttuegel/nix,dezgeg/nix,aucampia/nix,pikajude/nix,gebner/nix,joelmo/nix,vizanto/nix,rycee/nix,ysangkok/nix,jcumming/nix,wmertens/nix,joelmo/nix,ehmry/nix,ysangkok/nix,bennofs/nix,tchajed/nix,gebner/nix,shlevy/nix,gridaphobe/nix,rycee/nix,dezgeg/nix,gebner/nix,dtzWill/nix,NixOS/nix,layus/nix,offlinehacker/nix,puffnfresh/nix,offlinehacker/nix,NixOS/nix,offlinehacker/nix,dezgeg/nix,zimbatm/nix,acowley/nix,ttuegel/nix,vcunat/nix,gebner/nix