<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"> <span>Hmm, this is interesting.<br>I am runnung my container from the unprivileged user 'lxduser' and yet:<br><br>root@qumind:~# ps -ef | grep '[l]xc monitor'<br>root      7609     1  0 11:54 ?        00:00:00 [lxc monitor] /var/lib/lxd/containers pgroonga<br><br></span>What is wrong here?<br><br><br><font color="#990099">-----"lxc-users" <lxc-users-bounces@lists.linuxcontainers.org> wrote: -----</font><div class="iNotesHistory" style="padding-left:5px;"><div style="padding-right:0px;padding-left:5px;border-left:solid black 2px;">To: LXC users mailing-list <lxc-users@lists.linuxcontainers.org><br>From: Serge Hallyn <serge.hallyn@ubuntu.com><br>Sent by: "lxc-users" <lxc-users-bounces@lists.linuxcontainers.org><br>Date: 01/11/2016 19:00<br>Subject: Re: [lxc-users] is starting unprivileged containers as root as secure as running them as any other user?<br><br><div><font face="Courier New,Courier,monospace" size="2">Quoting Carlos Alberto Lopez Perez (clopez@igalia.com):<br>> On 08/01/16 19:58, Serge Hallyn wrote:<br>> > Quoting Carlos Alberto Lopez Perez (clopez@igalia.com):<br>> >> Hi,<br>> >><br>> >><br>> >> Suppose that we create an unprivileged container as root (using the<br>> >> download template or manually converting it with uidmapshift).<br>> >><br>> >> Such container config will contain (for example) the following maps:<br>> >><br>> >> lxc.id_map = u 0 100000 65536<br>> >> lxc.id_map = g 0 100000 65536<br>> >><br>> >> And root would be also allowed to use them:<br>> >><br>> >> $ usermod --add-subuids 100000-165536 root<br>> >> $ usermod --add-subgids 100000-165536 root<br>> >><br>> >><br>> >> My question is....<br>> >><br>> >> From a security point of view, does creating and starting an<br>> >> unprivileged container as root make any difference than doing it as any<br>> >> other user of the host?<br>> > <br>> > Yes.<br>> > <br>> > For example, if you'll then be running lxc-attach as root instead of as<br>> > an unpriv user, then any attacks from inside the container against lxc-attach<br>> > will attack the root user.<br>> > <br>> <br>> Is this the only difference from a security point of view?<br>> Suppose that I don't use lxc-attach, but lxc-console or login via ssh.<br><br>The monitor (look for "[lxc monitor]" in process listing) runs with your<br>uid.  So if there were a way for the container to make the lxc monitor<br>execute code, it would be privilege escalation.<br>_______________________________________________<br>lxc-users mailing list<br>lxc-users@lists.linuxcontainers.org<br><a href="http://lists.linuxcontainers.org/listinfo/lxc-users">http://lists.linuxcontainers.org/listinfo/lxc-users</a></font></div></lxc-users-bounces@lists.linuxcontainers.org></serge.hallyn@ubuntu.com></div></div><div></div></font>