LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-23-2007, 04:49 AM   #1
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Rep: Reputation: 15
Best way to ban blocks of IPs?


My website is USA based and offers a local service. My apache logs are filled with attacks from Korea, Germany, Russia, ... The fewer automated attacks i see in my logs, the happier i am.

What is the best way to ban blocks of IP addresses - meaning what option has the best performance. I do not want to bring my server down to a crawl.

Ways I have found (please suggest others too)
* iptables
* mod_security 1.9
* mod_access

I am planning on using the blocks obtained from
http://www.ipdeny.com/ipblocks/

Last edited by hank43; 02-23-2007 at 04:51 AM.
 
Old 02-23-2007, 05:28 AM   #2
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Be careful blocking whole groups of IPs.

If you want to, you can use an Ipatables rule like this:
Code:
iptables -A INPUT -s 192.168.1.0/24 --destination-port 80 -j DROP
This will drop all connections on port 80 from any IP address starting 192.168.0

I hope this helps
--Ian
 
Old 02-23-2007, 06:55 AM   #3
otheus
LQ Newbie
 
Registered: Jun 2006
Location: Austria
Distribution: RHEL AS 4
Posts: 26

Rep: Reputation: 16
dynamic iptables

It sounds like you want to block IP addresses based on perceived attacks.

There are several packages that will automatically maintain iptables for you, based on attack patterns. "snort" might be the most prominent freely available package that does this (www.snort.org). Another package, "ipcop" is a package that includes snort, and wraps everything in a GUI to ease the whole thing for the end-user.

I use the iptables save/restore mechanisms because I'm an old gheezer. But I am considering snort to help detect attacks and add short-term rules to thwart them.
 
Old 02-23-2007, 02:27 PM   #4
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Original Poster
Rep: Reputation: 15
i'd like a smart way to do it because a banlist with 20K lines of ip masks is

ipcop is a firewall distro, i only have 1 box so i can't use it.

snort looks nice but i did not see anything that interfaces with iptables (at least a few months ago). there was something to change snort rules to modsec rules, not sure how production ready it is.
 
Old 02-23-2007, 02:36 PM   #5
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
iptables will have better performance than the other methods you mentioned
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables, ban IP, how? cylarz Linux - Security 3 04-22-2006 01:09 PM
How to ban question: Anyone know how? Lazy Linux - Security 16 04-12-2006 01:20 AM
how to define a specific range of IPs and/or multiple IPs in an iptables rule?... TheHellsMaster Linux - Security 9 09-20-2004 10:06 AM
Earthlink blocks mail from dynamic IPs... Erik Thorsson Linux - Networking 6 09-14-2004 01:02 AM
vsftpd ban IP dsgdevil Linux - Software 5 06-01-2004 11:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration