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 04-22-2006, 12:09 AM   #1
cylarz
Member
 
Registered: Aug 2005
Location: California
Distribution: CentOS 5
Posts: 54

Rep: Reputation: 15
apache access question


Hey all,

I'm exploring ways to improve system security. You may have seen my other posts regarding PostFix, and this posting is indirectly related to those. I wanted to start a new thread, however, just to avoid pissing anyone off by changing subjects mid-stream.

This time I'm asking about Apache HTTPD webserver. I'm running Apache 2.2 on a Fedora Core 5 system (Red Hat).

I have a list of IP addresses that have recently tried to relay junk mail, break in through the SSH daemon, or otherwise attempted to violate the system. I want to ban the entire lot of them from ever getting near it since they obviously cannot be trusted. I realize it is a reactive strategy, but it is the best I can manage at the moment.

One measure I took was to implement TCP wrappers, which seems to work well at protecting the SSH port. However, it doesn't cover HTTP, nor would I really want it to. SSH's rule is "deny all those not specifically granted", while with HTTP, I want to do just the reverse - "allow all NOT specifically singled out as banned."

Sorry for the wordy intro, but I wanted to get some background information out there before getting to my actual question. Here it is: What is the best way to stop IP address XXX.XXX.XXX.XXX or network 123.456.789.XXX from reaching the HTTP server?

I looked on the Apache website for suggestions, and it seems the best it had to offer (near as I can tell) to use the Order directive in conjuction with allow/deny. As a test, I tried banning my own IP address within /etc/httpd/conf/httpd.conf (my client computer that I'm actually sitting in front of, not the server's IP). That caused the server, when I use IE to pull up its webpage, to show me the "default" page that is shipped with FC5, instead of the website I've built for it. When I removed my IP address from httpd.conf, my HTTP request was resolved normally and I got the actual server webpage I'd built. It means anyone trying to access the HTTP server from a banned IP address would presumably get the same thing - the default FC5 webpage instead of the server's website.

Well, that is *ok*, but what I really want is for the server to simply say "Access denied" or something similar, when a banned IP tries to pull up the server's webpage. Better still, I'd like it to say the computer equivalent of, "HTTP? Who the hell is that?" After all, you cannot attack what you cannot see. The point of course is to thwart attempts to break into the system via HTTP port 80. According to the system logs, port 80 has already been "probed" once. (What does that mean, anyway? Probed with what - a rectal thermometer?)

So, Linux gurus, how do I make this happen? Help me give Apache the tools it needs, to give crackers the middle finger.

Thanks, Matt
 
Old 04-22-2006, 01:58 AM   #2
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Stop them at the firewall. Tell iptables to drop the connection on port 80. I personally use MonMotha's firewall script which has a place to ban "bad ip's" and then implement it. To the abuser it appears the system doesn't exist. Bear in mind that many of these blackhats are using proxy servers and they may well re-appear using another address.
 
Old 04-22-2006, 02:19 AM   #3
cylarz
Member
 
Registered: Aug 2005
Location: California
Distribution: CentOS 5
Posts: 54

Original Poster
Rep: Reputation: 15
How do I tell iptables to deny a particular IP address? Is there a specific utility to run (either GUI or command-line) or a configuration file I can edit?
 
Old 04-22-2006, 02:21 AM   #4
cylarz
Member
 
Registered: Aug 2005
Location: California
Distribution: CentOS 5
Posts: 54

Original Poster
Rep: Reputation: 15
Or alternatively, where do I obtain this "MonMotha's script?"
 
Old 04-25-2006, 11:03 AM   #5
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
You must be using some type of firewall at present. There should be a way of configuring the rules so that ip ranges are excluded. I am no iptables expert and perhaps you would be better advised to open a new thread in the Security section of LQ dealing with how to setup the rules in your current firewall configuration.
If you are interested in the MonMotha script then I have a copy and details on using it for NAT/Firewalling on my site. The write-up is Debian based and cannot be used in a RH environment because the rc file system is different.

Last edited by TigerOC; 04-25-2006 at 11:04 AM.
 
  


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
Problem With Apache Access Comatose51 Linux - General 1 05-27-2005 03:08 PM
Limit access with Apache lothario Linux - Security 1 01-24-2005 12:53 AM
Apache access logs lawadm1 Linux - Software 4 08-06-2004 10:20 AM
apache access log question verbal Linux - Software 3 07-28-2004 11:15 PM
Apache ip access pazvant Linux - General 4 02-01-2004 10:57 AM

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

All times are GMT -5. The time now is 01:57 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