mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-25 05:27:23 +08:00
add checks for firewall
This commit is contained in:
parent
0817b01cb2
commit
157a8f02cd
2 changed files with 19 additions and 0 deletions
|
|
@ -35,6 +35,9 @@ func main() {
|
|||
} else {
|
||||
ncutils.CheckUID()
|
||||
ncutils.CheckWG()
|
||||
if ncutils.IsLinux() {
|
||||
ncutils.CheckFirewall()
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
func CheckWG() {
|
||||
uspace := GetWireGuard()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue