Skip to content

Commit 9238fe3

Browse files
fix: update user mapping (#67)
1 parent 2ebcf45 commit 9238fe3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

jail/linux.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"syscall"
1212
"time"
1313

14+
"github.com/coder/boundary/util"
1415
"golang.org/x/sys/unix"
1516
)
1617

@@ -71,13 +72,18 @@ func (l *LinuxJail) Command(command []string) *exec.Cmd {
7172
cmd.Stdout = os.Stdout
7273
cmd.Stdin = os.Stdin
7374

75+
l.logger.Debug("os.Getuid()", "os.Getuid()", os.Getuid())
76+
_, uid, gid, _, _ := util.GetUserInfo()
77+
7478
cmd.SysProcAttr = &syscall.SysProcAttr{
7579
Cloneflags: syscall.CLONE_NEWUSER | syscall.CLONE_NEWNET,
7680
UidMappings: []syscall.SysProcIDMap{
77-
{ContainerID: 0, HostID: os.Getuid(), Size: 1},
81+
{ContainerID: 0, HostID: 0, Size: 1},
82+
{ContainerID: uid, HostID: uid, Size: 1},
7883
},
7984
GidMappings: []syscall.SysProcIDMap{
80-
{ContainerID: 0, HostID: os.Getgid(), Size: 1},
85+
{ContainerID: 0, HostID: 0, Size: 1},
86+
{ContainerID: gid, HostID: gid, Size: 1},
8187
},
8288
}
8389

0 commit comments

Comments
 (0)