From 718e6f12cc5f9f728189edc84c500992b52791de Mon Sep 17 00:00:00 2001 From: asandikci Date: Tue, 29 Aug 2023 18:54:55 +0300 Subject: [PATCH] feat: require superuser privileges --- cmd/ahenk-go/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/ahenk-go/main.go b/cmd/ahenk-go/main.go index efd34d5..22a7310 100644 --- a/cmd/ahenk-go/main.go +++ b/cmd/ahenk-go/main.go @@ -3,6 +3,7 @@ package main import ( "log" "os" + "os/user" "syscall" "git.aliberksandikci.com.tr/Liderahenk/ahenk-go/pkg/utils" @@ -64,6 +65,15 @@ func main() { } else { 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() // NEXT Make PluginManager async ! }