fortify: refuse to run as root
There is no good reason to run fortify as root and desktop environments typically do not like that either. This check prevents confusion for new users who might mistakenly run it as root or set the setuid bit. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
parent
3739b56504
commit
315c9b8849
6
main.go
6
main.go
|
@ -38,6 +38,12 @@ func main() {
|
||||||
// shim early exit
|
// shim early exit
|
||||||
shim.Try()
|
shim.Try()
|
||||||
|
|
||||||
|
// root check
|
||||||
|
if os.Getuid() == 0 {
|
||||||
|
fmt.Println("fortify: this program must not run as root")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
// version/license/template command early exit
|
// version/license/template command early exit
|
||||||
tryVersion()
|
tryVersion()
|
||||||
tryLicense()
|
tryLicense()
|
||||||
|
|
Loading…
Reference in New Issue