Skip to content

Instantly share code, notes, and snippets.

@pertsevds
Last active December 13, 2024 06:09
Show Gist options
  • Save pertsevds/723c27f42d2224db0ceaa69aa48d009b to your computer and use it in GitHub Desktop.
Save pertsevds/723c27f42d2224db0ceaa69aa48d009b to your computer and use it in GitHub Desktop.
Fail2ban Cockpit filter and jail
Filter "/etc/fail2ban/filter.d/cockpit.conf":
# Fail2Ban filter for Cockpit
#
[Definition]
failregex = pam_unix\(cockpit:auth\): authentication failure;.*rhost=<HOST>
datepattern = ^%%b %%d %%H:%%M:%%S
# DEV Notes:
# Author: Dmitriy Pertsev
Jail "/etc/fail2ban/jail.local":
[cockpit]
enabled = true
port = 9090
logpath = %(syslog_authpriv)s
backend = %(default_backend)s
@lateo-net
Copy link

lateo-net commented Feb 27, 2024

I was looking for a working example.
Very useful, thanks.

Edit:
For the jail configuration file I tried using /etc/fail2ban/jail.d/cockpit.conf instead of /etc/fail2ban/jail.local : works.

@pertsevds
Copy link
Author

@lateo-net 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment