Shadowsocks with obfuscation

Update: (07.28.2017)

naive了。。。密码学根本不是想当然。

这几天在看Coursera上面的Cryptography I,很多看似无懈可击的加密方法,都一一被破得很惨。。

引用一下:

And primarily you're supposed to use these standard cryptographic primitives, and not invent things, these primitives, yourself. The standards have all gone through, many years of review by hundreds of people, and that's not something that's going to happen to an ad hoc design. And, as I said, over the years there are many examples of ad hoc designs that were immediately broken as soon as they were analyzed.

学无止尽。。。。造轮子需谨慎

原因

据说,北邮的朋友已经开发出了嗅探shadowsocks流量特征的方法,不管是不是骗经费的广告,墙确实是越来越高。

传统的shadowsocks流量可能存在不同于通常网络流量的特征,大部分VPN也是这么被GFW或者ISP封掉的。

伪装

既然单纯的加密已经不能糊弄GFW了,那就伪装成正常的加密流量,比如:通过SSL加密的HTTPS流量。

其实,openVPN的加密已经很接近HTTPS了,把端口设成443,能够躲过GFW的封锁。但随着墙的升级,这招也没用了。于是有了obfsproxy, ssl tunnel等方法,二次加密VPN流量,把它伪装成正常访问HTTPS网站的流量。

Ref: how to hide openvpn traffic and obfsproxy: next step censorship arms race

所以,这个流程图就变成了:

client <--[encrypted]--> tunnel <--[obfuscated traffic]--> tunnel <--[encrypted]--> server <--[request]--> target

超麻烦是不是!并没有提升安全性(存疑,我拍脑袋说的),只是隐藏了自己的特征。。

如果之前漏出来的明年二月让ISP封VPN流量的消息属实(虽然某部门出来避谣,但似乎只是侧面重申了已经颁布的规则),感觉届时可以测试一回。 与GFW斗志斗勇其乐无穷, 我相信他们肯定能找出封堵的方案呢。。。

我们热爱的shadowsocks由于配置简单,吸引了大量用户(并且可以IPv6代理啊WWWWW)。最初的它只是为了骗过GFW做的流量混淆,而不是加密通讯。但是树大招风,于是有了篇头的“据说”。(还有了冒出来的SSR争吵事件,我就不评论了)。

原始的开发者,喝茶之后,这个项目贡献者越来越多呢。。冒出来的“竞争对手”也是不断尝试寻找它的弱点。于是,还在用旧版shadowsocks的同学,记得更新。。。具体的内容,我也不懂就是了,看这位博主写得很详细的样子。

这里介绍shadowsocks组织提供的混淆方案:simple-obfs,它的思路跟之前的openVPN伪装类似,在原本的shadowsocks流量之上叠加一层加密,使得GFW无法判断它是否正常的网站流量。跟web server结合,用在80或者443端口,我觉得无懈可击。。。(肯定还是会被发现漏洞就是啦)

有条件的朋友可以试试水,作为非常时期的备用线路。

操作

N.B. it only works if you are using shadowsocks-libev flavour on both server and client (please prove me wrong).

Installation

ref: simple-obfs

Dependencies:

  • gcc
  • autoconf
  • libtool
  • automake
  • make
  • asciidoc
  • xmlto
  • zlib (and its development files, e.g. zlib-devel in centOS)
  • openssl (and its development files)
  • libev (and its development files)
  • udns (and its development files)

Installation steps:

git clone https://github.com/shadowsocks/simple-obfs.git  
cd simple-obfs  
git submodule update --init --recursive  
./autogen.sh
./configure # and check if any error exists
make  
sudo make install  

Running as a plugin

server side add these two lines in your config.json

  "plugin": "obfs-server",
  "plugin_opts": "obfs=http",

start your server with ss-server -c <path-to-your-config>.

client side add these two lines (and replace the fake url you want to request) in your config.json

  "plugin": "obfs-local",
  "plugin_opts": "obfs=http;obfs-host=www.amazon.com",

start your client with ss-local -c <path-to-your-config>.

with web server add the options to your server's configuration file. Set shadowsocks server port to 443(tls mode) or 80(http-mode).

  "plugin_opts": "obfs=tls;failover=<your-domain-or-IP>:<port-that-web-server-listens-to>",

总结

这是一场不公平的战斗。

第一个不公平是,围堵网民的“不安全”上网行为,跟提供“安全”上网方式,难度相差悬殊。

第二个不公平是,开放源代码的正义一方,跟闭源的邪恶势力黑盒子搞事,可以算是毫无保留了。