rainloop-webmail icon indicating copy to clipboard operation
rainloop-webmail copied to clipboard

Strengthening authentication

Open namezk opened this issue 12 years ago • 13 comments

Hi Devs, I have two suggestions for enhancing the security of this already great software.

1- Rate limiting: IP lockout after x failed logins to combat brute force attacks. Example: https://code.google.com/p/rcd-plugin-antibruteforce At a minimum, failed logins should be logged so something like fail2ban can use the log to block the offending IP.

2- Two factor authentication. Like this https://github.com/alexandregz/twofactor_gauthenticator for example.

I look forward to hearing your opinion on this, and thanks for your time.

namezk avatar Mar 22 '14 03:03 namezk

Thanks for feature request!

RainLoop avatar Mar 22 '14 19:03 RainLoop

Please, try two factor authentication in the latest version of the RainLoop Webmail (1.6.4.890).

RainLoop avatar Apr 05 '14 20:04 RainLoop

Works beautifully! Thanks so much for the quick turn-around!

namezk avatar Apr 05 '14 22:04 namezk

I am looking forward for fail2ban also. It would be a great feature along side with two factor authentication.

I use rainloop on my server and I miss fail2ban integration...

tuhinbhuiyan avatar Apr 22 '15 09:04 tuhinbhuiyan

it's already implemented

../data/..../application.ini

[logs]
auth_logging = On
auth_logging_filename = "fail2ban/auth-{date:Y-m-d}.txt"
auth_logging_format = "Auth failed: ip={request:ip} user={imap:login} host={imap:host} port={imap:port}"

RainLoop avatar Apr 22 '15 10:04 RainLoop

Just turned it on... It was off. Also do I need to create a filter in fail2ban?.

tuhinbhuiyan avatar Apr 22 '15 10:04 tuhinbhuiyan

Yes, it's off by default. RainLoop just create a file and you need to create a filter in fail2ban.

RainLoop avatar Apr 22 '15 10:04 RainLoop

Interesting writing fail2ban rules as we speak...

ervee avatar Apr 22 '15 14:04 ervee

Hi ervee, did you end up making some fail2ban rules? Mind sharing if so?

ghost avatar Aug 27 '15 14:08 ghost

This is my /etc/fail2ban/filter.d/rainloop.conf

# Fail2Ban configuration file
#
# Author: eRVee Moskovic
#
# $Revision$
#

[Definition]

# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching.
# Values: TEXT
#
failregex = : Auth failed: ip=<HOST> user=.* host=.* port=.*$


# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

and this is in my /etc/fail2ban/jail.local

[rainloop]
enabled = true
banaction = iptables-multiport
filter = rainloop
port = http,https
logpath = /!!!PATH-TO-RAINLOOP-DATA-FOLDER!!!/_default_/logs/fail2ban/auth-*.txt
maxretry = 5
findtime = 1500
bantime = 600

Replace !!!PATH-TO-RAINLOOP-DATA-FOLDER!!! with the path to your RainLoop data folder off course.

ervee avatar Sep 03 '15 06:09 ervee

Rainloop, it seems incorrect two-factor auth failed attempts do not show up in the auth log, can you correct this please?

(I'll open a new issue)

ghost avatar Sep 07 '15 13:09 ghost

Hi all, Just tried to implement ervee's configuration on my server : nothing happens when I try to simulate incorrect auths : they are correctly written in the log file, the rainloop filter is on, but fail2ban doesn't ban the IP. Any idea of what could be the problem ?

Cheers,

Arnaud31500 avatar Jan 13 '16 15:01 Arnaud31500

If you use CSF/LFD rather than fail2ban, here's how to configure this:

  1. Enable auth logging in the app config as above (auth_logging = On)
  2. Edit /etc/csf/csf.conf and at the bottom of the file make CUSTOM2_LOG (or whichever one is available to you) set like: CUSTOM2_LOG = "/path/to/rainloop/data/_data_/_default_/logs/fail2ban/auth-fail.log"
  3. Edit /usr/local/csf/bin/regex.custom.pm and add this before the return 0; line:
# Rainloop Login Bruteforce Detection.
if ( ($globlogs{CUSTOM2_LOG}{$lgfile}) and ($line =~ /Auth failed: ip=(\d+\.\d+\.\d+\.\d+)/) ) {
                return ("Detected multiple failed Rainloop webmail login attempts from",$1,"rainloopbruteforcematch","25","80,443","1800");
}

Make sure you change the CUSTOM2_LOG to whichever custom log file number you configured in step 2 above.

jas8522 avatar Jun 17 '20 15:06 jas8522