You can Enhance your security by enable roundcube section
Roundcube does have captcha plugins available which will mitigate this, but users will complain if they have to type in a captcha to login for mail.
Fail2ban provides an easy solution for this.
First up, we need to add roundcube into /etc/fail2ban/jail.conf
[roundcube]
enabled = false
port = http,https
filter = roundcube
action = iptables-multiport[name=roundcube, port="http,https"]
logpath = [YOUR PATH TO ROUNDCUBE HERE]/logs/errors
maxretry = 5
findtime = 600
bantime = 3600
Change [YOUR PATH TO ROUNDCUBE HERE] in the above to your actual roundcube folder
eg /home/roundcube/public_html/logs/errors
Next, we need to create a filter.
Add /etc/fail2ban/filter.d/roundcube.conf
[Definition]
failregex = IMAP Error: Login failed for . from <HOST>(\. . in .?/rcube_imap\.php on line \d+ \(\S+ \S+\))?$
ignoreregex =
Now we have the basics in place, we need to test out our filter.
For that, we use fail2ban-regex.
Enjoy
^%(__prefix_line)sFailed password for invalid user .*? from <HOST>(?: port \d+)?\s*$, specified on a new line below the first (use spaces, not tabs, to align them to the right hand side of the = equals sign, to avoid python interpreter issues). To test, runfail2ban-regex /var/log/secure /etc/fail2ban/filter.d/sshd-invaliduser.conf. – Chris Woods Jun 15 '19 at 18:17