Monday, August 8, 2016

Stunnel a Proxy to ship the log on SSL

Few days ago I got a task to create the SSL connection with logstash redis plug-in with Azure Redis. As we are shipping the logs form the several data center to the Azure Redis. So logs must be shipped on SSL connection. There is no provision to create SSL connection through logstash redis plug-in thats why logstash redis plug-in is not able to make SSL connection with Azure redis.

To resolve this problem we have to setup the stunnel as proxy front of the logstash redis plug-in. Stunnel can create SSL connection with Azure redis and Stunnel provide non-ssl connection for the logstash redis plug-in. Azure redis provide two type of connections, SSL on 6380 port and non SSL on 6379 port and also provide primary and secondary key(password).

Install Stunnel on the ubuntu.

Create a configuration for stunnel /etc/stunnel/stunnel.conf and put the following lines into the configure file.

Restart the stunnel4

Install redis-cli to test the connection try to ping the redis azure it should reply as PONG

Now you can make SSL connection with azure redis on SSL.
[null, {"document_url": "http://blog.opstree.com/2016/08/stunnel-proxy-to-ship-log-on-ssl.html", "unformatted_src": "https://4.bp.blogspot.com/-QfUWKsR2ns4/V6XNMK4wG_I/AAAAAAAABEk/XJO4U32lm-w1gHHgZoln2V5944UmZzcPACEw/s400/stunnel%2B-%2BNew%2BPage%2B%25281%2529.jpeg", "src": "https://4.bp.blogspot.com/-QfUWKsR2ns4/V6XNMK4wG_I/AAAAAAAABEk/XJO4U32lm-w1gHHgZoln2V5944UmZzcPACEw/s400/stunnel%2B-%2BNew%2BPage%2B%25281%2529.jpeg", "formatted_filename": "stunnel B BNew BPage B", "rendered_width": 400, "rendered_height": 245}, null, null, null, null, null, {"document_url": "http://blog.opstree.com/2016/08/stunnel-proxy-to-ship-log-on-ssl.html", "unformatted_src": "https://4.bp.blogspot.com/-7nUc59CvBNo/W6TTXZ56iwI/AAAAAAAACwc/XO0GH4DNyxQg3U77-WPw0SgrAIOy58rrQCLcBGAs/s400/Blank%2BDiagram%2B%25281%2529.png", "src": "https://4.bp.blogspot.com/-7nUc59CvBNo/W6TTXZ56iwI/AAAAAAAACwc/XO0GH4DNyxQg3U77-WPw0SgrAIOy58rrQCLcBGAs/s400/Blank%2BDiagram%2B%25281%2529.png", "formatted_filename": "Blank BDiagram B"}]