Install fail2ban - Ubuntu Guide

There are 2 replies in this Thread which was already clicked 2,391 times. The last Post () by mrgmx.

  • Fail2ban
    Introduction


    Fail2Ban is an intrusion prevention framework written in the Python programming language. It works by reading SSH, ProFTP, Apache logs etc.. and uses iptables profiles to block brute-force attempts.


    Installation


    To install fail2ban, type the following in the terminal:

    Quote

    sudo apt-get install fail2ban


    Configuration


    To configure fail2ban, make a 'local' copy the jail.conf file in /etc/fail2ban

    Quote

    cd /etc/fail2ban
    sudo cp jail.conf jail.local


    Now edit the file:

    Quote

    sudo nano jail.local


    Set the IPs you want fail2ban to ignore, the ban time (in seconds) and maximum number of user attempts to your liking:


    Note: You will need sendmail or any other MTA to do this.
    If you wish to be notified of bans by email, modify this line with your email address:

    Quote

    destemail = your_email@domain.com


    Then find the line:

    Quote

    action = %(action_)s


    and change it to

    Quote

    action = %(action_mw)s


    Jail Configuration
    Jails are the rules which fail2ban apply to a given application/log:


    To enable the other profiles, such as [ssh-ddos], make sure the first line beneath it reads:

    Quote

    enabled = true


    Once done, restart fail2ban to put those settings into effect

    Quote

    sudo /etc/init.d/fail2ban restart


    Advanced: Filters
    If you wish to tweak or add log filters, you can find them in

    Quote

    /etc/fail2ban/filter.d


    Testing
    To test fail2ban, look at iptable rules:

    Quote

    iptables -L


    Attempt to login to a service that fail2ban is monitoring (preferably from another machine) and look at the iptable rules again to see if that IP source gets added.




    Remarks : To test fail2ban on Ubuntu 12.04 server edition a reboot is required. Restarting or reloading the service didn't work.
    Credit to : ubuntu help community
    Regards


    Shata

  • Yes Bud!


    This was done for Ubuntu - Install fail2ban - Ubuntu Guide


    Its all Linux so this process should be the same for all/most Linux OS (Debian, Ubuntu, e.t.c)



    lssdalogo.png



    "Don't Gain The World & Lose Your Soul, Wisdom Is Better Than Silver Or Gold"
    “Herb is the healing of a nation, alcohol is the destruction”



  • master G

    Added the Label Article

Your resource for Linux TV servers and smart card readers.

Find software downloads, drivers, and support for server setup and card-sharing configurations. Set up a Linux-based TV server. Access downloads and support for server software and USB card readers for advanced TV reception and management

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!