Ophestra Umiker
65af1684e3
All checks were successful
test / test (push) Successful in 14s
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
33 lines
570 B
Go
33 lines
570 B
Go
package app
|
|
|
|
import (
|
|
"os"
|
|
|
|
"git.ophivana.moe/security/fortify/internal/verbose"
|
|
)
|
|
|
|
const (
|
|
sudoAskPass = "SUDO_ASKPASS"
|
|
)
|
|
|
|
func (a *app) commandBuilderSudo(shimEnv string) (args []string) {
|
|
args = make([]string, 0, 8)
|
|
|
|
// -Hiu $USER
|
|
args = append(args, "-Hiu", a.seal.sys.user.Username)
|
|
|
|
// -A?
|
|
if _, ok := os.LookupEnv(sudoAskPass); ok {
|
|
verbose.Printf("%s set, adding askpass flag\n", sudoAskPass)
|
|
args = append(args, "-A")
|
|
}
|
|
|
|
// shim payload
|
|
args = append(args, shimEnv)
|
|
|
|
// -- $@
|
|
args = append(args, "--", a.seal.sys.executable, "shim")
|
|
|
|
return
|
|
}
|