Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-21-2011, 06:07 AM   PM User | #1
JamesOxford
New Coder

 
Join Date: Jan 2010
Location: Birmingham, MI
Posts: 98
Thanks: 3
Thanked 9 Times in 9 Posts
JamesOxford is an unknown quantity at this point
WGET and the OPTIONS Indexes directive

So I just discovered wget, and how powerful this tool potentially is. I would like to know how to safegaurd against it if it is at all possible. I am not really sure how it works; I just figured it out, and I am able to recursively download from a couple of my domains. I havn't tested it on my PHP code, just images, so I don't know how the server will actually send the PHP. As PHP code, or as HTML code that the PHP script outputs. If it is by HTTP protocol, I think it will just send the HTML markup but I am not sure.

Will denying Indexes with the Options directive safeguard against wget or do I have to do some more advanced configuration? Help here is appreciated.
JamesOxford is offline   Reply With Quote
Old 08-21-2011, 09:43 PM   PM User | #2
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by JamesOxford View Post
Will denying Indexes with the Options directive safeguard against wget or do I have to do some more advanced configuration? Help here is appreciated.
In general, unless you have an explicit need to list the files, you should disable indexing. Spiders can still crawl your pages to retrieve the images/files you use on them(wget can do this), but they can't get a list of everything in your folders and follow it recursively, if you disable the indexes. They also can't see the source of your PHP files because they are parsed by the server when they are requested. An exception would be if you named something .phps or an extension that is not handled by Apache(like .phpbak for example).

To disable indexes for your site put this in an .htaccess in the document root:
Code:
Options -Indexes
Inigoesdr is offline   Reply With Quote
Old 08-22-2011, 04:41 AM   PM User | #3
JamesOxford
New Coder

 
Join Date: Jan 2010
Location: Birmingham, MI
Posts: 98
Thanks: 3
Thanked 9 Times in 9 Posts
JamesOxford is an unknown quantity at this point
Again, thanks for your help. If I disable indexes in an .htacess file in the root directory, would I be able to override it in a sub-directory or no? There are a couple of places where indexes are convenient.

In directories where I did want to index, would denying spiders in a robot.txt file, and setting a valid-user requirement with basic authentication be sufficient to to stop recursive downloads of the entire folder?
JamesOxford is offline   Reply With Quote
Old 08-22-2011, 03:07 PM   PM User | #4
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by JamesOxford View Post
If I disable indexes in an .htacess file in the root directory, would I be able to override it in a sub-directory or no?
Yep.
Quote:
Originally Posted by JamesOxford View Post
In directories where I did want to index, would denying spiders in a robot.txt file, and setting a valid-user requirement with basic authentication be sufficient to to stop recursive downloads of the entire folder?
No, not really. robots.txt is more of a suggestion and only well-behaved spiders will follow it. You may just end up making it easier for people to find the directories you don't want indexed... so they can index them. That is, if you are worried about bad robots to begin with.
Inigoesdr is offline   Reply With Quote
Old 08-22-2011, 07:24 PM   PM User | #5
JamesOxford
New Coder

 
Join Date: Jan 2010
Location: Birmingham, MI
Posts: 98
Thanks: 3
Thanked 9 Times in 9 Posts
JamesOxford is an unknown quantity at this point
At this point it is more of a hypothetical, than a true concern. The basic authentication won't stop them? Won't they get a 404 redirect instead of a 200 OK if they tried to access the directory without authenticating?
JamesOxford is offline   Reply With Quote
Old 08-22-2011, 08:01 PM   PM User | #6
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by JamesOxford View Post
The basic authentication won't stop them? Won't they get a 404 redirect instead of a 200 OK if they tried to access the directory without authenticating?
Whoops, I didn't see that you were adding authentication. That should be sufficient to block recursive indexing. They will get a 403 if they can't authenticate.
Inigoesdr is offline   Reply With Quote
Users who have thanked Inigoesdr for this post:
JamesOxford (08-22-2011)
Old 08-22-2011, 09:07 PM   PM User | #7
JamesOxford
New Coder

 
Join Date: Jan 2010
Location: Birmingham, MI
Posts: 98
Thanks: 3
Thanked 9 Times in 9 Posts
JamesOxford is an unknown quantity at this point
Quote:
404 redirect instead of a 200 OK if they tried to access the directory without authenticating?
I meant 403 .

Thanks again for all your help.

BTW, how do I add the user I am quoting when I wrap text in {QUOTE}?
JamesOxford is offline   Reply With Quote
Old 08-23-2011, 04:54 AM   PM User | #8
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by JamesOxford View Post
BTW, how do I add the user I am quoting when I wrap text in {QUOTE}?
The easiest way is to hit the quote button at the bottom of the post, but you can use this format too:
[QUOTE=JamesOxford]some text[/QUOTE]
Inigoesdr is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 06:23 PM.


Advertisement
Log in to turn off these ads.