#1  
Old 7th September 2009, 09:04
iceget iceget is offline
Junior Member
 
Join Date: Feb 2008
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fail2Ban on ISPConfig 2.x

hello community,

i had one question.

my ftp account on my ISPCONFIG 2.X Server was hacked.

the hacker group have tried the attacks in a period of 3 months,
and they have finished the hack. my ftp password was hacked.

i have changed this password, and my question are:

can fail2ban help me in this situations?

it running vsftpd on my server!

yes? how i can install and configure it?


thank you very much

kind regards
Reply With Quote
Sponsored Links
  #2  
Old 8th September 2009, 13:40
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,665
Thanks: 1,896
Thanked 2,595 Times in 2,446 Posts
Default

Quote:
Originally Posted by iceget View Post
can fail2ban help me in this situations?
Yes.

Quote:
Originally Posted by iceget View Post
yes? how i can install and configure it?
I've written a few fail2ban tutorials. You can use the "Search" function to find them.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 9th September 2009, 11:43
iceget iceget is offline
Junior Member
 
Join Date: Feb 2008
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re

Hello!

I have searched fail2bain but i can't find any thread opened with your name "falco".

can you send me the link for the tut?

thank you very much!
Reply With Quote
  #4  
Old 9th September 2009, 12:38
_X_ _X_ is offline
Senior Member
 
Join Date: Oct 2008
Posts: 248
Thanks: 8
Thanked 37 Times in 35 Posts
Default

here:

http://www.howtoforge.com/trip_search?keys=fail2ban

just find your distribution ...
Reply With Quote
  #5  
Old 9th September 2009, 12:49
iceget iceget is offline
Junior Member
 
Join Date: Feb 2008
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re

hello!

icannot find the tutorial for

debian 4.0 with roundcube and ISPConfig-2.2.33...

What for a tutorial i can use?

can you help me?

thank you very much!
Reply With Quote
  #6  
Old 9th September 2009, 21:53
_X_ _X_ is offline
Senior Member
 
Join Date: Oct 2008
Posts: 248
Thanks: 8
Thanked 37 Times in 35 Posts
Default

as far as I can see you can use this:

http://www.howtoforge.com/fail2ban_debian_etch

actually after installation you have to copy

/etc/fail2ban/jail.conf

as

/etc/fail2ban/jail.local

Code:
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
and uncomment lines for services you want fail2ban to watch for in /etc/fail2ban/jail.local

after that

Code:
 /etc/init.d/fail2ban restart
maybe adjustment to some failregex will be needed

failregex is actualy syntax of error in appropriate log file so modifying it to specific needs shouldn't be a problem.

Last edited by _X_; 9th September 2009 at 21:56.
Reply With Quote
  #7  
Old 11th September 2009, 13:25
iceget iceget is offline
Junior Member
 
Join Date: Feb 2008
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re

Hello!!

Thank you for your help!

I have installed fail2ban with:

apt-get update && apt-get install fail2ban

now i have made a copy of the original configuration file:
cp /etc/fail2ban/jail.conf cp /etc/fail2ban/jail.local

now my config file are:

/etc/fail2ban/jail.conf and /etc/fail2ban/jail.local:
[DEFAULT]

# "ignoreip" can be an IP address, a CIDR mask or a DNS host
ignoreip = 127.0.0.1
bantime = 600
maxretry = 3

# "backend" specifies the backend used to get files modification. Available
# options are "gamin", "polling" and "auto".
# yoh: For some reason Debian shipped python-gamin didn't work as expected
# This issue left ToDo, so polling is default backend for now
backend = polling

#
# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = root@localhost

# Default action to take: ban only
action = iptables[name=%(__name__)s, port=%(port)s]


[ssh]

enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 5


[apache]

enabled = true
port = http
filter = apache-auth
logpath = /var/log/apache*/*error.log
maxretry = 5


[apache-noscript]

enabled = false
port = http
filter = apache-noscript
logpath = /var/log/apache*/*error.log
maxretry = 5


[vsftpd]

enabled = false
port = ftp
filter = vsftpd
logpath = /var/log/auth.log
maxretry = 5


[proftpd]

enabled = true
port = ftp
filter = proftpd
logpath = /var/log/auth.log
failregex = proftpd: \(pam_unix\) authentication failure; .* rhost=<HOST>
maxretry = 5


[wuftpd]

enabled = false
port = ftp
filter = wuftpd
logpath = /var/log/auth.log
maxretry = 5


[postfix]

enabled = false
port = smtp
filter = postfix
logpath = /var/log/mail.log
maxretry = 5


[courierpop3]

enabled = true
port = pop3
filter = courierlogin
failregex = courierpop3login: LOGIN FAILED.*ip=\[.*:<HOST>\]
logpath = /var/log/mail.log
maxretry = 5


[courierimap]

enabled = true
port = imap2
filter = courierlogin
failregex = imapd: LOGIN FAILED.*ip=\[.*:<HOST>\]
logpath = /var/log/mail.log
maxretry = 5


[sasl]

enabled = true
port = smtp
filter = sasl
failregex = warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed
logpath = /var/log/mail.log
maxretry = 5


now i have restarted fail2ban with
/etc/init.d/fail2ban restart

and i have tried with ftp and .htaccess user auth, to lock my ip.

i have tried 10 times with user auth on .htaccess and 10 times with vsftpd, but fail2ban doesnt lock my ip.


must i configure other files??

here are all what i have done.


can you help me?

what you mean with regex?

thanks!

kind regards
Reply With Quote
  #8  
Old 11th September 2009, 15:14
_X_ _X_ is offline
Senior Member
 
Join Date: Oct 2008
Posts: 248
Thanks: 8
Thanked 37 Times in 35 Posts
Default

as example:

you have in your jail.local
Code:
[proftpd]

enabled = true
port = ftp
filter = proftpd
logpath = /var/log/auth.log
failregex = proftpd: \(pam_unix\) authentication failure; .* rhost=<HOST>
maxretry = 5
this means that fail2ban looks into
/var/log/auth.log
for something that begins with
proftpd: pam_unix *something* authentication failure; *something* rhost=<*IP*>
if it found this 5 times it will block *IP* from that line in log file.

if proftpd creates failed authentication logs in /var/log/auth.log that looks like failregex line then it will block that IP.

here is example from my log:
Code:
Sep  6 19:57:15 my_domain proftpd: pam_unix(proftpd:auth): authentication failure; logname= uid=0 euid=0 tty= ruser=backup rhost=::ffff:79.15.63.24  user=backup
and fail2ban response in /var/log/fail2ban.log

Code:
2009-09-06 19:58:03,248 fail2ban.actions: WARNING [proftpd] Ban 79.15.63.24

Last edited by _X_; 11th September 2009 at 15:18.
Reply With Quote
  #9  
Old 12th September 2009, 16:53
iceget iceget is offline
Junior Member
 
Join Date: Feb 2008
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default Re

Thank you very much!

it works fine!

kind regards

iceget
Reply With Quote
Reply

Bookmarks

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
fail2ban is doing nothing? rlischer Server Operation 16 29th June 2010 07:29
ISPConfig 3.0.0.9 RC2 released till General 51 17th April 2009 17:12
ISPConfig 3.0.0.5 Beta Released till General 77 23rd July 2008 12:14
ISPConfig 2.3.1-dev released till General 0 8th May 2006 22:18
SP-Server Setup - Ubuntu 5.10 "Breezy Badger" - Page 6 (changes) LuisC-SM HOWTO-Related Questions 0 21st April 2006 15:16


All times are GMT +2. The time now is 06:16.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.