Skip to content

Instantly share code, notes, and snippets.

@Strykar
Last active December 25, 2022 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Strykar/03d2b24db4a9088be6d3ce11891466b8 to your computer and use it in GitHub Desktop.
Save Strykar/03d2b24db4a9088be6d3ce11891466b8 to your computer and use it in GitHub Desktop.
A single file config for adding bots that probe Weechat's relay port to a Fail2ban jail (/etc/fail2ban/jail.d/weechat.conf)
[weechat]
filter =
enabled = false
banaction = nftables
action = nftables-allports[name=weechat]
backend = auto
logpath = /home/user/.local/share/weechat/logs/core.weechat.weechatlog
logencoding = utf-8
port = 9000
protocol = tcp
banTime = 1w
findtime = 1d
maxRetry = 2
ignoreip = 127.0.0.0/8 ::1 10.0.0.0/24 172.16.0.0/12 192.168.1.0/24
failregex = ^\s*(?:=!=\s*)?relay: (?:reading data on socket|TLS handshake failed) for client \d+/ssl.weechat/<ADDR>: error -?\d+
# To match on specific TLS errors:
#failregex = ^\s*(?:=!=\s*)?relay: (?:reading data on socket|TLS handshake failed) for client \d+/ssl.weechat/<ADDR>: error (?:0|-8|-110|-87|-54|-15)\b
# Author: Sergey G. Brester (sebres)
# Strykar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment