Skip to content

Commit

Permalink
Merge pull request #3 from mialinx/master
Browse files Browse the repository at this point in the history
Reduce privileges during Reborn, not StartProcess
  • Loading branch information
sevlyar committed Jan 15, 2015
2 parents d4be9dc + e518691 commit 8fe5849
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions daemon_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ func (d *Context) parent() (child *os.Process, err error) {
Env: d.Env,
Files: d.files(),
Sys: &syscall.SysProcAttr{
//Chroot: d.Chroot,
Credential: d.Credential,
Setsid: true,
},
}
Expand Down Expand Up @@ -249,6 +247,16 @@ func (d *Context) child() (err error) {
if len(d.Chroot) > 0 {
err = syscall.Chroot(d.Chroot)
}
if d.Credential.Gid > 0 {
if err = syscall.Setgid(int(d.Credential.Gid)); err != nil {
return
}
}
if d.Credential.Uid > 0 {
if err = syscall.Setuid(int(d.Credential.Uid)); err != nil {
return
}
}

return
}
Expand Down

0 comments on commit 8fe5849

Please sign in to comment.