celluloid / reel

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid::IO-powered web server
https://celluloid.io
MIT License
596 stars 87 forks source link

scanning and error #238

Open andrius opened 7 years ago

andrius commented 7 years ago

Hello,

My server listen on 0.0.0.0 for public requests. It's in demo mode and does not protected by any firewall. Network scanners sometimes try to send some flood and I am getting errors like this:

[2016-12-10 19:45:48.489] INFO  Celluloid: Listening on http://0.0.0.0:8080
route_request(request): #<Reel::Request POST http://t19.proxy-checks.com/favicon.ico HTTP/1.1 @headers={"Host"=>"t19.proxy-checks.com", "Proxy-Connection"=>"Keep-Alive", "Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "User-Agent"=>"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)", "Accept-Language"=>"en-US;q=0.6,en;q=0.4", "Content-Length"=>"0", "Pragma"=>"no-cache"}>
95.25.97.222 - - [10/Dec/2016:19:45:50 +0800] "POST /favicon.ico " 404 - 0.0009
route_request(request): #<Reel::Request GET / HTTP/1.0 @headers={"User-Agent"=>"masscan/1.0 (https://github.com/robertdavidgraham/masscan)", "Accept"=>"*/*"}>
212.92.127.143 - - [10/Dec/2016:19:55:29 +0800] "GET / " 404 - 0.0020
route_request(request): #<Reel::Request CONNECT mx-tw.mail.gm0.yahoodns.net:25 HTTP/1.0 @headers={}>
[2016-12-10 20:10:05.663] ERROR Celluloid: Actor crashed!
NoMethodError: undefined method `[]' for nil:NilClass
        /usr/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/mock.rb:90:in `env_for'
        /usr/lib/ruby/gems/2.3.0/gems/reel-rack-0.2.3/lib/reel/rack/server.rb:47:in `route_request'
        /usr/lib/ruby/gems/2.3.0/gems/reel-rack-0.2.3/lib/reel/rack/server.rb:29:in `block in on_connection'

It happening in line 46 at /usr/lib/ruby/gems/2.3.0/gems/reel-rack-0.2.3/lib/reel/rack/server.rb

And I have added puts command before that print out request, it is:

route_request(request): #<Reel::Request GET / HTTP/1.0 @headers={"User-Agent"=>"masscan/1.0 (https://github.com/robertdavidgraham/masscan)", "Accept"=>"*/*"}>

Question: is that normal? If so, how could I fix those error logs? I understand that I can firewall system, but in production mode it would have public access. I do have authentication already, there is grape API behind – but that won't help against scanning