diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-13 20:06:47 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-13 20:06:47 +0900 |
| commit | 315c9b8849ae7ad764035dc6ceddc0bc35cb0c95 (patch) | |
| tree | 17eff1dbfd1c2dac598afe5c7d0aa6e7b6e2a75a /main.go | |
| parent | 3739b56504c7a268241c80b50461a19c4abe699c (diff) | |
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>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -38,6 +38,12 @@ func main() { // shim early exit 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 tryVersion() tryLicense() |
