Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-22-2006, 12:09 AM
|
#1
|
Member
Registered: Aug 2005
Location: California
Distribution: CentOS 5
Posts: 54
Rep:
|
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
|
|
|
04-22-2006, 01:58 AM
|
#2
|
Senior Member
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380
Rep:
|
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.
|
|
|
04-22-2006, 02:19 AM
|
#3
|
Member
Registered: Aug 2005
Location: California
Distribution: CentOS 5
Posts: 54
Original Poster
Rep:
|
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?
|
|
|
04-22-2006, 02:21 AM
|
#4
|
Member
Registered: Aug 2005
Location: California
Distribution: CentOS 5
Posts: 54
Original Poster
Rep:
|
Or alternatively, where do I obtain this "MonMotha's script?"
|
|
|
04-25-2006, 11:03 AM
|
#5
|
Senior Member
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 03:16 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|