kaplanlior / midburn-queue

midburn.org tickets queue system
https://midburn.org
MIT License
2 stars 5 forks source link

Access Log logs the LoadBalancer's IP and not the requester's IP #25

Open eladg opened 8 years ago

eladg commented 8 years ago

In order to verify no one sneaks in to the queue, we added an "Access Log" print for every request.

There were many unsuccessful attempts to sneak in to the queue on the application level (for example, performing POST /register with the wrong params/tokens) but those were not logged correctly.

Heroku's LB/Router Log:

291 <158>1 2016-04-30T16:41:46.861667+00:00 heroku router - - at=info method=POST path="/register" host=midburn-queue.herokuapp.com request_id=3ddb129b-3701-45a9-8739-320830ec960b fwd="12.34.56.78" dyno=web.3 connect=0ms service=1ms status=400 bytes=341

Application Log:

180 <190>1 2016-04-30T16:41:46.861652+00:00 app web.3 - - [access log] POST /register from 10.126.32.121: {"username"=>"--redacted--@--redacted--.com"}

This request is from someone who tried to guess the register's email param (i.e. the incorrect 'username' field) but on the application level log we have: "10.126.32.121" the internal private ip instead of the load balancer ip: "12.34.56.78" (example for an external IP).

Although it's possible to manually back-trance and pair the router logs and application logs, based on the internal IPs, it's very difficult on a 10 servers scale and 2x1000 log prints a second.