This commit is contained in:
bui 2023-10-18 17:17:57 +02:00
parent 98fb84d3e7
commit c89b42939e
2 changed files with 14 additions and 14 deletions

View file

@ -12,16 +12,16 @@ import (
func NewWafRulesCmd() *cobra.Command { func NewWafRulesCmd() *cobra.Command {
var cmdWafRules = &cobra.Command{ var cmdWafRules = &cobra.Command{
Use: "waf-rules [action] [config]", Use: "waap-rules [action] [config]",
Short: "Install/Remove/Upgrade/Inspect waf-rule(s) from hub", Short: "Install/Remove/Upgrade/Inspect waf-rule(s) from hub",
Example: `cscli waf-rules install crowdsecurity/core-rule-set Example: `cscli waap-rules install crowdsecurity/core-rule-set
cscli waf-rules inspect crowdsecurity/core-rule-set cscli waap-rules inspect crowdsecurity/core-rule-set
cscli waf-rules upgrade crowdsecurity/core-rule-set cscli waap-rules upgrade crowdsecurity/core-rule-set
cscli waf-rules list cscli waap-rules list
cscli waf-rules remove crowdsecurity/core-rule-set cscli waap-rules remove crowdsecurity/core-rule-set
`, `,
Args: cobra.MinimumNArgs(1), Args: cobra.MinimumNArgs(1),
Aliases: []string{"waf-rule"}, Aliases: []string{"waap-rule"},
DisableAutoGenTag: true, DisableAutoGenTag: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error { PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if err := csConfig.LoadHub(); err != nil { if err := csConfig.LoadHub(); err != nil {
@ -102,7 +102,7 @@ func NewWafRulesRemoveCmd() *cobra.Command {
Short: "Remove given waf-rule(s)", Short: "Remove given waf-rule(s)",
Long: `Remove given waf-rule(s) from hub`, Long: `Remove given waf-rule(s) from hub`,
Aliases: []string{"delete"}, Aliases: []string{"delete"},
Example: `cscli waf-rules remove crowdsec/xxx crowdsec/xyz`, Example: `cscli waap-rules remove crowdsec/xxx crowdsec/xyz`,
DisableAutoGenTag: true, DisableAutoGenTag: true,
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return compInstalledItems(cwhub.WAAP_RULES, args, toComplete) return compInstalledItems(cwhub.WAAP_RULES, args, toComplete)
@ -134,7 +134,7 @@ func NewWafRulesUpgradeCmd() *cobra.Command {
Use: "upgrade [config]", Use: "upgrade [config]",
Short: "Upgrade given waf-rule(s)", Short: "Upgrade given waf-rule(s)",
Long: `Fetch and upgrade given waf-rule(s) from hub`, Long: `Fetch and upgrade given waf-rule(s) from hub`,
Example: `cscli waf-rules upgrade crowdsec/xxx crowdsec/xyz`, Example: `cscli waap-rules upgrade crowdsec/xxx crowdsec/xyz`,
DisableAutoGenTag: true, DisableAutoGenTag: true,
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return compInstalledItems(cwhub.WAAP_RULES, args, toComplete) return compInstalledItems(cwhub.WAAP_RULES, args, toComplete)
@ -163,7 +163,7 @@ func NewWafRulesInspectCmd() *cobra.Command {
Use: "inspect [name]", Use: "inspect [name]",
Short: "Inspect given waf rule", Short: "Inspect given waf rule",
Long: `Inspect given waf rule`, Long: `Inspect given waf rule`,
Example: `cscli waf-rules inspect crowdsec/xxx`, Example: `cscli waap-rules inspect crowdsec/xxx`,
DisableAutoGenTag: true, DisableAutoGenTag: true,
Args: cobra.MinimumNArgs(1), Args: cobra.MinimumNArgs(1),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
@ -183,8 +183,8 @@ func NewWafRulesListCmd() *cobra.Command {
Use: "list [name]", Use: "list [name]",
Short: "List all waf rules or given one", Short: "List all waf rules or given one",
Long: `List all waf rules or given one`, Long: `List all waf rules or given one`,
Example: `cscli waf-rules list Example: `cscli waap-rules list
cscli waf-rules list crowdsecurity/xxx`, cscli waap-rules list crowdsecurity/xxx`,
DisableAutoGenTag: true, DisableAutoGenTag: true,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
ListItems(color.Output, []string{cwhub.WAAP_RULES}, args, false, true, all) ListItems(color.Output, []string{cwhub.WAAP_RULES}, args, false, true, all)

View file

@ -16,14 +16,14 @@ source: waf
labels: labels:
type: waf type: waf
#routines: 1 #routines: 1
waap_config_path: config/waap_configs/mytest.yaml waap_config_path: config/waap-configs/mytest.yaml
``` ```
## Waap config ## Waap config
The waap config defines what rules that will be loaded by a given waap engine (associated with an acquis). The waap config defines what rules that will be loaded by a given waap engine (associated with an acquis).
> `config/waap_configs/mytest.yaml` > `config/waap-configs/mytest.yaml`
```yaml ```yaml
name: default name: default