fail2ban
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
fail2ban [2009/08/21 15:43] – k2patel | fail2ban [2020/08/10 02:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 77: | Line 77: | ||
enabled | enabled | ||
filter | filter | ||
- | action | + | action |
| | ||
logpath | logpath | ||
maxretry = 5 | maxretry = 5 | ||
+ | |||
+ | |||
+ | [kernel-iptables] | ||
+ | |||
+ | enabled | ||
+ | filter | ||
+ | action | ||
+ | | ||
+ | logpath | ||
+ | maxretry = 2 | ||
+ | |||
Line 222: | Line 233: | ||
ignoreip = 168.192.0.1 | ignoreip = 168.192.0.1 | ||
</ | </ | ||
+ | |||
+ | NOTE : In above configuration i am using custom config file for " | ||
+ | which require you to create new file as below. | ||
+ | |||
+ | <code bash | / | ||
+ | # Fail2Ban configuration file | ||
+ | # | ||
+ | # Author: K2patel | ||
+ | # | ||
+ | # $Revision: 1 $ | ||
+ | # | ||
+ | |||
+ | [Definition] | ||
+ | |||
+ | # Option: | ||
+ | # Notes.: | ||
+ | # host must be matched by a group named " | ||
+ | # be used for standard IP/hostname matching and is only an alias for | ||
+ | # (?::: | ||
+ | # Values: | ||
+ | # | ||
+ | failregex = Treason uncloaked! Peer < | ||
+ | |||
+ | # Option: | ||
+ | # Notes.: | ||
+ | # Values: | ||
+ | # | ||
+ | ignoreregex = | ||
+ | </ | ||
+ | |||
Restart service now | Restart service now | ||
Line 252: | Line 293: | ||
test test test. | test test test. | ||
+ | |||
+ | ==== How to test regex for logs ==== | ||
+ | |||
+ | As good software it come with good utility called " | ||
+ | which help you to test your regex against your log as well your custom string. | ||
+ | |||
+ | <code bash> | ||
+ | fail2ban-regex / | ||
+ | </ | ||
+ | OR | ||
+ | |||
+ | <code bash> | ||
+ | fail2ban-regex / | ||
+ | </ | ||
+ | |||
+ | which provides you result if your strings match.\\ | ||
+ | |||
+ | ==== Rotate log ==== | ||
+ | |||
+ | As your standard installation from distribution will generate log on the system.\\ | ||
+ | So it is necessary to rotate it to avoid any file limit.\\ | ||
+ | |||
+ | <code bash | / | ||
+ | / | ||
+ | weekly | ||
+ | rotate 7 | ||
+ | missingok | ||
+ | compress | ||
+ | size 4M | ||
+ | postrotate | ||
+ | / | ||
+ | endscript | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | If you do not have init script you can use following code to reload fail2ban as postrotate command. | ||
+ | |||
+ | <code bash> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | NOTE : Path for fail2ban-client need to changed if you are using other than OpenSUSE | ||
==== Final Words ==== | ==== Final Words ==== |
fail2ban.1250869428.txt.gz · Last modified: 2020/08/10 02:30 (external edit)