Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

limiting access to images/banning direct access

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  Problems with apache 2.2 rewrite rules  
Author Message
Boris Epstein

External


Since: Jan 18, 2008
Posts: 2



(Msg. 1) Posted: Fri Jan 18, 2008 10:39 am
Post subject: limiting access to images/banning direct access
Archived from groups: alt>apache>configuration (more info?)

Hello everyone!

I have a PHP-based application (MediaWiki) installed on a Linux box
(CentOS 5, Apache 2.2.3, PHP 5.1.6). This application is password
protected; however, even without logging in one can view our images
and documents by simply typing in the full URL to it.

So here is my question: is there a way to ban Apache from displaying
files that the user has not been redirected to following a legitimate
login?

Thanks in advance.

Boris.

 >> Stay informed about: limiting access to images/banning direct access 
Back to top
Login to vote
Boris Epstein

External


Since: Jan 18, 2008
Posts: 2



(Msg. 2) Posted: Fri Jan 18, 2008 11:47 am
Post subject: Re: limiting access to images/banning direct access [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 18, 2:06 pm, Kees Nuyt <k.n....TakeThisOut@nospam.demon.nl> wrote:
> On Fri, 18 Jan 2008 10:39:39 -0800 (PST), Boris Epstein
>
> <borepst....TakeThisOut@gmail.com> wrote:
> >Hello everyone!
>
> >I have a PHP-based application (MediaWiki) installed on a Linux box
> >(CentOS 5, Apache 2.2.3, PHP 5.1.6). This application is password
> >protected; however, even without logging in one can view our images
> >and documents by simply typing in the full URL to it.
>
> Which means it is not password protected.

Well, it is partially protected - the Wiki pages you can not see
without logging in first. However, if you just type in something like:
http://the_site/images/h/h8/sample_file.pdf

you can read the PDF.

>
> >So here is my question: is there a way to ban Apache from displaying
> >files that the user has not been redirected to following a legitimate
> >login?
>
> Two possibilities:
> 1- use wiki software with better protection
>
> 2- redirect to a PHP script which only sends the requested
> document or image if the session belongs to a logged in
> user, and redirect to the login page if it doesn't, or if
> there is no session at all.
> Details can be found in the PHP docs and with a search on
> Google.

Neither will work - if you type in the full URL to the image/PDF file
you bypass both the Wiki and the PHP engine.

>
> >Thanks in advance.
>
> >Boris.
>
> HTH
> --
> ( Kees
> )
> c[_] The greatest of faults is to be conscious of none.
> (Thomas Carlyle) (#304)

 >> Stay informed about: limiting access to images/banning direct access 
Back to top
Login to vote
Kees Nuyt

External


Since: Oct 25, 2006
Posts: 78



(Msg. 3) Posted: Fri Jan 18, 2008 5:05 pm
Post subject: Re: limiting access to images/banning direct access [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 18 Jan 2008 10:39:39 -0800 (PST), Boris Epstein
<borepstein.DeleteThis@gmail.com> wrote:

>Hello everyone!
>
>I have a PHP-based application (MediaWiki) installed on a Linux box
>(CentOS 5, Apache 2.2.3, PHP 5.1.6). This application is password
>protected; however, even without logging in one can view our images
>and documents by simply typing in the full URL to it.

Which means it is not password protected.

>So here is my question: is there a way to ban Apache from displaying
>files that the user has not been redirected to following a legitimate
>login?

Two possibilities:
1- use wiki software with better protection

2- redirect to a PHP script which only sends the requested
document or image if the session belongs to a logged in
user, and redirect to the login page if it doesn't, or if
there is no session at all.
Details can be found in the PHP docs and with a search on
Google.

>Thanks in advance.
>
>Boris.

HTH
--
( Kees
)
c[_] The greatest of faults is to be conscious of none.
(Thomas Carlyle) (#304)
 >> Stay informed about: limiting access to images/banning direct access 
Back to top
Login to vote
Kees Nuyt

External


Since: Oct 25, 2006
Posts: 78



(Msg. 4) Posted: Fri Jan 18, 2008 5:05 pm
Post subject: Re: limiting access to images/banning direct access [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 18 Jan 2008 11:47:15 -0800 (PST), Boris Epstein
<borepstein DeleteThis @gmail.com> wrote:

>On Jan 18, 2:06 pm, Kees Nuyt <k.n... DeleteThis @nospam.demon.nl> wrote:
>> On Fri, 18 Jan 2008 10:39:39 -0800 (PST), Boris Epstein
>>
>> <borepst... DeleteThis @gmail.com> wrote:
>> >Hello everyone!
>>
>> >I have a PHP-based application (MediaWiki) installed on a Linux box
>> >(CentOS 5, Apache 2.2.3, PHP 5.1.6). This application is password
>> >protected; however, even without logging in one can view our images
>> >and documents by simply typing in the full URL to it.
>>
>> Which means it is not password protected.
>
>Well, it is partially protected - the Wiki pages you can not see
>without logging in first. However, if you just type in something like:
>http://the_site/images/h/h8/sample_file.pdf

That's what I mean: it's not protected.

>you can read the PDF.
>
>>
>> >So here is my question: is there a way to ban Apache from displaying
>> >files that the user has not been redirected to following a legitimate
>> >login?
>>
>> Two possibilities:
>> 1- use wiki software with better protection
>>
>> 2- redirect to a PHP script which only sends the requested
>> document or image if the session belongs to a logged in
>> user, and redirect to the login page if it doesn't, or if
>> there is no session at all.
>> Details can be found in the PHP docs and with a search on
>> Google.
>
>Neither will work - if you type in the full URL to the image/PDF file
>you bypass both the Wiki and the PHP engine.

Not if you rewrite all URLs that point to the protected
files to that particular PHP script. I'm sorry I
mistakenly wrote redirect where I meant rewrite.

Additional measures:
In some situations you can afford to move the protected
files outside the DocumentRoot, but in a content
management system like a wiki that might be hard to do,
because the functions to upload contents would fail.
So I didn't mention that one.


>> >Thanks in advance.
>>
>> >Boris.

Good luck!
--
( Kees
)
c[_] Prune: A plum that has seen better days. (#416)
 >> Stay informed about: limiting access to images/banning direct access 
Back to top
Login to vote
D. Stussy

External


Since: Nov 01, 2007
Posts: 25



(Msg. 5) Posted: Sat Jan 19, 2008 10:18 am
Post subject: Re: limiting access to images/banning direct access [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Boris Epstein" <borepstein DeleteThis @gmail.com> wrote in message
news:1ce81d8d-9e2e-41e3-8a0a-923536f58a67@k39g2000hsf.googlegroups.com...
> So here is my question: is there a way to ban Apache from displaying
> files that the user has not been redirected to following a legitimate
> login?

Although it can be forged, you could check the HTTP_REFERER field to see if
the hostname it contains is your (virtual) host. If it's not, you should
probably serve a different resource in its place. This step should probably
be used in combination with other methods suggested.
 >> Stay informed about: limiting access to images/banning direct access 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Direct Access - Can anyone help me out and tell me why when I type in the URL for a certain file on my webserver, e.g. www.domain.com/folder/image1.jpg my front page is still displayed regardless? What am I doing wrong? :-| Thanks Ste -- [email: remove the SPAMTRAP]

deny direct access to a single folder with .htaccess - Hello, I have not found a clear way of doing what I want and resort to posting my question. I have a php file that will link to pdf files from a directory called pdf (within the apache htdocs folder). The way I have it coded now, the address to the pdf....

Help banning a range of IP's - I need to ban a range of IP addresses from a website entirely and have been told I can do this with a .htaccess file. I'm not very knowledgable about this subject - can someone walk me through what to put in the file - say I wanted to ban..

Banning a domain or IP range - Hi, How do I ban a domain or IP range from accessing my server in apache? Thanks

Access log? - Sorry if this is the wrong group, but it appears the most appropriate. I've noticed a couple of entries in my access log that look like this: 61.144.100.66 - - [31/Jul/2003:13:51:43 -0700] "GET http://www.alltheweb.com/ HTTP/1.1" 200 294 61...
   Web Hosting Problem Solving Community! (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

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



[ Contact us | Terms of Service/Privacy Policy ]