diff --git a/docs/auth0_ips.md b/docs/auth0_ips.md deleted file mode 100644 index fd39f38bc..000000000 --- a/docs/auth0_ips.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -layout: default ---- -# auth0 ips - -Manually block or unblock an IP address. - -## Commands - -- [auth0 ips check](auth0_ips_check.md) - Check IP address -- [auth0 ips unblock](auth0_ips_unblock.md) - Unblock IP address - diff --git a/docs/auth0_ips_check.md b/docs/auth0_ips_check.md deleted file mode 100644 index 6c875871a..000000000 --- a/docs/auth0_ips_check.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -layout: default ---- -# auth0 ips check - -Check if a given IP address is blocked via the Suspicious IP Throttling due to multiple suspicious attempts. - -## Usage -``` -auth0 ips check [flags] -``` - -## Examples - -``` - auth0 ips check - auth0 ips check - auth0 ips check "178.178.178.178" -``` - - - - -## InheritedFlags - -``` - --debug Enable debug mode. - --no-color Disable colors. - --no-input Disable interactivity. - --tenant string Specific tenant to use. -``` - - -## Related Commands - -- [auth0 ips check](auth0_ips_check.md) - Check IP address -- [auth0 ips unblock](auth0_ips_unblock.md) - Unblock IP address - - diff --git a/docs/auth0_ips_unblock.md b/docs/auth0_ips_unblock.md deleted file mode 100644 index 13f5c5eb4..000000000 --- a/docs/auth0_ips_unblock.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -layout: default ---- -# auth0 ips unblock - -Unblock an IP address currently blocked by the Suspicious IP Throttling due to multiple suspicious attempts. - -## Usage -``` -auth0 ips unblock [flags] -``` - -## Examples - -``` - auth0 ips unblock - auth0 ips unblock - auth0 ips unblock "178.178.178.178" -``` - - - - -## InheritedFlags - -``` - --debug Enable debug mode. - --no-color Disable colors. - --no-input Disable interactivity. - --tenant string Specific tenant to use. -``` - - -## Related Commands - -- [auth0 ips check](auth0_ips_check.md) - Check IP address -- [auth0 ips unblock](auth0_ips_unblock.md) - Unblock IP address - - diff --git a/docs/auth0_protection_suspicious-ip-throttling.md b/docs/auth0_protection_suspicious-ip-throttling.md index 6b4b379cb..289b0eb2f 100644 --- a/docs/auth0_protection_suspicious-ip-throttling.md +++ b/docs/auth0_protection_suspicious-ip-throttling.md @@ -9,6 +9,7 @@ When Auth0 detects a high number of signup attempts or failed login attempts fro ## Commands +- [auth0 protection suspicious-ip-throttling ips](auth0_protection_suspicious-ip-throttling_ips.md) - Manage blocked IP addresses - [auth0 protection suspicious-ip-throttling show](auth0_protection_suspicious-ip-throttling_show.md) - Show suspicious ip throttling settings - [auth0 protection suspicious-ip-throttling update](auth0_protection_suspicious-ip-throttling_update.md) - Update suspicious ip throttling settings diff --git a/docs/auth0_protection_suspicious-ip-throttling_ips.md b/docs/auth0_protection_suspicious-ip-throttling_ips.md new file mode 100644 index 000000000..cf52d13f3 --- /dev/null +++ b/docs/auth0_protection_suspicious-ip-throttling_ips.md @@ -0,0 +1,12 @@ +--- +layout: default +--- +# auth0 protection suspicious-ip-throttling ips + +Manually block or unblock an IP address that was blocked via the Suspicious IP Throttling due to multiple suspicious attempts. + +## Commands + +- [auth0 protection suspicious-ip-throttling ips check](auth0_protection_suspicious-ip-throttling_ips_check.md) - Check IP address +- [auth0 protection suspicious-ip-throttling ips unblock](auth0_protection_suspicious-ip-throttling_ips_unblock.md) - Unblock IP address + diff --git a/docs/auth0_protection_suspicious-ip-throttling_ips_check.md b/docs/auth0_protection_suspicious-ip-throttling_ips_check.md new file mode 100644 index 000000000..e13a51563 --- /dev/null +++ b/docs/auth0_protection_suspicious-ip-throttling_ips_check.md @@ -0,0 +1,39 @@ +--- +layout: default +--- +# auth0 protection suspicious-ip-throttling ips check + +Check if a given IP address is blocked via the Suspicious IP Throttling due to multiple suspicious attempts. + +## Usage +``` +auth0 protection suspicious-ip-throttling ips check [flags] +``` + +## Examples + +``` + auth0 protection suspicious-ip-throttling ips check + auth0 ap sit ips check + auth0 ap sit ips check "178.178.178.178" +``` + + + + +## InheritedFlags + +``` + --debug Enable debug mode. + --no-color Disable colors. + --no-input Disable interactivity. + --tenant string Specific tenant to use. +``` + + +## Related Commands + +- [auth0 protection suspicious-ip-throttling ips check](auth0_protection_suspicious-ip-throttling_ips_check.md) - Check IP address +- [auth0 protection suspicious-ip-throttling ips unblock](auth0_protection_suspicious-ip-throttling_ips_unblock.md) - Unblock IP address + + diff --git a/docs/auth0_protection_suspicious-ip-throttling_ips_unblock.md b/docs/auth0_protection_suspicious-ip-throttling_ips_unblock.md new file mode 100644 index 000000000..f009293cc --- /dev/null +++ b/docs/auth0_protection_suspicious-ip-throttling_ips_unblock.md @@ -0,0 +1,39 @@ +--- +layout: default +--- +# auth0 protection suspicious-ip-throttling ips unblock + +Unblock an IP address currently blocked by the Suspicious IP Throttling due to multiple suspicious attempts. + +## Usage +``` +auth0 protection suspicious-ip-throttling ips unblock [flags] +``` + +## Examples + +``` + auth0 protection suspicious-ip-throttling ips unblock + auth0 ap sit ips unblock + auth0 ap sit ips unblock "178.178.178.178" +``` + + + + +## InheritedFlags + +``` + --debug Enable debug mode. + --no-color Disable colors. + --no-input Disable interactivity. + --tenant string Specific tenant to use. +``` + + +## Related Commands + +- [auth0 protection suspicious-ip-throttling ips check](auth0_protection_suspicious-ip-throttling_ips_check.md) - Check IP address +- [auth0 protection suspicious-ip-throttling ips unblock](auth0_protection_suspicious-ip-throttling_ips_unblock.md) - Unblock IP address + + diff --git a/docs/auth0_protection_suspicious-ip-throttling_show.md b/docs/auth0_protection_suspicious-ip-throttling_show.md index df0a36d4f..ad2fc2081 100644 --- a/docs/auth0_protection_suspicious-ip-throttling_show.md +++ b/docs/auth0_protection_suspicious-ip-throttling_show.md @@ -37,6 +37,7 @@ auth0 protection suspicious-ip-throttling show [flags] ## Related Commands +- [auth0 protection suspicious-ip-throttling ips](auth0_protection_suspicious-ip-throttling_ips.md) - Manage blocked IP addresses - [auth0 protection suspicious-ip-throttling show](auth0_protection_suspicious-ip-throttling_show.md) - Show suspicious ip throttling settings - [auth0 protection suspicious-ip-throttling update](auth0_protection_suspicious-ip-throttling_update.md) - Update suspicious ip throttling settings diff --git a/docs/auth0_protection_suspicious-ip-throttling_update.md b/docs/auth0_protection_suspicious-ip-throttling_update.md index cedbbc020..28cb1b639 100644 --- a/docs/auth0_protection_suspicious-ip-throttling_update.md +++ b/docs/auth0_protection_suspicious-ip-throttling_update.md @@ -47,6 +47,7 @@ auth0 protection suspicious-ip-throttling update [flags] ## Related Commands +- [auth0 protection suspicious-ip-throttling ips](auth0_protection_suspicious-ip-throttling_ips.md) - Manage blocked IP addresses - [auth0 protection suspicious-ip-throttling show](auth0_protection_suspicious-ip-throttling_show.md) - Show suspicious ip throttling settings - [auth0 protection suspicious-ip-throttling update](auth0_protection_suspicious-ip-throttling_update.md) - Update suspicious ip throttling settings diff --git a/docs/index.md b/docs/index.md index 0fbff4ca1..db04b6848 100644 --- a/docs/index.md +++ b/docs/index.md @@ -62,7 +62,6 @@ There are two ways to authenticate: - [auth0 completion](auth0_completion.md) - Setup autocomplete features for this CLI on your terminal - [auth0 domains](auth0_domains.md) - Manage custom domains - [auth0 email](auth0_email.md) - Manage email settings -- [auth0 ips](auth0_ips.md) - Manage blocked IP addresses - [auth0 login](auth0_login.md) - Authenticate the Auth0 CLI - [auth0 logout](auth0_logout.md) - Log out of a tenant's session - [auth0 logs](auth0_logs.md) - View tenant logs diff --git a/internal/cli/attack_protection_suspicious_ip_throttling.go b/internal/cli/attack_protection_suspicious_ip_throttling.go index 2968752a2..187d7f0a1 100644 --- a/internal/cli/attack_protection_suspicious_ip_throttling.go +++ b/internal/cli/attack_protection_suspicious_ip_throttling.go @@ -104,6 +104,7 @@ func suspiciousIPThrottlingCmd(cli *cli) *cobra.Command { cmd.AddCommand(showSuspiciousIPThrottlingCmd(cli)) cmd.AddCommand(updateSuspiciousIPThrottlingCmd(cli)) + cmd.AddCommand(ipsCmd(cli)) return cmd } diff --git a/internal/cli/ips.go b/internal/cli/ips.go index 4151e9f58..ad60f6744 100644 --- a/internal/cli/ips.go +++ b/internal/cli/ips.go @@ -19,7 +19,8 @@ func ipsCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ Use: "ips", Short: "Manage blocked IP addresses", - Long: "Manually block or unblock an IP address.", + Long: "Manually block or unblock an IP address that was blocked via the Suspicious IP Throttling " + + "due to multiple suspicious attempts.", } cmd.SetUsageTemplate(resourceUsageTemplate()) @@ -40,9 +41,9 @@ func checkIPCmd(cli *cli) *cobra.Command { Short: "Check IP address", Long: "Check if a given IP address is blocked via the Suspicious IP Throttling due to " + "multiple suspicious attempts.", - Example: ` auth0 ips check - auth0 ips check - auth0 ips check "178.178.178.178"`, + Example: ` auth0 protection suspicious-ip-throttling ips check + auth0 ap sit ips check + auth0 ap sit ips check "178.178.178.178"`, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { if err := ipAddress.Ask(cmd, &inputs.IP); err != nil { @@ -53,23 +54,21 @@ func checkIPCmd(cli *cli) *cobra.Command { } var isBlocked bool - - if err := ansi.Waiting(func() error { - var err error + if err := ansi.Waiting(func() (err error) { isBlocked, err = cli.api.Anomaly.CheckIP(inputs.IP) return err }); err != nil { - return fmt.Errorf("An unexpected error occurred: %w", err) + return fmt.Errorf("failed to check if IP %q is blocked: %w", inputs.IP, err) } cli.renderer.Heading("ip") if isBlocked { cli.renderer.Infof("The IP %s is blocked", inputs.IP) - } else { - cli.renderer.Infof("The IP %s is not blocked", inputs.IP) + return nil } + cli.renderer.Infof("The IP %s is not blocked", inputs.IP) return nil }, } @@ -88,9 +87,9 @@ func unblockIPCmd(cli *cli) *cobra.Command { Short: "Unblock IP address", Long: "Unblock an IP address currently blocked by the Suspicious IP Throttling due to " + "multiple suspicious attempts.", - Example: ` auth0 ips unblock - auth0 ips unblock - auth0 ips unblock "178.178.178.178"`, + Example: ` auth0 protection suspicious-ip-throttling ips unblock + auth0 ap sit ips unblock + auth0 ap sit ips unblock "178.178.178.178"`, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { if err := ipAddress.Ask(cmd, &inputs.IP); err != nil { @@ -103,11 +102,12 @@ func unblockIPCmd(cli *cli) *cobra.Command { if err := ansi.Waiting(func() error { return cli.api.Anomaly.UnblockIP(inputs.IP) }); err != nil { - return fmt.Errorf("An unexpected error occurred: %w", err) + return fmt.Errorf("failed to unblock IP %q: %w", inputs.IP, err) } cli.renderer.Heading("ip") - cli.renderer.Infof("The IP %s was unblocked", inputs.IP) + cli.renderer.Infof("The IP %s was unblocked.", inputs.IP) + return nil }, } diff --git a/internal/cli/root.go b/internal/cli/root.go index dd69b9a05..ef685e3bb 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -168,7 +168,6 @@ func addSubCommands(rootCmd *cobra.Command, cli *cli) { rootCmd.AddCommand(universalLoginCmd(cli)) rootCmd.AddCommand(emailCmd(cli)) rootCmd.AddCommand(customDomainsCmd(cli)) - rootCmd.AddCommand(ipsCmd(cli)) rootCmd.AddCommand(quickstartsCmd(cli)) rootCmd.AddCommand(attackProtectionCmd(cli)) rootCmd.AddCommand(testCmd(cli))