1. 23 Nov, 2016 5 commits
    • change version to 2.0.6 in configure.ac · 2dbff50f
      Stéphane Graber authored
      Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
    • attach: do not send procfd to attached process · ef7bedf6
      Christian Brauner authored
      So far, we opened a file descriptor refering to proc on the host inside the
      host namespace and handed that fd to the attached process in
      attach_child_main(). This was done to ensure that LSM labels were correctly
      setup. However, by exploiting a potential kernel bug, ptrace could be used to
      prevent the file descriptor from being closed which in turn could be used by an
      unprivileged container to gain access to the host namespace. Aside from this
      needing an upstream kernel fix, we should make sure that we don't pass the fd
      for proc itself to the attached process. However, we cannot completely prevent
      this, as the attached process needs to be able to change its apparmor profile
      by writing to /proc/self/attr/exec or /proc/self/attr/current. To minimize the
      attack surface, we only send the fd for /proc/self/attr/exec or
      /proc/self/attr/current to the attached process. To do this we introduce a
      little more IPC between the child and parent:
      
      	 * IPC mechanism: (X is receiver)
      	 *   initial process        intermediate          attached
      	 *        X           <---  send pid of
      	 *                          attached proc,
      	 *                          then exit
      	 *    send 0 ------------------------------------>    X
      	 *                                              [do initialization]
      	 *        X  <------------------------------------  send 1
      	 *   [add to cgroup, ...]
      	 *    send 2 ------------------------------------>    X
      	 *						[set LXC_ATTACH_NO_NEW_PRIVS]
      	 *        X  <------------------------------------  send 3
      	 *   [open LSM label fd]
      	 *    send 4 ------------------------------------>    X
      	 *   						[set LSM label]
      	 *   close socket                                 close socket
      	 *                                                run program
      
      The attached child tells the parent when it is ready to have its LSM labels set
      up. The parent then opens an approriate fd for the child PID to
      /proc/<pid>/attr/exec or /proc/<pid>/attr/current and sends it via SCM_RIGHTS
      to the child. The child can then set its LSM laben. Both sides then close the
      socket fds and the child execs the requested process.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@canonical.com>
    • tests: remove overflow tests · 6c27d1a6
      Christian Brauner authored
      They do not behave correctly on some architectures, so let's remove them for
      now and come up with better ones later.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
    • Configure a static MAC address on the LXC bridge · 6d14aa2b
      Cam Cope authored
      Signed-off-by: 's avatarCam Cope <cam@dropbox.com>
    • tools: replace non-standard namespace identifiers · 0d7574d5
      Christian Brauner authored
      The identifiers for namespaces used with lxc-unshare and lxc-attach as given on
      the manpage do not align with the standard identifiers. This affects network,
      mount, and uts namespaces. The standard identifiers are: "mnt", "uts", and
      "net" whereas lxc-unshare and lxc-attach use "MOUNT", "UTSNAME", and "NETWORK".
      I'm weary to hack this into namespace.{c.h} by e.g. adding additional members
      to the ns_info struct or to special case this in lxc_fill_namespace_flags().
      Internally, we should only accept standard identifiers to ensure that we are
      always correctly aligned with the kernel. So let's use some cheap memmove()s to
      replace them by their standard identifiers in lxc-unshare and lxc-attach.
      Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
  2. 22 Nov, 2016 35 commits