1 (edited by Spayda 2016-01-15 20:53:44)

Topic: fail2ban don't work with round cube

==== Required information ====
-latest
-Ubuntu 14.04
-Mysql
-Apache
-Postfixadmin
====

I have a problem with fail2ban and round cube.
I tried to check if fail2ban is working correctly so i tried to login into my account on round cube multiple times with wrong passwords.
but nothing happens and the mail.log file is still empty. in the jail.local the filter is true.
did i forgot something to configure ?

jail.local
[roundcube-iredmail]                                                                                         
enabled     = true                                                                                           
filter      = roundcube.iredmail                                                                             
action      = iptables-multiport[name=roundcube, port="http,https,smtp,submission,pop3,pop3s,imap,imaps,siev$
logpath     = /var/log/mail.log                                                                             
findtime    = 3600                                                                                           

filter.d/roundcube-iredmail.conf
[Definition]                                                                                                 
failregex = roundcube: (.*) Error: Login failed for (.*) from <HOST>\.                                       
ignoreregex =                                                                                               

note* i updated php5.5 to php5.6 but i don't think that this is a php related problem

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: fail2ban don't work with round cube

in my fail2ban.log i have the following entries
and all other log files seems empty

2016-01-14 18:45:43,998 fail2ban.server : INFO   Changed logging target to /var/log/fail2ban.log for Fail2ba$
2016-01-14 18:45:43,999 fail2ban.jail   : INFO   Creating new jail 'ssh'                                     
2016-01-14 18:45:44,154 fail2ban.jail   : INFO   Jail 'ssh' uses pyinotify                                   
2016-01-14 18:45:44,192 fail2ban.jail   : INFO   Initiated 'pyinotify' backend                               
2016-01-14 18:45:44,194 fail2ban.filter : INFO   Added logfile = /var/log/auth.log                           
2016-01-14 18:45:44,195 fail2ban.filter : INFO   Set maxRetry = 6                                           
2016-01-14 18:45:44,196 fail2ban.filter : INFO   Set findtime = 600                                         
2016-01-14 18:45:44,197 fail2ban.actions: INFO   Set banTime = 600                                           
2016-01-14 18:45:44,241 fail2ban.jail   : INFO   Jail 'ssh' started                                         
2016-01-14 19:04:10,065 fail2ban.server : INFO   Stopping all jails                                         
2016-01-14 19:04:10,665 fail2ban.actions.action: ERROR  iptables -D INPUT -p tcp -m multiport --dports ssh -$
iptables -F fail2ban-ssh                                                                                     
iptables -X fail2ban-ssh returned 100                                                                       
2016-01-14 19:04:10,666 fail2ban.jail   : INFO   Jail 'ssh' stopped                                         
2016-01-14 19:04:10,666 fail2ban.server : INFO   Exiting Fail2ban

3

Re: fail2ban don't work with round cube

iptables -L -n


target     prot opt source               destination                                                         
fail2ban-postfix  tcp  --  0.0.0.0/0            0.0.0.0/0            multiport dports 80,443,25,587,110,995,1
43,993,4190                                                                                                 
fail2ban-dovecot  tcp  --  0.0.0.0/0            0.0.0.0/0            multiport dports 80,443,25,587,110,995,1
43,993,4190                                                                                                 
fail2ban-roundcube  tcp  --  0.0.0.0/0            0.0.0.0/0            multiport dports 80,443,25,587,110,995
,143,993,4190                                                                                               
fail2ban-default  tcp  --  0.0.0.0/0            0.0.0.0/0                                                   
fail2ban-default  tcp  --  0.0.0.0/0            0.0.0.0/0                                                   
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED                     
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0                                                           
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 8                                     
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22                                     
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80                                     
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443                                   
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:25                                     
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:587                                   
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:110                                   
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:995                                   
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:143                                   
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:993                                   
                                                                                                             
Chain FORWARD (policy DROP)                                                                                 
target     prot opt source               destination                                                         
                                                                                                             
Chain OUTPUT (policy ACCEPT)                                                                                 
target     prot opt source               destination                                                         
                                                                                                             
Chain fail2ban-default (2 references)                                                                       
target     prot opt source               destination                                                         
RETURN     all  --  0.0.0.0/0            0.0.0.0/0                                                           
RETURN     all  --  0.0.0.0/0            0.0.0.0/0                                                           
                                                                                                             
Chain fail2ban-dovecot (1 references)                                                                       
target     prot opt source               destination                                                         
RETURN     all  --  0.0.0.0/0            0.0.0.0/0                                                           
                                                                                                             
Chain fail2ban-postfix (1 references)                                                                       
target     prot opt source               destination                                                         
RETURN     all  --  0.0.0.0/0            0.0.0.0/0                                                           
                                                                                                             
Chain fail2ban-roundcube (1 references)                                                                     
target     prot opt source               destination                                                         
RETURN     all  --  0.0.0.0/0            0.0.0.0/0                                                           


But i DONT get banned when i type in roundcube login multiple wrong passwords... and every log file seems empty except some cryptic stuff like "^@^@^@"

4

Re: fail2ban don't work with round cube

If Roundcube logs the client IP as '127.0.0.1', it will be ignored. Check /etc/fail2ban/jail.local, "127.0.0.1" is listed in "ignoreip =" by default. If It's no '127.0.0.1', please show us Roundcube log so that we can help troubleshoot.

Also, you can troubleshoot it with command "fail2ban-regex".

5

Re: fail2ban don't work with round cube

Thanks for your reply smile

the ip from where i trie to get blocked is not localhost.
The logs folder from roundcube is empty

6

Re: fail2ban don't work with round cube

*) Could you please show us the original error log raised by Roundcube (in /var/log/mail.log)?
*) Also, show us output of command below:

fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/roundcube.iredmail.conf

7

Re: fail2ban don't work with round cube

Hi thanks for your replay smile

the /var/log/mail.log is also empty

and here is the output of the command

root@mailsrv:/var/log# fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/roundcube.iredmail.conf

Running tests
=============

Use   failregex file : /etc/fail2ban/filter.d/roundcube.iredmail.conf
Use         log file : /var/log/mail.log


Results
=======

Failregex: 0 total

Ignoreregex: 0 total

Date template hits:

Lines: 0 lines, 0 ignored, 0 matched, 0 missed

8

Re: fail2ban don't work with round cube

Please restart 'rsyslog', 'postfix' and apache services, then check /var/log/mail.log again. and run fail2ban-regex too.

Spayda wrote:

-Postfixadmin

I just realize that you're running PostfixAdmin, although you're free to run any software you like, but just a remind here, iRedMail has many different SQL structure compared to PostfixAdmin, so it MAY mess up the SQL data. Use it on your own.

9

Re: fail2ban don't work with round cube

Thanks for your fast replay smile

I restarted the services and i checked the mail.log.
it is still empty hmm
Thanks for that advice
postfixadmin is to testing purpose only

10

Re: fail2ban don't work with round cube

Spayda wrote:

I restarted the services and i checked the mail.log.
it is still empty

There must be something wrong.

I suggest you double check whether rsyslog (or syslog) service is running. Do files under /var/log/ have new log lines?

11

Re: fail2ban don't work with round cube

Hi thanks for your answer

i checked syslog is running.
But there are no new lines.
Should i reinstall iredmail?
Seems like a bigger problem for me

12

Re: fail2ban don't work with round cube

I suggest stopping syslog program first, then start it manually with debug option to see whether or not it is working as expected.