官术网_书友最值得收藏!

stunnel to the rescue

What stunnel is, basically is an application/utility that provides SSL/TLS-based tunnels. It allows us to specify what traffic we want to be tunneled over these SSL/TLS-based tunnels. This is the perfect solution for our needs. stunnel does involve setup on both sides to work, so let me show you how to configure both sides of the stunnel tunnel.

Setting up stunnel can be a little complicated the first time you go through it due to the mix of ports and IPs. You may need to diagram it out just to make sure that you have the correct port and IPs in the right location. Let me start with the C&C server, which will be our stunnel server. I am assuming stunnel is already installed, just not configured.

  1. First, I need to set up the certificates for the encryption between the client and server. We will use openssl to generate the certificates and then combine them into a single .PEM file:
  1. Next, we will make sure that we enable stunnel:
  1. Configuring the stunnel configuration file is probably the hardest task in this entire step. There is not a whole lot of configuration we need to put in there; however, what we do put in there is some minimal requirements.
  2. Within the configuration file, I need to make sure that stunnel knows this is the server and not the client. This is accomplished with the following parameter::
client = no
  1. I also need to let stunnel know where the certificate resides within the cert parameter:
 cert = /PATH/TO/CERT
  1. Telling stunnel what server and port to listen on is very important. This needs to be set using the Accept parameter. In my case, this will be port 443 and the IP address of the interface we plan to use:
Accept = 192.168.33.27:443
  1. Finally, the use of the Connect parameter will tell stunnel where to send the traffic:
Connect = 127.0.0.1:22

That is all the configuration that needs to be performed on the server side. Once the client side gets set up, we can test the whole process. Make sure that you restart the stunnel service on the C&C server to take the new settings:

service stunnel4 restart
If you are running a piece of firewall software on either the C&C server or the Raspberry Pi, you will need to make sure that you have the correct firewall holes open on the firewall for stunnel and the reverse SSH tunnel.
主站蜘蛛池模板: 揭阳市| 福泉市| 九江县| 诸城市| 舞钢市| 平湖市| 东乌珠穆沁旗| 从化市| 上饶县| 浦城县| 神池县| 白沙| 南溪县| 上蔡县| 陈巴尔虎旗| 绥江县| 嵊州市| 天水市| 台前县| 岐山县| 平潭县| 温宿县| 清丰县| 天津市| 射洪县| 陵川县| 无棣县| 望城县| 囊谦县| 任丘市| 宁海县| 九江县| 寻乌县| 思南县| 石家庄市| 麻城市| 南阳市| 调兵山市| 黄大仙区| 赣州市| 克拉玛依市|