modernleft-docs/fail2ban-manager.md
2025-01-12 23:17:24 -05:00

5.5 KiB

fail2ban-manager

Usage:

$ fail2ban-manager [OPTIONS] COMMAND [ARGS]...

Options:

  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

Commands:

  • jail: Configure Fail2ban jails.
  • config: Configure fail2ban-manager's configuration.
  • plugin: Configure fail2ban-manager's plugins.

fail2ban-manager jail

Configure Fail2ban jails.

Usage:

$ fail2ban-manager jail [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • ls: List all defined jails.
  • enable: Enable a jail.
  • disable: Disable a jail.
  • info: Display information about a jail.
  • edit: Edit the properties of a jail.

fail2ban-manager jail ls

List all defined jails.

Usage:

$ fail2ban-manager jail ls [OPTIONS]

Options:

  • --help: Show this message and exit.

fail2ban-manager jail enable

Enable a jail.

Usage:

$ fail2ban-manager jail enable [OPTIONS] NAME

Arguments:

  • NAME: [required]

Options:

  • --help: Show this message and exit.

fail2ban-manager jail disable

Disable a jail.

Usage:

$ fail2ban-manager jail disable [OPTIONS] NAME

Arguments:

  • NAME: [required]

Options:

  • --help: Show this message and exit.

fail2ban-manager jail info

Display information about a jail.

Usage:

$ fail2ban-manager jail info [OPTIONS] NAME

Arguments:

  • NAME: [required]

Options:

  • --help: Show this message and exit.

fail2ban-manager jail edit

Edit the properties of a jail.

Usage:

$ fail2ban-manager jail edit [OPTIONS] NAME

Arguments:

  • NAME: Name of the jail. [required]

Options:

  • --backend TEXT: The backend used to get file modifications.

Options: .

  • --bantime-increment: Enable searching previously banned IPs to increment the ban time.
  • --bantime-rndtime INTEGER: Add random time (in seconds) to the calculated ban time.
  • --bantime-maxtime INTEGER: Maximum ban time (in seconds) that can be reached.
  • --bantime-factor FLOAT: Factor used for exponential growth of ban time.
  • --bantime-formula TEXT: Custom formula for calculating the next ban time.
  • --bantime-multipliers TEXT: Custom multipliers for calculating the next ban time (e.g., 1 5 30 60).
  • --bantime-overalljails: Search for banned IPs across all jails (default: false).
  • --ignoreself: Ignore local/own IP addresses (default: true).
  • --ignoreip TEXT: List of IPs, CIDR masks, or DNS hosts to ignore.

Example: "127.0.0.1/8 ::1"

  • --ignorecommand TEXT: Command to dynamically determine if an IP should be ignored.
  • --bantime TEXT: Duration for which a host is banned (e.g., 10m, 1h).
  • --findtime TEXT: Time window for counting failed attempts before a ban (e.g., 10m).
  • --maxretry INTEGER: Number of failed attempts allowed before a ban is triggered.
  • --maxmatches INTEGER: Maximum number of stored matches for actions (defaults to maxretry).
  • --protocol TEXT: Protocol to be banned (default: tcp).
  • --port TEXT: Ports to ban (e.g., 0:65535 to ban all ports).
  • --chain TEXT: Specify the chain where jumps will be added for ban actions.
  • --usedns TEXT: Behavior for DNS lookups (yes, warn, no, raw).
  • --logencoding TEXT: Encoding of the log files (e.g., utf-8, ascii, auto).
  • --action TEXT: Default action for banning.

EX: action_, action_mw, action_mwl, action_xarf, action_cf_mwl, action_abuseipdb

multiple values can be specified. --action action_ --action action_mw

  • --mta TEXT: Mail Transfer Agent (e.g., sendmail).
  • --sender TEXT: Sender email address for notifications.
  • --destemail TEXT: Destination email address for notifications.
  • --fail2ban-agent TEXT: User-agent format for Fail2Ban.
  • --delete TEXT: Delete an option from the jail.

Example: --delete bantime

  • --help: Show this message and exit.

fail2ban-manager config

Configure fail2ban-manager's configuration.

Usage:

$ fail2ban-manager config [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • reset: Copy default configurations from *.conf...

fail2ban-manager config reset

Copy default configurations from *.conf to *.local and json files.

Usage:

$ fail2ban-manager config reset [OPTIONS]

Options:

  • --help: Show this message and exit.

fail2ban-manager plugin

Configure fail2ban-manager's plugins.

Usage:

$ fail2ban-manager plugin [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • ls: List installed plugins.
  • enable: Enable a plugin.
  • disable: Disable a plugin.

fail2ban-manager plugin ls

List installed plugins.

Usage:

$ fail2ban-manager plugin ls [OPTIONS]

Options:

  • --help: Show this message and exit.

fail2ban-manager plugin enable

Enable a plugin.

Usage:

$ fail2ban-manager plugin enable [OPTIONS] PLUGIN_NAME

Arguments:

  • PLUGIN_NAME: [required]

Options:

  • --help: Show this message and exit.

fail2ban-manager plugin disable

Disable a plugin.

Usage:

$ fail2ban-manager plugin disable [OPTIONS] PLUGIN_NAME

Arguments:

  • PLUGIN_NAME: [required]

Options:

  • --help: Show this message and exit.