diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-12-18 19:39:25 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-12-18 19:39:25 +0900 |
| commit | 52f21a19f3230e62387bebb88d45d51b6375ac8d (patch) | |
| tree | 1f01bbab001c62ec3b2e1047ef9dbe2a072ea568 /cmd/fsu | |
| parent | 7be53a24382fd8168da0bad34274343de0bfe76b (diff) | |
cmd/fshim: switch to setup pipe
The socket-based approach is no longer necessary as fsu allows extra files and sudo compatibility is no longer relevant.
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'cmd/fsu')
| -rw-r--r-- | cmd/fsu/main.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/fsu/main.go b/cmd/fsu/main.go index d232818a..2412a0e6 100644 --- a/cmd/fsu/main.go +++ b/cmd/fsu/main.go @@ -83,17 +83,17 @@ func main() { uid += aid } - // pass through setup path to shim - var shimSetupPath string + // pass through setup fd to shim + var shimSetupFd string if s, ok := os.LookupEnv(envShim); !ok { // fortify requests target uid // print resolved uid and exit fmt.Print(uid) os.Exit(0) - } else if !path.IsAbs(s) { - log.Fatal("FORTIFY_SHIM is not absolute") + } else if len(s) != 1 || s[0] > '9' || s[0] < '3' { + log.Fatal("FORTIFY_SHIM holds an invalid value") } else { - shimSetupPath = s + shimSetupFd = s } // supplementary groups @@ -142,7 +142,7 @@ func main() { if _, _, errno := syscall.AllThreadsSyscall(syscall.SYS_PRCTL, PR_SET_NO_NEW_PRIVS, 1, 0); errno != 0 { log.Fatalf("cannot set no_new_privs flag: %s", errno.Error()) } - if err := syscall.Exec(fshim, []string{"fshim"}, []string{envShim + "=" + shimSetupPath}); err != nil { + if err := syscall.Exec(fshim, []string{"fshim"}, []string{envShim + "=" + shimSetupFd}); err != nil { log.Fatalf("cannot start shim: %v", err) } |
