mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-31 09:42:28 +00:00
Add setuid & setgid options
Only applicable on unix systems, although Go doesn't support Linux at this time.
This commit is contained in:
parent
35d1cedc24
commit
77159d9db6
4 changed files with 58 additions and 4 deletions
21
droppriv_unix.go
Normal file
21
droppriv_unix.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
// +build !windows,!linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func dropPrivileges(uid, gid int) error {
|
||||
err := syscall.Setgid(gid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = syscall.Setuid(uid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue