News for hackers. Stuff that matters.
Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by jauntywundrkind on Tuesday July 11, 2023 @03:45PM (#36686304)
Fwiw, this was mentioned in the NixOS and my descent into insanity submission yesterday, as it's underlying util bwrap, as a possible tool to help the blogger get NixOS running on their campus computers. https://news.ycombinator.com/item?id=36668363

The org maintaining this maintains a bunch of other very high profile containerization/isolations tools: podman container runtime, buildah container builder, skopeo container registry multitool, conmon-rs container monitor, podman desktop gui, youki container runtime, and maintaining the standard reference impl of a bunch of OCI specs (storage, image). There's no higher profile place this work could come from, imo.

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by formerly_proven on Tuesday July 11, 2023 @04:35PM (#36686879)
> The org maintaining this maintains

(That org being mostly Red Hat)

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by solarkraft on Wednesday July 12, 2023 @02:49AM (#36691176)
Or, as we call it now: IBM
Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by nextos on Tuesday July 11, 2023 @06:03PM (#36687862)
It's actually annoying NixOS doesn't offer good default sandboxing. Sandboxing should appeal to the Nix crowd, but somehow it's not been integrated yet. AFAIK, GuixSD is working on sandboxing.

In general, sandboxing is pretty important and an area were Linux distributions are falling behind macOS and mobile.

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by yjftsjthsd-h on Tuesday July 11, 2023 @06:16PM (#36687998)
NixOS supports firejail - https://nixos.wiki/wiki/Firejail
Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by nextos on Tuesday July 11, 2023 @06:22PM (#36688055)
It does, but it is far from seamless / widely used. It is a little bit more than firejail packed for NixOS.
Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by yjftsjthsd-h on Tuesday July 11, 2023 @07:05PM (#36688393)
NixOS is a very DIY/build-whatever-you-want system; what more would you want than it being available including the wrapper function to make applications default to running under it? I guess it could be included in the default ISOs if you wanted to showcase it, but given the non-zero friction it adds I'm not sure about the cost/benefit on that.
Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by nextos on Tuesday July 11, 2023 @08:29PM (#36688976)
I know, I maintain quite a few items in NixPkgs. My point is that Linux distributions are not taking sandboxing seriously compared to mobile or macOS, and this is a big security issue.

E.g., if one runs a compromised binary, such as PyTorch [1], sandboxing as implemented by Firejail or bwrap provides defense in depth. You might be running a compromised binary, but it won't be able to read your entire $HOME and steal your data.

I think NixOS is in a great position to offer seamless integration of one sandboxing framework, thanks to the declarative nature of package derivations. But it'd probably need to support just one framework, as it's a pretty foundational component, just like you can't easily switch from systemd to something else.

[1] https://pytorch.org/blog/compromised-nightly-dependency/

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by tadfisher on Tuesday July 11, 2023 @07:09PM (#36688415)
"Sandboxing" can mean one of ten different things, and the ideal is completely dependent on the use case. I highly doubt the same solution would work for, say, both system services and GUI apps.

Right now, NixOS has declarative containers (based on systemd-nspawn) and FHS-compatible user environments based on bubblewrap (where you bring your own packages; see the pkgs.steam attrset for example).

What do you want out of sandboxing in NixOS?

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by remexre on Tuesday July 11, 2023 @07:13PM (#36688440)
IME (compared to other distros I've used), NixOS actually goes in rather heavily on using the sandboxing features available in systemd.

For instance, most of my machines serve ~name/www as https://.../~name/, but this doesn't work out-of-the-box on NixOS, since nginx's sandbox isn't able to read /home by default.

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by totallywrong on Tuesday July 11, 2023 @08:41PM (#36689054)
> sandboxing is pretty important and an area were Linux distributions are falling behind macOS

How so? Linux has cgroups, namespaces, containers, and things like Flatpak. And these days rootless containers (where you can set even the allowed syscalls) are good for most use cases too.

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by nextos on Tuesday July 11, 2023 @10:33PM (#36689802)
In practice, mainstream distributions do not offer ready-to-use zero-conf sandboxing for userland applications.

There are of course exceptions, like those using Flatpak, but what I would like to see is Firejail/bwrap applied to all binaries, with sane defaults.

In other words, if I run python or Firefox and they get compromised, they should not be able to read e.g. ~/.ssh and steal my private keys (unless I gave them permission to).

Nix has done a great work making dependencies declarative and reproducible, I would also like clean sandboxing as it is an equally important issue.

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by imglorp on Wednesday July 12, 2023 @12:43AM (#36690550)
> Firejail/bwrap applied to all binaries, with sane defaults

Isn't that kinda SELinux in the limit?

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by nurple on Tuesday July 11, 2023 @08:55PM (#36689173)
In 23.05 (the latest release) `buildFHSEnv` was added, which creates an FHS environment inside of a bubblewrap sandbox.

https://nixos.org/manual/nixpkgs/stable/#sec-fhs-environment...

ETA Code (note control over namespaces available for "unshare"): https://github.com/NixOS/nixpkgs/blob/aae1f384fdaecfbeba100c...

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by CJefferson on Tuesday July 11, 2023 @10:13PM (#36689688)
I do wonder if some future Nix-variant which based around sandboxing first could make life easier.

Nix seems to have to put lots of work into handling programs that expect to find to find /bin/bash. An alternative would be to put programs in custom sandboxes, where /bin/bash is found exactly where they expect to find it.

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by remexre on Wednesday July 12, 2023 @12:59AM (#36690632)
I think that still requires lots of work, since lots of programs expect to be able to pass around paths to children/parents and have those paths remain openable.

For instance, if both cmake and ld get their own sandboxes, with their own view of /lib, it seems pretty likely that cmake's -L flags will get mixed up, in a way that's harder to debug than "oh, CMake passed -L/lib/foo; nothing should use /lib, so I need to find where that's hardcoded."

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by awegio on Wednesday July 12, 2023 @05:21AM (#36692118)
> put programs in custom sandboxes, where /bin/bash is found exactly where they expect to find it

NixOS can do that, I think it was necessary to get Steam games running

https://nixos.org/manual/nixpkgs/stable/#sec-fhs-environment...

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by WastingMyTime89 on Wednesday July 12, 2023 @06:20AM (#36692505)
> an area were Linux distributions are falling behind macOS and mobile.

Projects that matter in the Linux world have all understood that and are working on it from systemd starting spanwd to Gnome being all-in on Flatpak.

For all the publicity it's getting there, NixOS is really a very niche effort with little man-power.

Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by ryanschneider on Tuesday July 11, 2023 @10:12PM (#36689681)
It was also mentioned recently in Julia Evans’ lima post: https://news.ycombinator.com/item?id=36668964
Re:Bubblewrap – Low-level unprivileged sandboxing tool used ... by ossusermivami on Tuesday July 11, 2023 @11:57PM (#36690306)
It's mostly (great) Red Hat containers projects