Monday, July 7, 2014

Nginx dynamic reverse proxy

About four years ago, i was knew Nginx when try to fight with slowloris attack on my Apache server. Since that day I was fell in love with Nginx and it never cease to amaze me about what it can do. I now i decice to collect about some part of my use case and solution with Nginx to share.

Our team have one line of internet and one public IP which have to handle many kind of web application behind it some of web application very simple and doesn't care about virtual domain, URL rewirte, authentication resource optimization. So it really need a front web-server who fill the gap  and make the manage process more easy and secured. That where Nginx coming and give me a greate favour. Here is what Nginx currently do in my server:

  • Forward request base on domain and url to the right web application behind 
  • Support https, SPDY to make web application faster and more secure.
  • Caching and optimizing the response of web application's static resource.
  • Authentication and authorization base on domain and URL.
  • Rewrite the URL and add more information to request to help the web application understand more about user. 
  • Limited request rate and bandwidth, deny request base on IP and country to protect web application from abuse by bad visitor.
The Case 1:
We have a IP range in our local network which reserve for 4 virtual machine which run our demo product and can be managed directly by developer when they need to show case to our customer. 

Problem is every time they want allow outside access to their demo product i have to add new record to Nginx or router to forward the request to demo server and now i go tired with that task. I want nginx to extract the forward destination by reading the domain information and forward request to that. For example, when user request http://acceptance01.8080.example.net/index.php nginx will forward lookup local DNS for computer name acceptance01 and forward to that computer on port 8080 with file index.php. If request failed some how Nginx will handle the bad situation by display a nice error message.

... to be continue...

Thursday, February 27, 2014

Access free network with tiny DNS packet

Wondering when you're on the airport or Internet cafe with non-free wireless provider, they always redirect you to a page and force you to sign-up and buy their package for wireless access. WOW so disappointed!!!

Luckily on some network like that they are still allow DNS service to have some free to run. So I decide to search some solution about transfer data over tiny over DNS query.

Let Google with "DNS tunneling" and I  choiced the most common solution depend on the limited of the network provider.
  • First is using OpenVPN and configurate it listen on DNS service (UDP port 53) and connect VPN over that. The problem is some secured ISP force us to use their DNS system - they redirect all packet that connect to DNS service to thier server instead of allow it pass the Internet gateway - however this method provide more robust solution for all OS and device ( Ubuntu, Android, Windows ... ) and better performance.
  • The second solution is iodine, a portable-small-tiny and easy to configure DNS tunnel server. However Idoine speed quite limited, but in case of emergency it will help. I found myself that iodine more easy for me than OpenVPN and it can pass almost filter of ISP than OpenVPN tooooo. If you need tunnel for Android device use the Magic tunnel - the folk of Idoin.
Reference
OpenVPN: Big Long howto
      Iodine: Quick install guide , Magic tunnel