What is the best way to reject a request coming from malicious scripts? I have a Zend application with modules. I have a list of URL's that the scanners are dialing, such as mywebsite.com/phpmyadmin, /webmail, /cpanel, etc. Right now, they are getting 404's, clogging up my error log. I'd like to 403 them from within the application. (Unless there is a better way to handle that)?
What is the fastest way to 403 within Zend, so it doesn't churn through the dispatch cycle unnecessarily? I am doing below in a plugin but I am not sure this is the best way:
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if (malicious request) {
$this->getResponse()
->clearHeaders()
->setHttpResponseCode(403)
->appendBody("Forbidden")
->sendResponse();
}
}
Thanks for any suggestions!