Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Firewall Setups

  1. #1
    Join Date
    May 2009
    Location
    Wollongong, Australia
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Firewall Setups

    Hey everyone

    I have a webserver I want to set up a firewall on. At this stage, it seems like I'll end up going with ufw, but lets have a bit of an explanation first...

    The end goal is to have SSH and HTTPS only accessible from predefined IP addresses which should be simple enough for any firewall. However there is a trickier goal I'd like

    I want to be able to have something that actively monitors the apache2 logs and if it sees a certain number of 404's from a given source ip, to add a rule to the firewall blocking that IP for all ports. I hear fail2ban might be suitable, but I don't know much about it, ie how active it is among other things.

    The method of detection doesn't have to be monitoring logs, that just seems like a basic way of doing it.

    Suggestions?

    Cheers

    Ramo
    Computer Security for Noobs!!

    http://www.security4noobs.com/

  2. #2
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,744

    Re: Firewall Setups

    Quote Originally Posted by goodvikings View Post
    Hey everyone

    I have a webserver I want to set up a firewall on. At this stage, it seems like I'll end up going with ufw, but lets have a bit of an explanation first...

    The end goal is to have SSH and HTTPS only accessible from predefined IP addresses which should be simple enough for any firewall. However there is a trickier goal I'd like

    I want to be able to have something that actively monitors the apache2 logs and if it sees a certain number of 404's from a given source ip, to add a rule to the firewall blocking that IP for all ports. I hear fail2ban might be suitable, but I don't know much about it, ie how active it is among other things.

    The method of detection doesn't have to be monitoring logs, that just seems like a basic way of doing it.

    Suggestions?

    Cheers

    Ramo
    Well UFW/GUFW, Firestarter etc etc are not firewalls themselves, they are merely Interfaces to interact with the Linux Built in Firewall which is in the kernel called IPTables/Netfilter.

    I would look at IPTables directly from the command line if i was you it is much more powerful.

    Also remember if you are behind a router then there will be a firewall function on that
    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  3. #3
    Join Date
    May 2009
    Location
    Wollongong, Australia
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Firewall Setups

    Hmmm ok thanks, thats very useful to know.

    So i guess the question then becomes "Whats a good way to actively monitor apache, and what will work well with that to add firewall rules the best?"

    I only looked very quickly at ufw, and it seems that its very easy to add rules with it.
    Computer Security for Noobs!!

    http://www.security4noobs.com/

  4. #4
    Join Date
    Feb 2010
    Location
    Obscurial Springs
    Beans
    15,210
    Distro
    Ubuntu Budgie Development Release

    Re: Firewall Setups

    If you choose to go with an interface , Firestarter is an old program and though it is in the repository I would avoid it .
    "Our intention creates our reality. "

    Ubuntu Documentation Search: Popular Pages
    Ubuntu: Security Basics
    Ubuntu: Flavors

  5. #5
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,744

    Re: Firewall Setups

    Quote Originally Posted by goodvikings View Post
    Hmmm ok thanks, thats very useful to know.

    So i guess the question then becomes "Whats a good way to actively monitor apache, and what will work well with that to add firewall rules the best?"

    I only looked very quickly at ufw, and it seems that its very easy to add rules with it.
    you might wanna take a look at apachetop for apache monitoring or just the old fashioned way in the apache logs themselves.
    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  6. #6
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,744

    Re: Firewall Setups

    Quote Originally Posted by Frogs Hair View Post
    If you choose to go with an interface , Firestarter is an old program and though it is in the repository I would avoid it .
    +1 yeah avoid that at all costs.

    CLI for IPTables is much more powerful though not as user friendly as the GUI's
    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  7. #7
    Join Date
    May 2009
    Location
    Wollongong, Australia
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Firewall Setups

    Meh its a server anyway, so GUI is out of the question.

    I'll give apachetop a look. Is it able to detect something like several 404's from one IP and run a script / command when it does? If thats the case then we can forget about fail2ban
    Computer Security for Noobs!!

    http://www.security4noobs.com/

  8. #8
    Join Date
    Feb 2007
    Beans
    169
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Firewall Setups

    First part should be doable with ufw, but the bit about monitoring the log and automatically updating the iptables rules would require writing iptables rules directly.

    It were me, I would write a perl script to parse the error log, and spit out a rule revision in my iptables file for any ip with too many 404's. Run the script via cron with enough permission to write iptables rules

    iptables -A INPUT -s 64.90.32.6 -j DROP (something like this)

    Rules can be added on the fly if I remember correctly -A adds the new rule to the end of the list.

    But I'm a bit rusty. One thing, you can lock yourself out of a remote computer playing with iptables so it's good to learn on a local text box.

  9. #9
    Join Date
    May 2009
    Location
    Wollongong, Australia
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Firewall Setups

    Yeah i did think of that but I want it to be much more active. You know, without telling cron to run that job every 5 seconds or so...
    Computer Security for Noobs!!

    http://www.security4noobs.com/

  10. #10
    Join Date
    Feb 2007
    Beans
    169
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Firewall Setups

    How about an Apache module? No idea how to do that, but it would be part of the apache process, maybe good enough for other folks to use.

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •