Confluence 5.6 has reached end of life
Check out the [latest version] of the documentation
We need a means of defending sites against brute-force login attempts. Fail2Ban is a Python application which trails logfiles, looks for regular expressions and works with Shorewall (or directly with iptables) to apply temporary blacklists against addresses that match a pattern too often. This can be used to limit the rate at which a given machine hits login URLs for Confluence.
The information on this page does not apply to Confluence Cloud.
This list is a skeletal version of the instructions
/etc/fail2ban.conf files (fail2ban.conf and jail.conf). Don't change these, as it makes upgrading difficult..local files corresponding to the .conf files. These only need to contain the specific settings you want overridden, which helps maintainability.filter.d — this is where you define regexps, each going into its own fileaction.d — you probably won't need to add one, but it's handy to know what's availablejail.conf and jail.local. Don't forget the enabled setting for each one — it can be as bad to have the wrong ones enabled as to have the right ones disabled./etc/init.d/fail2ban {start|stop|status} for the obvious operationsfail2ban-client -d to get it to dump its current configuration to STDOUT. Very useful for troubleshooting.jail.local
# The DEFAULT allows a global definition of the options. They can be override # in each jail afterwards. [DEFAULT] # "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not # ban a host which matches an address in this list. Several addresses can be # defined using space separator. # ignoreip = <space-separated list of IPs> # "bantime" is the number of seconds that a host is banned. bantime = 600 # A host is banned if it has generated "maxretry" during the last "findtime" # seconds. findtime = 60 # "maxretry" is the number of failures before a host get banned. maxretry = 3 [ssh-iptables] enabled = false [apache-shorewall] enabled = true filter = cac-login action = shorewall logpath = /var/log/httpd/confluence-access.log bantime = 600 maxretry = 3 findtime = 60 backend = polling
The following is an example only, and you should adjust it for your site.
filter.d/confluence-login.conf
[Definition] failregex = <HOST>.*"GET /login.action ignoreregex =