123 points · by kettunen · 5y ago · 30 comments
https://blog.uidrafter.com/engineering/freebsd-jails-network...
Why VNET? "VNET jails give each jail its own isolated copy of the network stack" https://klarasystems.com/articles/virtualize-your-network-on...
I like the simplicity and how straightforward it is to add new servers to our home. I have long history with docker, but kind of prefer the way of being able to ssh into the jail and manage it like a normal server distro. Docker again is much nicer in the daily development flow, where I want nine different databases in a clean state every morning.
I have now only pihole running on LXD and it's ok.
My unbound dns server, for instance, has something like 24 total files in it. The reason it has so many is because I run two different jails from it - my unbound jail and my nsd jail share the same directory/mountpoint.
Which is to say, I run two different jail commands, that start two different jails with different IPs and startup commands, but they both point to the same directory/mountpoint.
Updates consist of replacing a few binary executables.
Not everything will fit into that model, but when it does, it is fantastic.
jail -c path=/ ip4.addr=disable ip6=inherit command=/bin/csh
for instance would run the command "/bin/csh" and jail it so that it doesn't get access to any IPv4 and it allows communications over IPv6 only.So you can use jails to sandbox applications. You can also mount all paths are read-only and only the paths required for the application as read/write. jails can be very handy for all kinds of operations around that, there is no requirement that you provide the jail with a copy of the user land again, although that is the easiest way to run jails.
I have no doubt that Linux containers are just as secure as FreeBSD Jails, but if the implementation and tooling is complex, there is a much higher risk of something being configured wrong.
And then there's the giant gorilla in the room, Docker, which probably has the best tooling of them all, and initially used Linux containers, but has since moved on to their own container implementation (runC, https://www.docker.com/blog/runc/).
RunC isn't "their own implementation" but rather an OCI (Open Containers Initiative) standard that world seems to be adopting and I wish FreeBSD Jails would be a part of it.