Re: [lxc-devel] [PATCH] lxclock: use XDG_RUNTIME_DIR for lock if appropriate (v2)

2013-07-23 Thread Stéphane Graber
On Mon, Jul 22, 2013 at 02:09:19PM -0500, Serge Hallyn wrote: > If we are euid==0 or XDG_RUNTIME_DIR is not set, then use > /run/lock/lxc/$lxcpath/$lxcname as before. Otherwise, > use $XDG_RUNTIME_DIR/lock/lxc/$lxcpath/$lxcname. > > Signed-off-by: Serge Hallyn > Cc: Stéphane Graber Acked-by: S

Re: [lxc-devel] [PATCH] cgroup_enter: catch write errors

2013-07-23 Thread Stéphane Graber
On Mon, Jul 22, 2013 at 11:59:18PM -0500, Serge Hallyn wrote: > Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber > --- > src/lxc/cgroup.c | 15 +++ > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c > index c707519..a61d210

Re: [lxc-devel] [PATCH] define lxc-usernsexec

2013-07-23 Thread Stéphane Graber
On Mon, Jul 22, 2013 at 03:23:58PM -0500, Serge Hallyn wrote: > It uses the newuidmap and newgidmap program to start a shell in > a mapped user namespace. While newuidmap and newgidmap are > setuid-root, lxc-usernsexec is not. > > If new{ug}idmap are not available, then this program is not > buil

Re: [lxc-devel] [RFC 0/8] Unprivileged container creation and use

2013-07-23 Thread Stéphane Graber
On Mon, Jul 22, 2013 at 10:07:29AM -0500, Serge Hallyn wrote: > Quoting Stéphane Graber (stgra...@ubuntu.com): > > On Fri, Jul 19, 2013 at 02:26:47PM +, Serge Hallyn wrote: > > > With this patchset, I am able to create and start an ubuntu-cloud > > > container completely as an unprivileged user

Re: [lxc-devel] [RFC 0/8] Unprivileged container creation and use

2013-07-23 Thread Stéphane Graber
On Mon, Jul 22, 2013 at 10:15:17AM -0500, Serge Hallyn wrote: > Thanks for the review, Stéphane. > > So the next thing I was wanting to do (beside fixing lxc-destroy and > having the ubuntu-cloud template properly handle cached images and > locking in custom lxcpaths for unprivileged users) was th

Re: [lxc-devel] [PATCH 3/8] container creation: support unpriv container creation in user namespaces

2013-07-23 Thread Stéphane Graber
On Mon, Jul 22, 2013 at 10:02:46AM -0500, Serge Hallyn wrote: > Quoting Stéphane Graber (stgra...@ubuntu.com): > > On Fri, Jul 19, 2013 at 02:26:50PM +, Serge Hallyn wrote: > > > From: Serge Hallyn > > > > > > 1. lxcapi_create: don't try to unshare and mount for dir backed containers > > > >

Re: [lxc-devel] [PATCH 3/8] container creation: support unpriv container creation in user namespaces

2013-07-23 Thread Stéphane Graber
On Mon, Jul 22, 2013 at 10:58:30AM -0500, Serge Hallyn wrote: > Quoting Serge Hallyn (serge.hal...@ubuntu.com): > > > May be worth having autoconf figure out the paths for those as they very > > > well may be moved to /bin. > > > > Yeah, these should be done through autoconf. > > > > Well, or we

Re: [lxc-devel] [RFC 0/8] Unprivileged container creation and use

2013-07-23 Thread Jäkel , Guido
>The downside of this approach though is that we'd have to ban the >lxc.network option allowing you to change the host interface name or use >that as a suffix for lxc--. Please don't drop this option completely. In my framework I'm using it to set the external veth name to the name of the contai

Re: [lxc-devel] [PATCH] lxclock: use XDG_RUNTIME_DIR for lock if appropriate (v2)

