Fix pledge() usage

This commit is contained in:
Frank Denis 2018-07-07 20:50:44 +02:00
parent 35e4d36f67
commit 17e07d80bb
3 changed files with 13 additions and 3 deletions

View File

@ -2,9 +2,14 @@
package main
import "golang.org/x/sys/unix"
import (
"golang.org/x/sys/unix"
)
func Pledge() {
unix.Pledge("stdio rpath wpath cpath tmppath inet fattr flock dns getpw sendfd recvfd proc exec id",
"stdio rpath wpath cpath tmppath inet fattr flock dns recvfd")
unix.Pledge("stdio rpath wpath cpath tmppath inet fattr flock dns getpw sendfd recvfd proc exec id", nil)
}
func PledgeChild() {
unix.Pledge("stdio rpath wpath cpath tmppath inet fattr flock dns recvfd", nil)
}

View File

@ -5,3 +5,7 @@ package main
func Pledge() {
}
func PledgeChild() {
}

View File

@ -39,6 +39,7 @@ func (proxy *Proxy) dropPrivilege(userStr string, fds []*os.File) {
}
SystemDNotify()
PledgeChild()
args = args[1:]
args = append(args, "-child")