Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Aug 22, 2011 11:17 am 
Offline
Senior Member

Joined: Wed May 13, 2009 1:32 pm
Posts: 737
Location: Italy
Hi...

I would like to protect a file from download, I would permit the download only to people who have correct username and password.

Do you think that the .htaccess way is quite secure?


Top
   
 Post subject:
PostPosted: Mon Aug 22, 2011 2:09 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
.htaccess works fine, until one day you make a typo in the relevant config file and Apache begins to ignore it, or you give another web server a try without remembering that lighty and nginx don't support .htaccess files.

It's much safer to keep your stuff outside of the document root altogether. PHP scripts and other server-side programs would have no problem serving it.


Top
   
 Post subject:
PostPosted: Tue Aug 30, 2011 2:13 am 
Offline
Senior Member

Joined: Thu Oct 02, 2008 8:56 am
Posts: 99
I concur.

Most of my static content is actually kept outside the web root and served by a php wrapper.

It's not just a possible mistake in configuration, it is possible vulnerabilities in Apache or a module you have loaded that may allow an unauthorized user to grab the content.

A classic example is the HFS+ file system Apache bug when OS X first shipped. HFS+ is case preserving but not case sensitive, so people could get around .htaccess limitations by changing the case of the request. Apache would see a request for /reStricted/file.ext and not apply the .htaccess rules that restricted the directory /restricted/ because Apache didn't know they were seen as the same directory on HFS+ systems.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group