I googled but can't seem to find any tutorial on this. I would like to understand what the fail2ban syntax is and how it works, as I would like to create my own custom "jails". Anyone know of a good resource on this?
For example this is the code for ssh, but I'm not sure what the format is and what the characters and such mean, so would be nice to have a tutorial on that. Oddly the fail2ban site does not seem to talk much about making custom rules and how the syntax works.
For example this is the code for ssh, but I'm not sure what the format is and what the characters and such mean, so would be nice to have a tutorial on that. Oddly the fail2ban site does not seem to talk much about making custom rules and how the syntax works.
Code:
failregex = ^%(__prefix_line)s(?:error: PAM: )?Authentication failure for .* from <HOST>\s*$
^%(__prefix_line)s(?:error: PAM: )?User not known to the underlying authentication module for .* from <HOST>\s*$
^%(__prefix_line)sFailed (?:password|publickey) for .* from <HOST>(?: port \d*)?(?: ssh\d*)?\s*$
^%(__prefix_line)sROOT LOGIN REFUSED.* FROM <HOST>\s*$
^%(__prefix_line)s[iI](?:llegal|nvalid) user .* from <HOST>\s*$
^%(__prefix_line)sUser .+ from <HOST> not allowed because not listed in AllowUsers\s*$
^%(__prefix_line)sUser .+ from <HOST> not allowed because listed in DenyUsers\s*$
^%(__prefix_line)s(?:pam_unix\(sshd:auth\):\s)?authentication failure; logname=\S* uid=\S* euid=\S* tty=\S* ruser=\S* rhost=<HOST>(?:\s+user=.*)?\s*$
^%(__prefix_line)srefused connect from \S+ \(<HOST>\)\s*$
^%(__prefix_line)sAddress <HOST> .* POSSIBLE BREAK-IN ATTEMPT!*\s*$
^%(__prefix_line)sUser .+ from <HOST> not allowed because none of user's groups are listed in AllowGroups\s*$