github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/client/allocrunner/taskrunner/getter/util_default.go (about) 1 //go:build !linux && !windows 2 3 package getter 4 5 import ( 6 "path/filepath" 7 "syscall" 8 ) 9 10 // attributes returns the system process attributes to run 11 // the sandbox process with 12 func attributes() *syscall.SysProcAttr { 13 uid, gid := credentials() 14 return &syscall.SysProcAttr{ 15 Credential: &syscall.Credential{ 16 Uid: uid, 17 Gid: gid, 18 }, 19 } 20 } 21 22 // credentials returns the credentials of the user Nomad is running as 23 func credentials() (uint32, uint32) { 24 uid := syscall.Getuid() 25 gid := syscall.Getgid() 26 return uint32(uid), uint32(gid) 27 } 28 29 // defaultEnvironment is the default minimal environment variables for Unix-like 30 // operating systems. 31 func defaultEnvironment(taskDir string) map[string]string { 32 tmpDir := filepath.Join(taskDir, "tmp") 33 return map[string]string{ 34 "PATH": "/usr/local/bin:/usr/bin:/bin", 35 "TMPDIR": tmpDir, 36 } 37 } 38 39 // lockdown applies only to Linux 40 func lockdown(string) error { 41 return nil 42 }