Questions on site attack

Bonjour,
Every day, error.log is filled with such kind of messages:

2017-02-13 23:25:39 Error: [Cake\Routing\Exception\MissingRouteException] A "GET" route matching "/HTTP://www.baidu.com/" could not be found.
Request URL: /HTTP://www.baidu.com/
Client IP: 180.109.136.13
Stack Trace:
#0 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Router.php(351): Cake\Routing\RouteCollection->parse('/HTTP://www.bai...', 'GET')
#1 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Filter/RoutingFilter.php(57): Cake\Routing\Router::parse('/HTTP://www.bai...', 'GET')
#2 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/DispatcherFilter.php(144): Cake\Routing\Filter\RoutingFilter->beforeDispatch(Object(Cake\Event\Event))
#3 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventManager.php(426): Cake\Routing\DispatcherFilter->handle(Object(Cake\Event\Event), Object(Cake\Network\Request), Object(Cake\Network\Response))
#4 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#5 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#6 /var/www/monSite/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(80): Cake\Http\ActionDispatcher->dispatchEvent('Dispatcher.befo...', Array)
#7 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#8 /var/www/monSite/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#9 {main}


2017-02-13 23:33:11 Error: [Cake\Routing\Exception\MissingControllerException] Controller class .well-known could not be found.
Request URL: /.well-known/acme-challenge/q2Ty3CJaQUMgmxj0w3pdznyLTwanM59wZYXmXGETs98
Client IP: 213.186.33.62
Stack Trace:
#0 /var/www/monSite/vendor/cakephp/cakephp/src/Http/ControllerFactory.php(67): Cake\Http\ControllerFactory->missingController(Object(Cake\Network\Request))
#1 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(63): Cake\Http\ControllerFactory->create(Object(Cake\Network\Request), Object(Cake\Network\Response))
#2 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(49): Cake\Routing\Filter\ControllerFactoryFilter->_getController(Object(Cake\Network\Request), Object(Cake\Network\Response))
#3 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/DispatcherFilter.php(144): Cake\Routing\Filter\ControllerFactoryFilter->beforeDispatch(Object(Cake\Event\Event))
#4 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventManager.php(426): Cake\Routing\DispatcherFilter->handle(Object(Cake\Event\Event), Object(Cake\Network\Request), Object(Cake\Network\Response))
#5 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#6 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#7 /var/www/monSite/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(80): Cake\Http\ActionDispatcher->dispatchEvent('Dispatcher.befo...', Array)
#8 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#9 /var/www/monSite/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#10 {main}


2017-02-13 23:39:44 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Webdav could not be found.
Request URL: /webdav/
Client IP: 85.230.196.56
Stack Trace:
#0 /var/www/monSite/vendor/cakephp/cakephp/src/Http/ControllerFactory.php(72): Cake\Http\ControllerFactory->missingController(Object(Cake\Network\Request))
#1 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(63): Cake\Http\ControllerFactory->create(Object(Cake\Network\Request), Object(Cake\Network\Response))
#2 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(49): Cake\Routing\Filter\ControllerFactoryFilter->_getController(Object(Cake\Network\Request), Object(Cake\Network\Response))
#3 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/DispatcherFilter.php(144): Cake\Routing\Filter\ControllerFactoryFilter->beforeDispatch(Object(Cake\Event\Event))
#4 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventManager.php(426): Cake\Routing\DispatcherFilter->handle(Object(Cake\Event\Event), Object(Cake\Network\Request), Object(Cake\Network\Response))
#5 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#6 /var/www/monSite/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#7 /var/www/monSite/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(80): Cake\Http\ActionDispatcher->dispatchEvent('Dispatcher.befo...', Array)
#8 /var/www/monSite/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#9 /var/www/monSite/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#10 {main}

How to prevent it ? Is it possible to prevent accesses or just tell log to not record it ??

The best way is to do this by your server firewall.

IPs are not always the same.
fail2ban for example?

You can set skipLog key of Error in app.php if you dont want to log some type of errors

`'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']`
2 Likes