Total Pageviews

Thursday, 8 October 2015

利用基于GO的deblocus翻墙(我测试成功)

Introduction

deblocus is a tunneling software that allows secure TCP connection through the server by acting as a SOCKS5/HTTP proxy server on the client side.

Features

  • Traffic encrypted with dynamic session key
  • Tunnel's communication was provided with mildly obfuscated traffic based on special protocol
    • Keep communications secure and privacy over untrusted networks.
  • TCP multiplexing inside tunnel and Fast-Open over application layer
    • Optimized connectivity for massive short requests, latency greatly reduced to nearly 1-RTT.
  • Filtering traffic to specified country (using GeoLite2 data)
    • You can avoid the proxy was used for some inappropriate purposes.
  • High-performance encryption implementation
    • Could enjoy high throughput and low resource consumption.

Quickstart

Available on AMD64 of Windows, Linux and OS X.
  1. Download executables or compile it from source.
(首先按此文http://briteming.blogspot.com/2013/05/linuxgo.html,搭建go环境。之前需安装git和gcc:
apt-get install -y git gcc
cd /root/go/
go get github.com/Lafeng/deblocus
这样即可装好deblocus.Require go 1.5 or above, and 64-bit OS is strongly recommended.)

  1. Read Wiki to learn more.

Acknowledgements

Thanks to these projects: qtunnel, osext, dhkx, glog, siphash and chacha-opt.
This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.

deblocus

介绍

安全高效的局部代理(Socks5/HTTP)工具,可满足在企业网络/公共WiFi等场景下安全通信的需要。

使用

首先阅读 Wiki,从项目Releases下载程序,或自行编译。
FROM  https://github.com/Lafeng/deblocus/


1, 服务端配置与运行

Clone this wiki locally

用户配置

任意位置新建用户配置文件(user.conf),格式为USER:PASSWORD,一行一个用户
user1:passwd1
user2:passwd2

Server配置文件

$ deblocus csc -o deblocus.d5s 即可生成一份配置模版文件:deblocus.d5s
请妥善保管,可根据下面的解释修改参数。
配置参数 是否必须 说明 示例
Auth 必须 用户密码记录文件路径 file://user.conf
file:///etc/deblocus/user.conf
file://d:/user.conf
Cipher 必须 加密方法 AES128CFB
AES192CFB
AES256CFB
CHACHA12
CHACHA20
DenyDest 可选 拒绝代理对指定国家的网络的访问
填2位国家代码或OFF(不过滤)
OFF US CN HK ...
Listen 必须 监听地址和端口
(无地址则为所有地址监听)
:9008
127.0.0.1:9008
ServerName 必须 服务器名称 myserver
Verbose 可选 日志冗余级别 1-5

发布用户凭证

首先用户要存在于 Auth 的定义中(即user.conf文件)。
$ deblocus ccc ServerAddress:Port User
即为用户user发布了配置文件,请交付给用户。
# -----------------------------
# deblocus client configuration
# -----------------------------

Listen      :9009
Verbose     1

# client credential
-----BEGIN deblocus/CLIENT-CREDENTIAL-----
...
-----END deblocus/CLIENT-CREDENTIAL-----

运行

