fix: add missing mode declaration
This commit is contained in:
parent
3d076221e2
commit
1c2dbb9540
1 changed files with 19 additions and 6 deletions
|
|
@ -218,18 +218,31 @@ func deployOne(nc nodeConfig) {
|
||||||
if nc.Cloud == "" { nc.Cloud = "EU" }
|
if nc.Cloud == "" { nc.Cloud = "EU" }
|
||||||
if nc.Labels == "" { nc.Labels = "group=" + nc.Name }
|
if nc.Labels == "" { nc.Labels = "group=" + nc.Name }
|
||||||
|
|
||||||
// Ask for block mode
|
// Ask for traffic mode
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
mode := "monitoring"
|
mode := "monitoring"
|
||||||
|
fmt.Println("\nTraffic processing mode:")
|
||||||
|
fmt.Println(" [1] monitoring — detect attacks, do not block")
|
||||||
|
fmt.Println(" [2] safe_blocking — block only definitely malicious requests")
|
||||||
|
fmt.Println(" [3] block — block all detected attacks")
|
||||||
|
fmt.Println(" [4] off — disable traffic analysis")
|
||||||
|
def := "1"
|
||||||
if nc.BlockMode {
|
if nc.BlockMode {
|
||||||
fmt.Print("Block mode? [Y/n]: ")
|
def = "3"
|
||||||
} else {
|
|
||||||
fmt.Print("Block mode? [y/N]: ")
|
|
||||||
}
|
}
|
||||||
|
fmt.Printf("Choose mode [%s]: ", def)
|
||||||
ans, _ := reader.ReadString('\n')
|
ans, _ := reader.ReadString('\n')
|
||||||
ans = strings.TrimSpace(strings.ToLower(ans))
|
ans = strings.TrimSpace(ans)
|
||||||
if ans == "y" || ans == "yes" || (nc.BlockMode && ans == "") {
|
if ans == "" { ans = def }
|
||||||
|
switch ans {
|
||||||
|
case "2":
|
||||||
|
mode = "safe_blocking"
|
||||||
|
case "3":
|
||||||
mode = "block"
|
mode = "block"
|
||||||
|
case "4":
|
||||||
|
mode = "off"
|
||||||
|
default:
|
||||||
|
mode = "monitoring"
|
||||||
}
|
}
|
||||||
|
|
||||||
apiHost := "api.wallarm.com"
|
apiHost := "api.wallarm.com"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue