LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-04-2004, 09:45 PM   #1
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
Questions about securing Apache


have a few questions about securing an apache server.

1. is it ok to leave the /var/www/html dir set to 755? is there a way to reduce the permissions and still have the URL run?

2. do i really need to worry about the internal firewall on my MDK10 box when i am behind a NAT router with rather robust firewall/NAT secuirties?

3. is there a way to make it so any directory involving apache, to include /var/www/html, are only accessable via my LAN or via VPN?

3b. if so how would i go about doing that?


please keep in mind im no ubb3r *nix user. im still basicaly a newB, but i do understand M$ extreemly well. if you give me CLI or bash instructions please be as specific and detailed as you can. treat me like you would a 6yr in your directions with reguards to step by step.

i am learning my way around more and more every day by the great help from ppl on this site and it is extreemly appriciated.

thank you for your time and help.
 
Old 04-05-2004, 06:47 AM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
The 755 on the folder is ok, there should not be anything in there you don't want people to see in the first place, it's a web server for goodness sakes.

Just kidding.


You can probably make the html files and pictures in there 440 and owner.group root.apache or whatever user it runs on.

It really depends on what all you have in there, and how the server is setup. Make a backup of the entire tree before changing things.



One firewall is good enough for me.

You can setup httpd.conf to only have the document root and no other Directory access.

If your not forwarding port 80 then they can't get there anyway. Or you can firewall port 80 from the outside and allow local access only, but like I said there is no way to get there from the outside without the router forwarding the port anyway. VPN that is forwarded to the webserver or another system on the lan would be the same as being on the webserver or lan so it would be granted access.



Last edited by DavidPhillips; 04-05-2004 at 06:56 AM.
 
Old 04-05-2004, 09:47 AM   #3
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
Quote:
You can probably make the html files and pictures in there 440 and owner.group root.apache or whatever user it runs on.

It really depends on what all you have in there, and how the server is setup. Make a backup of the entire tree before changing things.
ok great thanks.

now how do i go about setting the root.apache or owner.group is that chown?

just using root atm. only have 2 accounts on my MDK system root and me.

only things running on that site are basic HTML, some MPEGs, and some JPGs along with a handful of pdf files that over time i hope to replace with html fo the most part.
 
Old 04-05-2004, 02:52 PM   #4
InEeDhElPlInUx
Member
 
Registered: Sep 2003
Posts: 107

Rep: Reputation: 15
In your httpd.conf file there is a spot for owner and group. Create another user and give him NO privileges in your system except for the sole purpose of running your website (part of this is in the .conf file which I mentioned above). Also change the www folder and all subdirectories and make him the owner and group. Give him read only access to everything except for the logs which he needs write permission to. You can also give him write permission on your www directory but they if someone hacks you with the webowner's account he can hack your website also. Just change to root if you need to add anything and change the permissions on the file as soon as it's moved.
 
Old 04-05-2004, 03:18 PM   #5
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
Quote:
Originally posted by InEeDhElPlInUx
In your httpd.conf file there is a spot for owner and group. Create another user and give him NO privileges in your system except for the sole purpose of running your website (part of this is in the .conf file which I mentioned above). Also change the www folder and all subdirectories and make him the owner and group. Give him read only access to everything except for the logs which he needs write permission to. You can also give him write permission on your www directory but they if someone hacks you with the webowner's account he can hack your website also. Just change to root if you need to add anything and change the permissions on the file as soon as it's moved.
thank you, now could you step by step that for me.

i think i know how to make a new user in *nix, but am not 100% on how to assign overall persmisions to an account.

no matter who the owner is of a dir or file the root always can make changes yes and override the owner?
 
Old 04-07-2004, 12:01 AM   #6
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
Here is my user apache in /etc/passwd

apache:x:48:48:Apache:/var/www:/sbin/nologin

Here is the group in /etc/group

apache:x:48:
 
Old 04-07-2004, 09:41 AM   #7
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
thanks. ill mess around with that after i recover from MDK10 update killing my system. had to blow it away and now having to recover all my code for my URL.

after the update my apache died, my system no longer acknowledge that i have a CDRW in it so i had no way of backing up the current code of my site. have the old code on CD so im in the proccess of recovering the code, cleaning it up, then updating it so it will run like it is supposed to.

thanks for the heads up.
 
  


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 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
securing apache - problem m1ke_81412 Linux - Software 3 04-21-2005 08:37 AM
securing apache & PHP markus1982 Linux - Security 2 01-18-2003 02:16 PM
Securing Apache v2 markus1982 Linux - General 0 01-14-2003 08:03 AM

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

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