Skip to content

Commit f21e1f4

Browse files
feat: seems working correctly (#76)
1 parent f528a5d commit f21e1f4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

jail/linux.go

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

14-
"github.com/coder/boundary/util"
1514
"golang.org/x/sys/unix"
1615
)
1716

@@ -73,18 +72,19 @@ func (l *LinuxJail) Command(command []string) *exec.Cmd {
7372
cmd.Stdin = os.Stdin
7473

7574
l.logger.Debug("os.Getuid()", "os.Getuid()", os.Getuid())
76-
_, uid, gid, _, _ := util.GetUserInfo()
75+
l.logger.Debug("os.Getgid()", "os.Getgid()", os.Getgid())
76+
currentUid := os.Getuid()
77+
currentGid := os.Getgid()
7778

7879
cmd.SysProcAttr = &syscall.SysProcAttr{
7980
Cloneflags: syscall.CLONE_NEWUSER | syscall.CLONE_NEWNET,
8081
UidMappings: []syscall.SysProcIDMap{
81-
{ContainerID: 0, HostID: 0, Size: 1},
82-
{ContainerID: uid, HostID: uid, Size: 1},
82+
{ContainerID: currentUid, HostID: currentUid, Size: 1},
8383
},
8484
GidMappings: []syscall.SysProcIDMap{
85-
{ContainerID: 0, HostID: 0, Size: 1},
86-
{ContainerID: gid, HostID: gid, Size: 1},
85+
{ContainerID: currentGid, HostID: currentGid, Size: 1},
8786
},
87+
AmbientCaps: []uintptr{unix.CAP_NET_ADMIN},
8888
}
8989

9090
return cmd

0 commit comments

Comments
 (0)