What a night? Github being teased by a DDOS attack originating from an analytic script by Baidu which is probably in MITM attack by some unknown source. And slack just revel that one of their database server faces an unauthroized access where they store our user profile informations and hashed passwords. I have been using iptable rules to filter some restricted resources over a rails instance lately and came to think if I share the trick here on my blog.
Mostly you may be using a proxy server, like nginx and apache, over your application instance which is backed by php-fpm or passenger processes depending on your application stack. What I am going to do is set some suitable iptable rules which would standardize the incoming and outgoing TCP requests as mentioned below.
Most of the distro comes with IPTABLE preinstalled. But if it is not,
Create a new file under etc with root.
And fill the file with these contents.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
Then load it and see if they are set.
Lets make this reuseable since this would be gone after the system reboot.
Create a init file under netwark with the following content. Simply open the file with the command and paste the content under it.
1 2 3 4
And make it executable.
If you don’t believe what is happening [ not recommended ].