Fail2ban: Difference between revisions
documenting weirdness |
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight" |
||
| Line 5: | Line 5: | ||
# cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local | # cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local | ||
# Then Add this to your /etc/fail2ban/jail.local file | # Then Add this to your /etc/fail2ban/jail.local file | ||
< | <syntaxhighlight lang="ini"> | ||
# | # | ||
# HTTP servers | # HTTP servers | ||
| Line 20: | Line 20: | ||
bantime = 183600 | bantime = 183600 | ||
maxretry = 2 | maxretry = 2 | ||
</ | </syntaxhighlight> | ||
Make sure you create the filter which is invoked by the above configuration | Make sure you create the filter which is invoked by the above configuration | ||
cat /etc/fail2ban/filter.d/apache-post.conf | cat /etc/fail2ban/filter.d/apache-post.conf | ||
< | <syntaxhighlight lang="ini"> | ||
# Fail2Ban configuration file | # Fail2Ban configuration file | ||
# | # | ||
| Line 43: | Line 43: | ||
## You can leave this empty if you've added your address already in .local as a default | ## You can leave this empty if you've added your address already in .local as a default | ||
ignoreregex = 99\.999\.9\.99 | ignoreregex = 99\.999\.9\.99 | ||
</ | </syntaxhighlight> | ||
== More == | == More == | ||
| Line 59: | Line 59: | ||
== Status == | == Status == | ||
If you have many jails, and want to see the status of each of them, there is no built-in <code>--all</code> option for '''<code>fail2ban-client status</code>''' but you can just use a simple short script: | If you have many jails, and want to see the status of each of them, there is no built-in <code>--all</code> option for '''<code>fail2ban-client status</code>''' but you can just use a simple short script: | ||
< | <syntaxhighlight lang="bash"> | ||
fail2ban-client status | sed -n 's/,//g;s/.*Jail list://p' | xargs -n1 fail2ban-client status | fail2ban-client status | sed -n 's/,//g;s/.*Jail list://p' | xargs -n1 fail2ban-client status | ||
</ | </syntaxhighlight> | ||
== Restarts == | == Restarts == | ||