modernleft-docs/utilities/fail2ban-manager/plugins/telegram.md

145 lines
3 KiB
Markdown
Raw Permalink Normal View History

2025-01-19 08:10:39 +00:00
---
title: fail2ban-manager plugin - telegram
draft: true
date: 2025-01-16
---
**Usage**:
```console
$ fail2ban-manager telegram [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**:
- `ls`: List all jails with Telegram notifications.
- `add-to-jail`: Add the Telegram provider to a jail.
- `remove-from-jail`: Remove the Telegram provider from a jail.
- `edit-message`: Set the message for a specific action.
- `enable-message`: Enable a message for a specific action in...
- `send`: Send a messague to a Telegram bot.
## `fail2ban-manager telegram ls`
List all jails with Telegram notifications.
**Usage**:
```console
$ fail2ban-manager telegram ls [OPTIONS]
```
**Options**:
- `--help`: Show this message and exit.
## `fail2ban-manager telegram add-to-jail`
Add the Telegram provider to a jail.
**Usage**:
```console
$ fail2ban-manager telegram add-to-jail [OPTIONS] JAILNAME TOKEN CHATID
```
**Arguments**:
- `JAILNAME`: [required]
- `TOKEN`: [env var: TELEGRAM_API_TOKEN; required]
- `CHATID`: [env var: TELEGRAM_CHAT_ID; required]
**Options**:
- `--help`: Show this message and exit.
## `fail2ban-manager telegram remove-from-jail`
Remove the Telegram provider from a jail.
**Usage**:
```console
$ fail2ban-manager telegram remove-from-jail [OPTIONS] JAILNAME
```
**Arguments**:
- `JAILNAME`: [required]
**Options**:
- `--help`: Show this message and exit.
## `fail2ban-manager telegram edit-message`
Set the message for a specific action.
**Usage**:
```console
$ fail2ban-manager telegram edit-message [OPTIONS] JAILNAME ACTION MESSAGE
```
**Arguments**:
- `JAILNAME`: [required]
- `ACTION`: The action to send a message for. [required]
- `MESSAGE`: The action to send. [required]
**Options**:
- `--help`: Show this message and exit.
## `fail2ban-manager telegram enable-message`
Enable a message for a specific action in a jail.
**Usage**:
```console
$ fail2ban-manager telegram enable-message [OPTIONS] JAILNAME
```
**Arguments**:
- `JAILNAME`: [required]
**Options**:
- `--start`: Enable message for start action.
- `--stop`: Enable message for stop action.
- `--check`: Enable message for check action.
- `--ban`: Enable message for ban action.
- `--unban`: Enable message for unban action.
- `--help`: Show this message and exit.
## `fail2ban-manager telegram send`
Send a messague to a Telegram bot.
**Usage**:
```console
$ fail2ban-manager telegram send [OPTIONS] ACTION JAILNAME [TOKEN] [CHATID]
```
**Arguments**:
- `ACTION`: The action to send a message for. [required]
- `JAILNAME`: Name of the jail sending the message [required]
- `[TOKEN]`: [env var: TELEGRAM_API_TOKEN]
- `[CHATID]`: [env var: TELEGRAM_CHAT_ID]
**Options**:
- `--ip TEXT`: IP address of the banned/unbanned IP
- `--failures INTEGER`: Number of failures before ban [default: 0]
- `--help`: Show this message and exit.