$ deblocus -serv -v=1 (注意:要加上参数-serv -v=1,否则只运行deblocus,会遇到错误)
  • 若配置文件不在典型位置(当前目录、用户home、/etc/deblocus/)下,则需要--config=<PATH>指定其位置
  • Linux/Mac/Unix: 可以通过 screen/tmux/nohup 等保持运行,或通过 upstart/systemd 脚本以 service 运行

     FROM https://github.com/Lafeng/deblocus/wiki/1,-%E6%9C%8D%E5%8A%A1%E7%AB%AF%E9%85%8D%E7%BD%AE%E4%B8%8E%E8%BF%90%E8%A1%8C

    2, 客户端配置与运行

    Clone this wiki locally

    客户端配置文件

    请首先从服务端提供者获取自己的用户凭证。
    在 deblocus 程序同级目录下编辑 deblocus.d5c 配置文件,内容类似于:
    # -----------------------------
    # deblocus client configuration
    # -----------------------------
    
    Listen      :9009
    Verbose     1
    
    # client credential
    -----BEGIN deblocus/CLIENT-CREDENTIAL-----
    ...
    -----END deblocus/CLIENT-CREDENTIAL-----
    
    配置中的Listen地址即为本地的socks5和http代理服务地址;若应用同时支持,应优先使用socks5方式。
    浏览器中可使用Proxy SwitchyOmega类似插件来提供便捷的选路策略切换。

    运行

    运行deblocus
    • Windows下,建议使用图形界面工具deblocusMonitor,能方便的管理其运行.
    • 若配置文件不在典型位置(当前目录、用户home、/etc/deblocus/)下,则需要--config=<PATH>指定其位置。
    • 更多参数请使用-h参数查看.

      FROM https://github.com/Lafeng/deblocus/wiki/2,-%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%85%8D%E7%BD%AE%E4%B8%8E%E8%BF%90%E8%A1%8C

      64位操作系统下的客户端程序的下载地址:https://dl.soez.xyz/deblocus/ 

    • Binary downloads
    • sha1sumfile
      92fd65e9ac7ea17c9bd9c5837ed889c05cc03f1cdeblocus-0.11.2810b-linux-x64.tar.xz
      20c871866fb79ae82d95a0cb23dcc8424a6327abdeblocus-0.11.2810b-osx-x64.tar.xz
      ec578c015a8f1804022e07e033ec4db9b0bb84f7deblocus-0.11.2810b-windows-x64.7z
    from https://github.com/Lafeng/deblocus/releases

    NOTE:如果你在mac或linux desktop os中,用go get命令安装deblocus,遇到“$GOPATH not set”的错误,请参考此文http://briteming.blogspot.jp/2015/10/macgo.html解决错误。
    =====================================
    部署deblocus简明教程

    deblocus也是一种类似于SS的加密隧道工具,项目地址:https://github.com/Lafeng/deblocus/tree/dev

    部署方法如下:

    VPS端:
    wget http://dl.soez.xyz/deblocus/deblocus-0.11.2770b-linux-x64.tar.xz
    tar Jxvf deblocus-0.11.2770b-linux-x64.tar.xz

    创建用户配置文件:user.conf:
    nano user.conf
    填入:

    username1:password1    //这个请自行定义
    
    创建server端的配置文件- deblocus.d5s
    deblocus csc -o deblocus.d5s 
    
    nano deblocus.d5s
    deblocus.d5s的内容样式如下:
    
    配置参数是否必须说明示例
    Auth必须用户密码记录文件路径file://user.conf
    file:///etc/deblocus/user.conf
    file://d:/user.conf
    Cipher必须加密方法AES128CFB
    AES192CFB
    AES256CFB
    CHACHA12
    CHACHA20
    DenyDest可选拒绝代理对指定国家的网络的访问
    填2位国家代码或OFF(不过滤)
    OFF US CN HK ...
    Listen必须监听地址和端口
    (无地址则为所有地址监听)
    :9008
    127.0.0.1:9008
    ServerName必须服务器名称myserver
    Verbose可选日志冗余级别1-5
    我的配置实例如下:
    
    Cipher               AES256CFB
    Auth                file://./user.conf
    Listen             :9008
    ServerName         myserver
    Verbose            1
    
    生成用户凭据:
    
    deblocus ccc VPS_IP:9008 Username1   //服务器的端口可以自定义,我这里只是举例为9008
    
    用户凭据格式如下:
    # -----------------------------
    # deblocus client configuration
    # -----------------------------
    
    Listen      :9009
    Verbose     1
    
    # client credential
    -----BEGIN deblocus/CLIENT-CREDENTIAL-----
    D5P: d5://username1:password1@VPS IP:9008#AES256CFB
    Provider: SERVER_NAME
    
    MIGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    JzXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    +qXXXXXXXXXXXXXXX
    -----END deblocus/CLIENT-CREDENTIAL-----
    
    复制这段用户凭据内容,保存到你的客户机为文件deblocus.d5c
    
    至此服务端配置完毕,然后运行:nohup deblocus -serv -v=1 &   
    注意:配置文件deblocus.d5s和deblocus这个可执行文件必须位于同一目录下。
    服务端搞定。
    
    客户端: 
    下载: https://dl.soez.xyz/deblocusMonitor/deblocusMonitor.7z   //deblocus在windows下的GUI图形客户端工具
    
    http://dl.soez.xyz/deblocus/deblocus-0.11.2810b-windows-x64.7z  //deblocus在windows下的客户端执行文件
    
    下载解压以后,单独建立一个deblocus目录。在此目录下编辑 deblocus.d5c 配置文件,同时把服务端产生的用户凭据填进去样式如下:
    
    # -----------------------------
    # deblocus client configuration
    # -----------------------------
    
    Listen      :9009
    Verbose     1
    # 把服务端产生的用户凭据填进去
    -----BEGIN deblocus/CLIENT-CREDENTIAL-----
    D5P: d5://username1:password1@VPS IP:9008#AES256CFB
    Provider: SERVER_NAME
    
    MIGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    JzXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    +qXXXXXXXXXXXXXXX
    -----END deblocus/CLIENT-CREDENTIAL-----
    然后运行deblocusMonitor(选中 deblocus.d5c文件,然后start),运行成功会有这样的提示:



    设置浏览器的Socks5代理为 127.0.0.1:9009,即可翻墙。
    linux桌面系统下,则运行:

    deblocus