LinuxCommandLibrary

fail2ban-client

Manage and monitor Fail2ban server

TLDR

Retrieve current status of the jail service

$ fail2ban-client status [jail]
copy

Remove the specified IP from the jail service's ban list
$ fail2ban-client set [jail] unbanip [ip]
copy

Verify fail2ban server is alive
$ fail2ban-client ping
copy

SYNOPSIS

fail2ban-client [OPTIONS] [arguments]

PARAMETERS

-h, --help
    Show help message and exit.

-i, --interactive
    Enter interactive mode.

-x, --socket
    Use a specific socket (default is /var/run/fail2ban/fail2ban.sock).

-v, --verbose
    Set verbosity level (1-5).

status [JAIL]
    Show status of the server or the specified JAIL.

start [JAIL]
    Start the server or the specified JAIL.

stop [JAIL]
    Stop the server or the specified JAIL.

reload [JAIL]
    Reload the server or the specified JAIL.

restart [JAIL]
    Restart the server.

add JAIL
    Add a new JAIL.

delete JAIL
    Delete JAIL configuration.

set JAIL
    Set a parameter in a JAIL configuration.

get JAIL
    Get a parameter from a JAIL configuration.

ban JAIL IP
    Ban IP address in the specified JAIL.

unban JAIL IP
    Unban IP address from the specified JAIL.

ping
    Ping the Fail2ban server.

DESCRIPTION

The fail2ban-client command is the command-line interface for managing the Fail2ban server. Fail2ban is an intrusion prevention software framework that protects computer servers from brute-force attacks. The fail2ban-client allows users to interact with the Fail2ban server to control its operation.

Users can use fail2ban-client to get status information, start, stop, reload, and restart the Fail2ban server. One can also manage individual jails, enabling or disabling them, obtaining status information, and manually banning or unbanning IP addresses. The command enables administrators to monitor the system, and take action where necessary, either through simple actions or as part of larger automated scripts.

CONFIGURATION FILES

Fail2ban's behaviour is controlled by configuration files, typically located in `/etc/fail2ban`. Jails define the filters and actions applied to log files. Understanding these configurations is crucial for effective use of fail2ban-client.

HISTORY

Fail2ban was created to mitigate brute-force attacks on servers. The fail2ban-client utility has been a core component since the early versions, providing an essential interface for administrators to interact with and manage the Fail2ban daemon. Over time, new commands and options have been added to improve functionality and flexibility as requirements evolve.

SEE ALSO

fail2ban-server(1), fail2ban.conf(5)

Copied to clipboard