0

I want to execute a script when a PUT request is received from my Apache server.

For example - I want scan the uploaded file using clamAV antivirus when client uploads a file.

How can this be done?

2 Answers 2

1

modsecurity can do that, ClamAV example is given in official documentation.

modsecurity is de-facto standard and is actively supported by community and TrustWave inc security experts with spiderlabs, it's like main part for OWASP project for years. Provided as both hardware appliance and software products, widely used in financial institutions, banks, processing centers. You can try mod_clamav, but would you trust software maintained by one guy with last update in 2009 and version 0.xx? :)

2
  • Thanks for replay GioMac, I don't wont use modsecurity if any other source Aug 29, 2013 at 9:49
  • GioMAc i already configured mod_clamav on our server but it working when you access file from browser then this module start scaning the file if any virus found it display on your browser means mod_clamav support download file. Please if you know how to configured mod_clamav when user are uploading file on that movement clamav scan the file if he found virus it display on browser. Thanks again for reply me.. Aug 29, 2013 at 10:15
1

With mod_actions (which usually comes as standard in most distributions) you can map http methods to script handlers:

Script PUT yourhandler.xx

The data arrives on STDIN - there's a chapter in PHP manual demonstrating how to implement this.

(or you can use mod_rewrite to change the method to whatever, and the URL to your handler - once again reading data from stdin)

5
  • Thanks for reply symcbean .. I read your articular i can't understand. I try same thing on my local server but it's not work. I create on perl script which was create one txt file and i configured in Apache Script PUT put.pl when i access this file from browser file created in web root but "Script PUT perl.pl" httpd.conf i try upload file to my upload.php php that time file not created. If you know how to configured in httpd.conf please send me configuration. mod_actions moudule are already installed. Please help me.. Aug 29, 2013 at 10:41
  • can you know any script which can pick upload file path for testing using PUT method and configuration of httpd.conf Aug 29, 2013 at 10:55
  • Hi Symcbean , as per your STDIN artical i configure on local server. <Directory /home/rupesh/public_html> Script PUT /put.php </Directory> also create put.php in web root but apache not excute script. Please guide if any mistake in my configuration. mod_actions already install Aug 29, 2013 at 11:38
  • Did you restart the server? Have you checked your logs?
    – symcbean
    Aug 29, 2013 at 11:51
  • Hi Symcbean, please reply me ... how can know my script was execute by Apache Aug 29, 2013 at 11:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .