1

Topic: fail2ban not working

==== Required information ====
- iRedMail version (check /etc/iredmail-release): iRedMail-0.9.2
- Linux/BSD distribution name and version: Ubuntu 14004 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No (free version)
- Related log if you're reporting an issue:
====

Hi,

fail2ban not working with any of the service (roundcube, SSH etc.) in my iRedmail installation. when i issue command "iptables -n -L INPUT | grep -q fail2ban-ssh" it returns empty screen. My jail.local is as below: Kindly help to fix this issue. Thanks in advance.

# Refer to /etc/fail2ban/jail.conf for more examples.
[DEFAULT]
# time is in seconds. 3600 = 1 hour, 86400 = 24 hours (1 day)
findtime    = 3600
bantime     = 86400
maxretry    = 3
ignoreip    = 127.0.0.1 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16

[sshd]
enabled     = true
filter      = sshd
action      = iptables-allports
logpath     = /var/log/auth.log

[sshd-ddos]
enabled     = true
filter      = sshd-ddos
action      = iptables-allports
logpath     = /var/log/auth.log

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

[dovecot-iredmail]
enabled     = true
filter      = dovecot.iredmail
action      = iptables-multiport[name=dovecot, port="http,https,smtp,submission,pop3,pop3s,imap,imaps,sieve", protocol=tcp]
logpath     = /var/log/dovecot.log

[postfix-iredmail]
enabled     = true
filter      = postfix.iredmail
action      = iptables-multiport[name=postfix, port="http,https,smtp,submission,pop3,pop3s,imap,imaps,sieve", protocol=tcp]
#              sendmail[name=Postfix, dest=root, sender=fail2ban@localhost]
logpath     = /var/log/mail.log

[sogo-iredmail]
enabled     = false
filter      = sogo-auth
action      = iptables-multiport[name=SOGo, port="http,https,smtp,submission,pop3,pop3s,imap,imaps,sieve", protocol=tcp]
logpath     = /var/log/sogo/sogo.log


[apache]
enabled         = true
filter          = apache-auth
action          = iptables-multiport[name=roundcube-fail, port="http,https,smtp,submission,pop3,pop3s,imap,imaps,sieve", protocol=tcp]
logpath         = /var/log/apache2/error.log

----

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

2

Re: fail2ban not working

*) After run 'service fail2ban restart', any related log in /var/log/syslog?
*) Show us output of command 'iptables -L -n'.

3

Re: fail2ban not working

Here is the log after restart fail2ban:

Jul  3 08:08:19 mail fail2ban.filter : INFO   Added logfile = /var/log/mail.log
Jul  3 08:08:19 mail fail2ban.filter : INFO   Set maxRetry = 3
Jul  3 08:08:19 mail fail2ban.filter : INFO   Set findtime = 3600
Jul  3 08:08:19 mail fail2ban.actions: INFO   Set banTime = 86400
Jul  3 08:08:19 mail fail2ban.jail   : INFO   Jail 'apache' started
Jul  3 08:08:19 mail fail2ban.jail   : INFO   Jail 'sshd' started
Jul  3 08:08:19 mail fail2ban.jail   : INFO   Jail 'sshd-ddos' started
Jul  3 08:08:19 mail fail2ban.jail   : INFO   Jail 'roundcube-iredmail' started
Jul  3 08:08:19 mail fail2ban.jail   : INFO   Jail 'dovecot-iredmail' started
Jul  3 08:08:19 mail fail2ban.jail   : INFO   Jail 'postfix-iredmail' started


Output of "iptables -L -n"

Chain INPUT (policy DROP)
target     prot opt source               destination
fail2ban-postfix  tcp  --  0.0.0.0/0            0.0.0.0/0            multiport d                                                                                        ports 80,443,25,587,110,995,143,993,4190
fail2ban-dovecot  tcp  --  0.0.0.0/0            0.0.0.0/0            multiport d                                                                                        ports 80,443,25,587,110,995,143,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
fail2ban-roundcube-fail  tcp  --  0.0.0.0/0            0.0.0.0/0            mult                                                                                        iport dports 80,443,25,587,110,995,143,993,4190
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTA                                                                                        BLISHED
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

Chain fail2ban-roundcube-fail (1 references)
target     prot opt source               destination
RETURN     all  --  0.0.0.0/0            0.0.0.0/0


Hope you can help me on this issue.

Thank you,
Russel

4

Re: fail2ban not working

According to the syslog message and output of iptables, no error at all, and it looks just fine.
What do you mean it doesn't work?