RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > SVN Releases > Issues & Bugs

For more information about the ads and why they're here, please see the FAQ

Reply
  1 links from elsewhere to this Post. Click to view. #1  
Old 07-25-2008, 12:28 PM
Registered User
 
Join Date: Jul 2008
Posts: 8
Default [ErrorLog] Client IP Address

Hi guys,

I've a little question:
I'm a bit concerned about brute force attacks by script kiddies. Therefore, I'd like to "lock" ip addresses if too many logins tries have been made by a certain ip address.

I'd like to do this with fail2ban. The problem here is, that roundcube does not save the ip of the client in the log.

I'd like to add this to the loggin and auth messages, and parse for those.
Is the client IP stored anywhere in the in example $conn object? Or will i have to read them manually out of the http environment of apache?

Of course, I'd need to check for
HTTP_X_FORWARDED_FOR and REMOTE_ADDR

Kind regards,
// STi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07-25-2008, 12:47 PM
Registered User
 
Join Date: Jul 2008
Posts: 21
Default

but if someone DOES get access, and does not belong on your site, you should also block him, or not ?

so, i think, you need 2 things:
1) a decent way in roundcube to block a user after i.e. 3 wrong passwords.
2) your solution to block user-access to your site (using i.e. fail2ban)
__________________
JSkywalker

Dovecot 1.1.1 - Postfix 2.3.2 - Roundcube 0.2a - Opensuse 10.2
Apache 2.2.3 - Php 5.2.6 - Mysql 5.0.26
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 07-25-2008, 01:38 PM
Registered User
 
Join Date: Jul 2008
Posts: 8
Default

Well, exactly.
But first step would be fine to log correctly so i can block users by fail2ban, since not being able to connect to the site for e.g 5 minutes is quite enough to ensure him a long turn until he gets passwords cracked.

I have the same setup for imap, pop3, imaps and pop3s, and think it's a quite good solution.
Any script kiddie who can use autoit (in example) can do both, use a application to try cracking passwords and trying to log in on roundcube.

But indeed, I'd like to see a "lock user" function in roundcube, if too many bad logins have been made - what'd be rather a feature request. Maybe both are, but I think the first one (ip address to log) can be done easily. Hopefully it's standard one day for roundcube .

Kind regards,
// STi

Last edited by STiAT; 07-25-2008 at 01:52 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 07-25-2008, 02:54 PM
Registered User
 
Join Date: Jul 2008
Posts: 21
Default

but, a blocked user on IMAP, is a blocked user on Roundcube...

so, if imap is block after a few attempts, you should have reached what you want (informing the user that he/she is blocked is not needed for a script-kid )
__________________
JSkywalker

Dovecot 1.1.1 - Postfix 2.3.2 - Roundcube 0.2a - Opensuse 10.2
Apache 2.2.3 - Php 5.2.6 - Mysql 5.0.26
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 07-25-2008, 06:46 PM
Registered User
 
Join Date: Jul 2008
Posts: 8
Default

Quote:
Originally Posted by JSkywalker View Post
but, a blocked user on IMAP, is a blocked user on Roundcube...

so, if imap is block after a few attempts, you should have reached what you want (informing the user that he/she is blocked is not needed for a script-kid )
True, but in this case false.
I can't block the IP address of the IMAP client connecting, since roundcube connects as "localhost". Therefore, the failed login attempt is from localhost - which I had to ignore, since I'd block the whole webmail on failed webmail login attempts.

That's why I need roundcube to log the IP of the user attempting to connect, to block http, https, and imap(s) / pop3(s).

Kind regards,
// STi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 07-25-2008, 07:43 PM
Registered User
 
Join Date: Jul 2008
Posts: 8
Default

For a fast information "how to get it working":

Code:
vi program/lib/imap.inc
$conn->error    .= 'Authentication for ' . $user . ' (' . getenv("REMOTE_ADDR") . ') failed (LOGIN): "';
$conn->error    .= 'Authentication for ' . $user . ' (' . getenv("REMOTE_ADDR") . ') failed (AUTH): "';
in /etc/fail2ban/jail.conf (in my case)
Code:
[roundcube]
enabled  = true
port     = http,https
filter   = roundcube
action   = iptables-multiport[name=roundcube, port="http,https"]
logpath  = /home/httpd/html/~roundcubemail/logs/errors
in /etc/fail2ban/filter.d/roundcube.conf
Code:
[Definition]
failregex = IMAP Error: Authentication for .* \(<HOST>\) failed \((?:LOGIN|AUTH)\):
ignoreregex =
Kind regards,
// STi

Last edited by STiAT; 07-25-2008 at 07:49 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 04-09-2009, 01:47 PM
Registered User
 
Join Date: Apr 2009
Posts: 1
Default

Hello STiAT,

Thanks for the tip!
It works perfectly, and should definitely be added to Roundcube code!

Regards.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 08-19-2009, 03:00 PM
mdr's Avatar
mdr mdr is offline
Registered User
 
Join Date: Aug 2008
Location: Saint Paul, MN, USA
Posts: 12
Send a message via Skype™ to mdr
Default RoundCube Fail2Ban Plugin

Check out the RoundCube Fail2Ban Plugin also as a quick and easy way to do this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.roundcubeforum.net/6-svn-releases/20-issues-bugs/3304-errorlog-client-ip-address.html
Posted By For Type Date
RoundCube Fail2Ban Plugin – Matt Rude This thread Refback 10-02-2009 08:15 PM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:04 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Copyright © 2006-2008 RoundCube Webmail Community