2013-07-23 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com): > On Mon, Jul 22, 2013 at 02:09:19PM -0500, Serge Hallyn wrote: > > If we are euid==0 or XDG_RUNTIME_DIR is not set, then use > > /run/lock/lxc/$lxcpath/$lxcname as before. Otherwise, > > use $XDG_RUNTIME_DIR/lock/lxc/$lxcpath/$lxcname. > > > > Signe

Re: [lxc-devel] [RFC 0/8] Unprivileged container creation and use

2013-07-23 Thread Serge Hallyn
Quoting Jäkel, Guido (g.jae...@dnb.de): > > >The downside of this approach though is that we'd have to ban the > >lxc.network option allowing you to change the host interface name or use > >that as a suffix for lxc--. > > Please don't drop this option completely. In my framework I'm using it to s

[lxc-devel] [PATCH 1/5] container creation: support unpriv container creation in user namespaces

2013-07-23 Thread serge . hallyn
From: Serge Hallyn 1. lxcapi_create: don't try to unshare and mount for dir backed containers It's unnecessary, and breaks unprivileged lxc-create (since unpriv users cannot yet unshare(CLONE_NEWNS)). 2. api_create: chown rootfs chown rootfs to the host uid to which container root will be mapp

[lxc-devel] [PATCH 2/5] cgroup: don't set devices cgroup if not in init_user_ns (v2)

2013-07-23 Thread serge . hallyn
From: Serge Hallyn Changelog: (Jul 22) only do this when actually mapping ids Signed-off-by: Serge Hallyn --- src/lxc/cgroup.c | 11 ++- src/lxc/conf.c | 16 ++-- src/lxc/conf.h | 6 -- src/lxc/lxc.h| 4 +++- src/lxc/start.c | 4 ++-- 5 files changed, 29 ins

[lxc-devel] [PATCH 3/5] fix chowning of tty and console uids

2013-07-23 Thread serge . hallyn
From: Serge Hallyn It needs to be done from the handler, not the container, since the container may not have the rights. Signed-off-by: Serge Hallyn Changelog: Jul 22: remove hardcoded path for /bin/chown Jul 22: use new lxc-usernsexec Conflicts: src/lxc/lxccontainer.c --- sr

[lxc-devel] [PATCH 4/5] lxc-destroy: support unprivileged use

2013-07-23 Thread serge . hallyn
From: Serge Hallyn Signed-off-by: Serge Hallyn --- src/lxc/conf.c | 24 src/lxc/conf.h | 1 + src/lxc/lxc_destroy.c | 7 --- src/lxc/lxccontainer.c | 15 --- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/lxc/conf

[lxc-devel] [PATCH 5/5] lxclock: don't try to chown/chmod the dirname(lockfile)

2013-07-23 Thread serge . hallyn
From: Serge Hallyn We were trying to chown and chmod it to the same permissions as the container's lxcpath. I think that's the wrong thing to do. Signed-off-by: Serge Hallyn --- src/lxc/lxclock.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/src/lxc/lxclock.c b/src/lxc/lxcloc

Re: [lxc-devel] [PATCH 2/5] cgroup: don't set devices cgroup if not in init_user_ns (v2)

2013-07-23 Thread Serge Hallyn
Quoting serge.hal...@ubuntu.com (serge.hal...@ubuntu.com): > From: Serge Hallyn > > Changelog: (Jul 22) only do this when actually mapping ids Another note, as per lkml discussion, unprivileged container creation will (at least for now) simply not create or enter cgroups - other than an 'lxc' cg

[lxc-devel] [PATCH 6/5] remove HAVE_NEWUIDMAP configurable

2013-07-23 Thread Serge Hallyn
It's not worthwhile - lxc-usernsexec will simply fail if we don't have newuidmap. Actually putting all code using lxc-usernsexec and newuidmap under that configurable would get ugly. Signed-off-by: Serge Hallyn --- configure.ac| 3 --- src/lxc/Makefile.am | 6 -- 2 files changed, 9