SHARE
TWEET

Untitled

a guest Feb 15th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cmd := exec.Command("/proc/self/exe", "run-container")
  2.     cmd.SysProcAttr = &syscall.SysProcAttr{
  3.         Cloneflags:   syscall.CLONE_NEWUSER | syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID | syscall.CLONE_NEWNS,
  4.         Unshareflags: syscall.CLONE_NEWNS,
  5.         UidMappings: []syscall.SysProcIDMap{
  6.             {
  7.                 ContainerID: 0,
  8.                 HostID:      os.Getuid(),
  9.                 Size:        1,   // set this to 2 or more and it fails
  10.             },
  11.         },
  12.         GidMappings: []syscall.SysProcIDMap{
  13.             {
  14.                 ContainerID: 0,
  15.                 HostID:      os.Getgid(),
  16.                 Size:        1,
  17.             },
  18.         },
  19.     }
  20.     // other flags: CLONE_NEWNET, CLONE_NEWIPC, CLONE_NEWCGROUP, CLONE_NEWUSER,
  21.     cmd.Stdin = os.Stdin
  22.     cmd.Stdout = os.Stdout
  23.     cmd.Stderr = os.Stderr
  24.  
  25.     err := cmd.Run()
  26.     if err != nil {
  27.         fmt.Println("ERROR: parent cmd.Run", err)
  28.         os.Exit(1)
  29.     }
  30.    
  31. ERROR: parent cmd.Run fork/exec /proc/self/exe: operation not permitted
  32.    
  33. lxd:1000:1
  34. root:1000:1
  35. lxd:100000:65536
  36. root:100000:65536
  37. developer:165536:65536
  38. mounter:231072:65536
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top