LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-04-2007, 07:38 PM   #1
RVR777
LQ Newbie
 
Registered: Aug 2005
Posts: 19

Rep: Reputation: 0
Question Securing Apache


Hi,

I have a server where some people upload old or bad coded scripts, that allow an external attacker to run arbitrary commands as the apache user (www-data), that use all the cpu, memory and network.

What can I do to prevent this to happen?

Thanks
 
Old 03-04-2007, 07:52 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Well, you need to do one of two things.. either educate the users you allow on your server to not upload horrible scripts and or kick their connection if they continue to use such scripts. If it's your server, it's your rules, not theirs.
 
Old 03-05-2007, 10:39 AM   #3
RVR777
LQ Newbie
 
Registered: Aug 2005
Posts: 19

Original Poster
Rep: Reputation: 0
But there is nothing I can do to prevent this to happen? If it was a big hosting, there is no way to trace every user script...

Maybe something could be modified or configured, to prevent this things?
 
Old 03-05-2007, 10:44 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by RVR777
Maybe something could be modified or configured, to prevent this things?
Their script.. like I said, you can't just secure the apache server itself if it's the scripts they are using. You can disallow cgi scripts from within apache, that'd be one way to secure your machine but it will break everyone's scripts, which sounds to me like a good idea if their scripts are allowing remote execution or arbitrary commands as the apache user.. either educate, disable accounts or deal with users uploading and using crap code.. it's your choice, you're the sysadmin.
 
Old 03-06-2007, 02:57 AM   #5
Rainer Hubovsky
LQ Newbie
 
Registered: Feb 2007
Posts: 14

Rep: Reputation: 0
In a shared hosting environment I would recommend the use of suexec:

"The suEXEC feature provides Apache users the ability to run CGI and SSI programs under user IDs different from the user ID of the calling web-server"
-> http://httpd.apache.org/docs/2.0/suexec.html

If you offer PHP, have a look at suphp:
"suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter."
-> http://www.suphp.org/Home.html

Further, you can 'jail' your apache-server and put it under a chroot-jail.
a) "The objective of makejail is to help an administrator creating and updating a chroot jail with short configuration files."
-> http://www.floc.net/makejail

b) "mod_chroot makes running Apache in a secure chroot environment easy. You don't need to create a special directory hierarchy containing /dev, /lib, /etc."
-> http://core.segfault.pl/~hobbit/mod_chroot/

lg.
Rainer
 
  


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
Securing Apache 2.2.3 Tralce Linux - Security 2 12-04-2006 07:17 AM
Securing Apache on FD2 yournightmare Fedora 0 07-14-2005 05:09 PM
Securing Apache on FD2 yournightmare Red Hat 1 07-11-2005 04:29 PM
Questions about securing Apache Lleb_KCir Linux - Security 6 04-07-2004 09:41 AM
Securing Apache v2 markus1982 Linux - General 0 01-14-2003 08:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:05 PM.

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