mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 17:29:15 +08:00
add checks for firewall
This commit is contained in:
@@ -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 {
|
||||||
|
@@ -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()
|
||||||
|
Reference in New Issue
Block a user