2

ghostunnel使用TLS加密TCP流量

 2 years ago
source link: https://zhangrr.github.io/posts/20211019-ghostunnel/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

很现实的问题,局域网内有态势感知和网络流量分析,这很讨厌!

那么,如何把某段流量隐藏起来,让态势感知无法分析呢?

前提条件,你需要有国外的一台 VPS 作为外援,把 TCP 流量通过 TLS 加密送到国外的服务器,然后再转发到正确的目标服务器上,这样就不会被人追踪了。

这里推荐 Ghostunnel ,这是个 Go 的程序,只有一个执行文件。配合 certik 证书生成,就完美了。

项目地址:https://github.com/ghostunnel/ghostunnel

首先我们使用 certik 生成三个证书,ca.pem server.pem 和 client1.pem

然后ghostunnel以及三个证书文件都放在/usr/local/bin下

一、在VPS上运行ghostunnel模式server

/usr/local/bin/ghostunnel server --listen 0.0.0.0:9999 --target tr.dero.herominers.com:1117 --keystore server.pem --cacert ca.pem --allow-cn client1 --unsafe-target
shell

上面监听了端口0.0.0.0:9999(监听0.0.0.0必须加参数–unsafe-target),远程转发到dero的矿池端口1117,只允许验证过的cn client1连接。

二、在本地机器上运行ghostunnel模式client

/usr/local/bin/ghostunnel client --listen localhost:9999 --target 193.42.114.129:9999 --keystore client.pem --cacert ca.pem 
shell

本地监听localhost:9999,所以不用加–unsafe-target参数,然后连接到远程 vps 服务器,ip地址是193.42.114.129,端口是9999

这样就完成了。可以放心的启动程序,连接到本地端口localhost:9999,TCP流量就会被隐藏起来,不会被分析到.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK