database - Free server side anti virus / security / trojan protection for file uploads? -
i allowing users upload photos photo albums, , attach files (documents now) mail attachments. assume need anti virus/security tool in place scan files first in case people upload infected stuff. 2 questions: 1) there 'free' or open source tools can use or integrate environment: codeignitor php? 2) how secure upload area rest of system? virus scanner fails catch virus , uploaded, how prevent infecting other files? can upload area sandboxed in or , use filepath users access content not spread other parts of system?
there clamav free virus scanner. install , like:
function virus_detected($filename) { $clamscan = "/usr/local/bin/clamscan"; $result = exec("$clamscan -i --no-summary $filename"); return strlen($result)?true:false; }
as security, make sure temporary files uploaded directory outside of web root. should verify file type, rename file other it's original file name , append appropriate extension (gif,jpg,bmp,png). believe should keep safe aside exploits in php itself.
for more information verifying file types in php check out: http://www.php.net/manual/en/function.finfo-file.php
Comments
Post a Comment