<p dir="ltr"><br>
On Apr 20, 2015 9:07 AM, "Lennart Poettering" <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br>
><br>
> On Mon, 20.04.15 08:51, Andy Lutomirski (<a href="mailto:luto@amacapital.net">luto@amacapital.net</a>) wrote:<br>
><br>
> > > > > I will grant you that they aren't particularly expressive, and I will<br>
> > > > > grant you that one day there might be better concepts. But that's not<br>
> > > > > a strong reason not to support them really, that's just a reason to<br>
> > > > > later add support for something better.<br>
> > > ><br>
> > > > Technical reasons:<br>
> > > ><br>
> > > > 1. They can't be usefully delegated to a namespace.<br>
> > ><br>
> > > Not sure I can parse that. If you use the bus to communicate across<br>
> > > namespace boundaries then each side lacks caps for the other. Great,<br>
> > > that's how it should be. And same as for uid checks btw... if a uid<br>
> > > cannot be translated, then it will not be passed!<br>
> ><br>
> > No.   You're right for nspawn-style namespaces, but not for namespaces more<br>
> > broadly.  Namespaces are a great way to drop various privileges, but your<br>
> > use of caps prevents certain uses (e.g. confining your hypothetical<br>
> > time-setting daemon in a namespace).<br>
><br>
> I have seen no use of userns for sandboxing normal daemons so far. I<br>
> have seen tons of daemons using caps for such sandboxing.</p>
<p dir="ltr">Sandstorm.io</p>
<p dir="ltr">I bet Chromium will follow suit, and don't forget Docker and similar tools.</p>
<p dir="ltr">><br>
> maybe if userns in its current iteration doesn't mix as well as you'd<br>
> like it with caps this is indication that userns might need some more<br>
> polish, and not that caps are necessarily the bad guy here?<br>
></p>
<p dir="ltr">Nope, userns works just fine.</p>
<p dir="ltr">> I mean, as the one who added most of the sandboxing features we expose<br>
> in systemd .service files currently (including things like<br>
> ReadOnlyDirectories=, PrviateTmp=, PrivateNetwork= which are all based<br>
> on kernel namespacing), I completely fail to see how we could even<br>
> expose user namespace like this in a good way that would hold water?<br>
> Capability-based sandboxing on the other hand is much easier to<br>
> handle, and in many cases a highly efficient way to sandbox stuff. Two<br>
> examples:</p>
<p dir="ltr">There's a world outside systemd and, in that world, programs would like to be able to sandbox themselves.  Userns is wonderful for that purpose.<br></p>
<p dir="ltr">><br>
>     systemd-networkd drops privileges, becomes the "systemd-network"<br>
>     user, only retains CAP_NET_ADMIN. That's actually already a really<br>
>     good sandbox!<br>
><br>
>     systemd-timesyncd drops privileges, becomes the "systemd-timesync"<br>
>     user, only retains CAP_SYS_TIME. And that's actually a really good<br>
>     sandbox too!<br>
><br>
> Both daemons are network facing, hence sandboxing things like this is<br>
> actually of quite some importance, and it *works*! Today! And it is<br>
> easy! easy enough for most administrators to grok it easily! And<br>
> because of that it is actually *good* security!</p>
<p dir="ltr">Except that if it's too coarse-gained, it fails to actually separate privileges.</p>
<p dir="ltr">><br>
> And please don't discount these two daemons as irrelevant<br>
> examples. They are highly relevant, since they run on a good chunk of<br>
> Linux systems, as one of the few daemons that run really everywhere.<br>
><br>
> Caps *do* have good uses, please don't claim otherwise. They are a<br>
> *lot* more relevant on today's system than userns at least!<br>
><br>
> (Note that I am not saying that userns are really a bad idea or so, I<br>
> just would like to ask you to keep things in perspective: caps are<br>
> *good* -- even though they could be much better. And they are a ton<br>
> more useful and used than userns right now)<br>
><br>
> > > OK, they are not very expressive, I granted you that already. But they<br>
> > > are still more expressive than "uid == 0".<br>
> > ><br>
> > > That they are not expressive is something I can agree with, as<br>
> > > mentioned above, but I don't consider this a real issue not to using<br>
> > > them. I mean, it would be great if we had something better in the<br>
> > > kernel, like capsicum or whatever, but we don't. And since caps are<br>
> > > pretty well supported otherwise on Linux, and they are better then<br>
> > > simple uid == 0 checks, I think they should be supported by kdbus too.<br>
> ><br>
> > This is a bad excuse.  Given that you're designing something new, you have<br>
> > plenty of room to do better.<br>
><br>
> We are not really in the business in designing comprehensive new<br>
> access control systems that can be used for in-kernel and in-userspace<br>
> subsystems.<br>
><br>
> Sure, we also have bus policy, but that given it's non-interactive<br>
> logic it's not really suitable for the uses where we need uid or caps<br>
> checks, i.e. dynamic access control within called methods that need to<br>
> check different privileges dynamically.<br>
><br>
> Lennart<br>
><br>
> --<br>
> Lennart Poettering, Red Hat<br>
</p>