GSA-TTS / cg-logshipper

Sample code for draining Cloud Foundry logs to S3 and New Relic using FluentBit
Other
6 stars 2 forks source link

Restrict access to the cloud.gov egress ranges (and localhost) #13

Closed akf closed 7 months ago

akf commented 9 months ago

This is pretty standard nginx config, but it's also obtuse (I think) and I'm happy to provide my understanding if desired. I went with the geo approach because allow and deny directives weren't working and I didn't see why.

You should get a 400 status (bad request) for GETs, and a 403 (forbidden) if you make a POST request from outside of the allowed IP ranges. Missing or incorrect basic auth gets you a 401. So:

From a shell on the app: curl -i http://127.0.0.1:8080 -> 400 Bad Request curl -iX POST http://127.0.0.1:8080 -> 401 Authorization Required curl -iX POST http://[your-username]:[your-password]@127.0.0.1:8080 -> 201 Created

From outside: curl -i https://[your-logshipper-route].cloud.gov -> 403 Forbidden curl -iX POST https://[your-logshipper-route].cloud.gov -> 403 Forbidden *