How to install BFD (Brute Force Detection) Published: Jan 21, 2004
  • Rating

    5/5

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

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.

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="[email protected]"

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

  • Rating

    5/5

Related Articles

Comments (36)

  • Gravatar - Olly
    Olly 15:26, January 21, 2004
    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?
  • Gravatar - Mike
    Mike 02:14, January 23, 2004
    "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.
  • Gravatar - matlex
    matlex 04:49, January 27, 2004
    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
  • Gravatar - bman
    bman 19:37, February 14, 2004
    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.
  • Gravatar - Alex
    Alex 15:03, March 16, 2004
    could not locate $FWFILE is because you didnt installed APF before
  • Gravatar - Ryan
    Ryan 23:48, July 20, 2004
    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.
  • Gravatar - pierre
    pierre 19:17, August 19, 2004
    how to install BFD can you write the command pls .<br />
    thank you
  • Gravatar - Nonel S. Pagdato
    Nonel S. Pagdato 09:12, October 4, 2004
    Hi, is there any BFD application for any flavor of microsoft server, hope to hear from you soon, thanks..
  • Gravatar - netcopan
    netcopan 16:58, December 19, 2004
    should we add it into cron? After I restart server it will still be there??
  • Gravatar - Steel Rat
    Steel Rat 22:05, January 12, 2005
    Also a line on how to have BFD startup automatically (unless it's tied to APF in that regard...
  • Gravatar - Alan
    Alan 22:39, January 21, 2005
    >Q: what if 1, you dont have static ips<br />
    <br />
    don't get your password wrong <br />
    <br />
    :)
  • Gravatar - Matrafox
    Matrafox 09:18, March 23, 2005
    >Q: what if 1, you dont have static ips<br />
    <br />
    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 :)
  • Gravatar - xaver
    xaver 02:38, April 2, 2005
    "There is an included 'install.sh' script that installs all files to<br />
    '/usr/local/bfd/' and places a 8-minute cronjob in '/etc/cron.d/bfd'. The setup<br />
    is really as simple as that."
  • Gravatar - Chris
    Chris 00:03, July 22, 2005
    Thanks works perfect.
  • Gravatar - robbert
    robbert 16:00, August 8, 2005
    many thnx! works perfect!!!!
  • Gravatar - Mike
    Mike 00:37, September 6, 2005
    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.
  • Gravatar - yenren
    yenren 13:05, September 11, 2005
    do we have to restart bdf manually everytime we restarted server?
  • Gravatar - grabt
    grabt 10:58, October 22, 2005
    How to stop BFD
  • Gravatar - sam
    sam 11:44, January 18, 2006
    Its realy good!
  • Gravatar - Alexender
    Alexender 08:21, March 5, 2006
    grabt:<br />
    <br />
    to stop BFD , type<br />
    <br />
    /usr/local/sbin/bfd -s <br />
    <br />
    <br />
  • Gravatar - Luis
    Luis 02:49, March 15, 2006
    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.
  • Gravatar - James Tervit
    James Tervit 19:07, April 17, 2006
    Installed BFD along with a few minor changes to my ports and it stopped failed authentications dead in its tracks..... very cool
  • Gravatar - Ramkriz
    Ramkriz 20:21, July 31, 2006
    BFD is not working with the default rules. Please give me some rules for BFD.<br />
    <br />
    Thanks.
  • Gravatar - Alan
    Alan 10:55, August 17, 2006
    does this bruteforce auto start with system reboot?
  • Gravatar - Jose
    Jose 06:52, September 14, 2006
    Q: Can i type in ignore hosts my dyndns host?<br />
    <br />
    Ex. abcdefg.dyndns.org<br />
    <br />
    Thanks for you teach
  • Gravatar - hello123
    hello123 05:51, October 25, 2006
    how to check whether BFD is started
  • Gravatar - Turkulerdiyari
    Turkulerdiyari 22:08, November 17, 2006
    I get this error :<br />
    could not locate $TLOGP, aborting.<br />
    <br />
    How can i fix this problem.
  • Gravatar - sss
    sss 11:51, January 16, 2007
    Really gud one
  • Gravatar - ePak
    ePak 22:09, February 1, 2007
    Q: Do I have to restart bfd everytime the server reboots?<br />
    <br />
    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<br />
    <br />
    <br />
    Q: How do I disable BFD?<br />
    <br />
    A: You can remove the cron from /etc/cron.d/bfd or you can use the uninstall script that came in the BFD tar.<br />
    <br />
    I like the script, but my question is, how many lines does it take to cause an IP block?
  • Gravatar - Radu
    Radu 15:55, February 23, 2007
    Has anybody try to install on suse ? Or
  • Gravatar - alex
    alex 22:39, March 18, 2007
    My bfd can't trace proftpd attack, why?<br />
    Can anyone help me?<br />
    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
  • Gravatar - Riaan
    Riaan 21:52, September 24, 2007
    Hi there<br />
    <br />
    How can I change the rules so that bfd will block an IP after 2 attempt and what is the default attempts?
  • Gravatar - Tim
    Tim 14:10, October 13, 2007
    RE: Alexander<br />
    <br />
    /usr/local/sbin/bfd -s<br />
    <br />
    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
  • Gravatar - Sabarish......
    Sabarish...... 21:44, January 20, 2008
    Hi Riaan,<br />
    <br />
    BFD is configured to block after 10 attempts. See the TRIG value inside the files on /usr/local/bfd/rules<br />
    <br />
    Let us know through mail, if u need any further assistance.
  • Gravatar - JT
    JT 18:29, September 26, 2008
    After restarting BFD, I got the following:<br />
    <br />
    /usr/local/sbin/bfd -s<br />
    BFD version 0.9 <[email protected]><br />
    Copyright (C) 1999-2004, R-fx Networks <[email protected]><br />
    Copyright (C) 2004, Ryan MacDonald <[email protected]><br />
    This program may be freely redistributed under the terms of the GNU GPL<br />
    <br />
    /usr/local/bfd/tlog: line 71: [: : integer expression expected<br />
    /usr/local/bfd/tlog: line 74: [: : integer expression expected<br />
    <br />
    What is the tlog bit mean? Please help...
  • Gravatar - dt
    dt 06:51, August 6, 2009
    I installed afp. ran it. see it in the log. then install bfd. ran it numerous times. nothing happens other than printing the copyright message, no matter what params I enter. i try failed logins from my other servers over and over and nothing happens. huge messages logfiles, doesn't seem to even try to scan trhem. bfd log file is completely empty. what is wrong? tried this on 2 servers, both didnt work

Add Your Thoughts

WebHostGear.com is a hosting directory, not a web host.

Copyright © 1998-2024 WebHostGear.com