WebHostGear.com - the hosting resource for professionalshosting tutorials 
hosting howto webhost guide server managementFebruary 09, 2010
server management, apache tutorials, hosting tutorials, cpanel, server security
Home / Hosting Tutorials / Server Security / How to install BFD (Brute Force Detection)

How to install BFD (Brute Force Detection)



Printer Friendly Printer Friendly Send to a friend Send to a friend
By : ramprage Rating : Average Rating : 8.54 From 116 Voter(s)

What is BFD (Brute Force Detection)?
BFD is a modular shell script for parsing applicable logs and checking for authentication failures. There is not much complexity or detail to BFD yet and likewise it is very straight-forward in its installation, configuration and usage. The reason behind BFD is very simple; the fact there is little to no authentication and brute force auditing programs in the linux community that work in conjunction with a firewall or real-time facility to place bans. BFD is available at: http://www.rfxnetworks.com/bfd.php

This guide will show you how to install and configure BFD to protect your system from brute force hack attempts.

Requirements:
- You MUST have APF Firewall Installed before installing BFD - it works with APF and requires some APF files to operate.
- Root SSH access to your server

Updated: April 13, 2005

Lets begin!
Login to your server through SSH and su to the root user.

1. cd /root/downloads or another temporary folder where you store your files.

Article provided by WebHostGear.com

2. wget http://www.rfxnetworks.com/downloads/bfd-current.tar.gz

3. tar -xvzf bfd-current.tar.gz

4. cd bfd-0.7

5. Run the install file: ./install.sh
You will receive a message saying it has been installed

.: BFD installed
Install path:    /usr/local/bfd
Config path:     /usr/local/bfd/conf.bfd
Executable path: /usr/local/sbin/bfd

6. Lets edit the configuration file: pico /usr/local/bfd/conf.bfd

7. Enable brute force hack attempt alerts:
Find: ALERT_USR="0"   CHANGE TO: ALERT_USR="1"   

Find: EMAIL_USR="root" CHANGE TO: EMAIL_USR="your@yourdomain.com"

Save the changes: Ctrl+X then Y

8. Prevent locking yourself out!
pico -w /usr/local/bfd/ignore.hosts and add your own trusted IPs
Eg: 192.168.1.1

Save the changes: Ctrl+X then Y

BFD uses APF' cli insert feature
and as such will override any allow_hosts.rules entries users have in-place.
So be sure to add your trusted ip addresses to the ignore file to prevent
locking yourself out.

9. Run the program!
/usr/local/sbin/bfd -s

10. Customize your applicatoins brute force configuration
Check out the rules directory in your /usr/local/bfd

Here you'll find all kinds of pre-made rules for popular services such as Apache, and ProFTPD w00t!
If you have any clue about shell scripting you can customize them or create new rules for enhanced brute force detection and prevent attacks.

Thanks to RFX Networks for creating another great script for the community, Brute Force Detection is excellent!

Cheers
Steve

New! - Need server help? Hire an Expert

Get professional help with your configuration, script installation or server issue.
Learn how we can help you with any server problem and make your server run like new. Professional staff will contact you, after submitting a quote request, by phone or email.

Rate this Article :

1

2

3

4

5

6

7

8

9

10
Poor Excellent

Related Articles


How to install APF (Advanced Policy Firewall)


Discuss this article with others in our new hosting forums

Comments / Feedback

Olly
What if your IP isnt static, (if you are talking about the ip which you use to connect, not your box ip) how would you get around this problem?
Mike
"What if your IP isnt static, (if you are talking about the ip which you use to connect, not your box ip) how would you get around this problem? " I was wondering the same thing, what if your IP isn't static.
matlex
I think its simple then. Add the whole IP range of your ISP. for example: If you ISP IP range 12.234.345.0-12.234.345.255 Add just this: 12.234.345
bman
any idears how to fix this ? tail -f /var/log/bfd_log Feb 14 20:35:00 xxxxxx BFD(8570): could not locate $FWFILE, aborting.
Alex
could not locate $FWFILE is because you didnt installed APF before
Ryan
Q: what if 1, you dont have static ips, and 2, your isp has more then 2 b class ip blocks? as i dont want to add them all and open it upto all 3 1/4 million users they host.
pierre
how to install BFD can you write the command pls .
thank you
Nonel S. Pagdato
Hi, is there any BFD application for any flavor of microsoft server, hope to hear from you soon, thanks..
netcopan
should we add it into cron? After I restart server it will still be there??
Steel Rat
Also a line on how to have BFD startup automatically (unless it's tied to APF in that regard...
Alan
>Q: what if 1, you dont have static ips

don't get your password wrong

:)
Matrafox
>Q: what if 1, you dont have static ips

