add checks for firewall

This commit is contained in:
Matthew R. Kasun
2022-08-19 10:43:51 -04:00
parent 0817b01cb2
commit 157a8f02cd
2 changed files with 19 additions and 0 deletions

View File

@@ -35,6 +35,9 @@ func main() {
} else { } else {
ncutils.CheckUID() ncutils.CheckUID()
ncutils.CheckWG() ncutils.CheckWG()
if ncutils.IsLinux() {
ncutils.CheckFirewall()
}
} }
if len(os.Args) <= 1 && config.GuiActive { if len(os.Args) <= 1 && config.GuiActive {

View File

@@ -515,6 +515,22 @@ func CheckUID() {
} }
} }
// CheckFirewall - checks if iptables of nft install, if not exit
func CheckFirewall() {
found := false
_, err := exec.LookPath("iptables")
if err == nil {
found = true
}
_, err = exec.LookPath("nft")
if err == nil {
found = true
}
if !found {
log.Fatal("neither iptables nor nft is installed - please install one or the other and try again")
}
}
// CheckWG - Checks if WireGuard is installed. If not, exit // CheckWG - Checks if WireGuard is installed. If not, exit
func CheckWG() { func CheckWG() {
uspace := GetWireGuard() uspace := GetWireGuard()