Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
OT(?): apache and rejecting files which are uploaded
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
scheuri
n00b
n00b


Joined: 21 Aug 2002
Posts: 22
Location: region basel, switzerland

PostPosted: Thu Sep 05, 2002 9:17 am    Post subject: OT(?): apache and rejecting files which are uploaded Reply with quote

hi all...
I am sorry if that is too much off topic...
but I need some help...

I have apache 1.3.19 up and running and users have possibilities to upload files...
is there a possibility within a apache-module to check file-extensions and reject them if I want? (such as rejecting exe's or bat's).

is something like that possbile with a module within 1.3.x?

thanks 1000time...

scheuri
_________________
if someone finds any grammar errors...easy...keep them...:wink:
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Thu Sep 05, 2002 6:53 pm    Post subject: apache and rejecting files Reply with quote

You'll probably want to upgrade to the latest apache 1.3.26. There are some security issues for running easlier versions.

As far a rejecting files do you not want to allow users to upload certain files to begin with or allow them to server these files after the fact?

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
scheuri
n00b
n00b


Joined: 21 Aug 2002
Posts: 22
Location: region basel, switzerland

PostPosted: Fri Sep 06, 2002 5:56 am    Post subject: Reply with quote

hi there...

well, I have a script that allows the upload (with http) to the server...
what I would like to do is...checking this files if they have certain extensions (such as exe, bat, and so on) and then reject them...

best is, if that happens before it begins uploading...but that doesnt matter actually...it is just important, that the server rejects it...

is there a apache-module-based solution for that?
I actually havent found any...so...maybe someone may enlighten me... :wink:

thanks
scheuri
_________________
if someone finds any grammar errors...easy...keep them...:wink:
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Fri Sep 06, 2002 6:09 am    Post subject: Reply with quote

I'm not sure, but I think the reason for kashani's question might be because there are two vastly different ways to do this, depending on whether you want to stop the upload or stop the uploaded thing being downloaded. To prevent the download, you could create a custom content handler that, for example, flashes "forbidden content type" in giant 72-point letters instead of actually serving the file.

To prevent the upload in the first place, it's really out of Apache's hands. You would need to modify the script that is handling the upload. What language is it written in? If it's Perl, and it uses CGI.pm, you can do something like this example from the CGI.pm man page:
Code:
$filename = $query->param('uploaded_file');
$type = $query->uploadInfo($filename)->{'Content-Type'};
unless ($type eq 'text/html') {
  die "HTML FILES ONLY!";
}

_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum