feat: require superuser privileges

This commit is contained in:
Aliberk Sandıkçı 2023-08-29 18:54:55 +03:00
parent b4ed8b4af6
commit 718e6f12cc
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1

View file

@ -3,6 +3,7 @@ package main
import ( import (
"log" "log"
"os" "os"
"os/user"
"syscall" "syscall"
"git.aliberksandikci.com.tr/Liderahenk/ahenk-go/pkg/utils" "git.aliberksandikci.com.tr/Liderahenk/ahenk-go/pkg/utils"
@ -64,6 +65,15 @@ func main() {
} else { } else {
panic("Please enter a valid option !") panic("Please enter a valid option !")
} }
current, err := user.Current()
if err != nil {
log.Fatal(err)
}
if current.Uid != "0" {
log.Fatal("Ahenk-go requires superuser privilege")
}
PluginManager() PluginManager()
// NEXT Make PluginManager async ! // NEXT Make PluginManager async !
} }