Then if u type rong password and u are banned, u just have to reboot your machine to take another Ip, and just try again :)
xaver
"There is an included 'install.sh' script that installs all files to
'/usr/local/bfd/' and places a 8-minute cronjob in '/etc/cron.d/bfd'. The setup
is really as simple as that."
Chris
Thanks works perfect.
robbert
many thnx! works perfect!!!!
Mike
It would help ppl if you actually gave some good examples of what configurations are preferable on a cPanel or other server, all you are doing here is stating the contents on the RFX site or in a README.
yenren
do we have to restart bdf manually everytime we restarted server?
grabt
How to stop BFD
sam
Its realy good!
Alexender
grabt:

to stop BFD , type

/usr/local/sbin/bfd -s


Luis
I actully managed to lock myself out of my server the other day after a few typing errors when trying to login... just went and turned my linksys router off, waited a few minutes and then reconnected... I had another IP and was able to enter again.
James Tervit
Installed BFD along with a few minor changes to my ports and it stopped failed authentications dead in its tracks..... very cool
Ramkriz
BFD is not working with the default rules. Please give me some rules for BFD.

Thanks.
Alan
does this bruteforce auto start with system reboot?
Jose
Q: Can i type in ignore hosts my dyndns host?

Ex. abcdefg.dyndns.org

Thanks for you teach
hello123
how to check whether BFD is started
Turkulerdiyari
I get this error :
could not locate $TLOGP, aborting.

How can i fix this problem.
sss
Really gud one
ePak
Q: Do I have to restart bfd everytime the server reboots?

A: No. BFD is not a daemon. There is a cron that runs every 10 minutes that sweets the logs for "attacks." So basically, every 10 minutes, it runs on its own. Location of cron: /etc/cron.d/bfd


Q: How do I disable BFD?

A: You can remove the cron from /etc/cron.d/bfd or you can use the uninstall script that came in the BFD tar.

I like the script, but my question is, how many lines does it take to cause an IP block?
Radu
Has anybody try to install on suse ? Or
alex
My bfd can't trace proftpd attack, why?
Can anyone help me?
Mar 18 22:23:47 ServerFTP proftpd[8035]: ServerFTP (82.191.154.xxx[82.191.154.xxx]) - USER anonymous: no such user found from 82.191.154.xxx [82.191.154.xxx] to 80.21.159.xxx:21
Riaan
Hi there

How can I change the rules so that bfd will block an IP after 2 attempt and what is the default attempts?
Tim
RE: Alexander

/usr/local/sbin/bfd -s

That does not STOP bfd, it runs it with standard output. BFD doesn't run as a service, but as cron job. So you'd have to remove the cron job as staed by ePak
Sabarish......
Hi Riaan,

BFD is configured to block after 10 attempts. See the TRIG value inside the files on /usr/local/bfd/rules

Let us know through mail, if u need any further assistance.
JT
After restarting BFD, I got the following:

/usr/local/sbin/bfd -s
BFD version 0.9
Copyright (C) 1999-2004, R-fx Networks
Copyright (C) 2004, Ryan MacDonald
This program may be freely redistributed under the terms of the GNU GPL

/usr/local/bfd/tlog: line 71: [: : integer expression expected
/usr/local/bfd/tlog: line 74: [: : integer expression expected

What is the tlog bit mean? Please help...

 Add Comment
Name
Email
Image Code
Refresh Image

Comments / Feedback



Our site offers free hosting tutorials, cpanel tutorial, web hosting news, shell commands, running a web hosting business, dedicated guides, linux tutorial, apache install, home web server, web server guide, ssh commands, dedicated servers, DNS nameservers, chkrootkit, apf firewall, exim configuration, server compromised, cron backup solution, ftp backup script

Server Tutorials


WebHostGear Reviewed by Ping Zine - Click here

Links:
Lunarpages Coupon