其他 · 2019年2月19日 0

shadowsocks-libev+simple-obfs+kcptun

简介

shadowsocks:梯子;
simple-obfs:混淆加密;
kcptun:梯子提速。

shadowsocks docker版本

2022年2月15日更新,看了docker这一部分剩下的不需要在看了。

mritd/shadowsocks镜像中已经内置了obfskcptun等插件,只需要配置即可。

基础用法

docker pull mritd/shadowsocks
docker run -dt --name ssserver -p 9503:9503 mritd/shadowsocks -m "ss-server" -s "-s 0.0.0.0 -p 9503 -m chacha20-ietf-poly1305 -k 123123"

这里使用了obfs混淆,kcptun加速。(obfs建议必备)

docker pull mritd/shadowsocks
docker run -dt --name ssserver  \
    -p 6443:6443  \
    -p 6500:6500/udp  \
    -e SS_MODULE="ss-server"  \
    -e SS_CONFIG="-s 0.0.0.0 -p 6443 -l 1080 -u -m chacha20-ietf-poly1305 -k password --fast-open --plugin obfs-server --plugin-opts obfs=http"  \
    -e KCP_FLAG="true" \
    -e KCP_MODULE="kcpserver"  \
    -e KCP_CONFIG="-t 127.0.0.1:6443 -l :6500 --key password --crypt salsa20 -mode fast2" \
    mritd/shadowsocks  

关于kcptun:

使用可以查阅此博客

github

服务端版本和客户端版本一定要一致。

shadowsocks-libev

此为shadowsocks C++版。

sudo apt update
sudo apt install shadowsocks-libev

# Edit the configuration file
sudo vim /etc/shadowsocks-libev/config.json

# Edit the default configuration for debian
sudo vim /etc/default/shadowsocks-libev

# Start the service
sudo /etc/init.d/shadowsocks-libev start    # for sysvinit, or
sudo systemctl start shadowsocks-libev      # for systemd

vim /etc/shadowsocks-libev/config.json

{
    "server":"*.*.*.*",
    "server_port":443,
    "local_port":1080,
    "password":"***",
    "timeout":300,
    "mode":"tcp_and_udp",
    "method":"chacha20-ietf-poly1305",
    "plugin":"obfs-server",
    "plugin_opts":"obfs=http",
    "fast_open": true
}

libmbedtls and libsodium

部分加密算法需要此项支持。

# Installation of basic build dependencies
## Debian / Ubuntu
sudo apt-get install --no-install-recommends gettext build-essential autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev automake libmbedtls-dev libsodium-dev
## CentOS / Fedora / RHEL
sudo yum install gettext gcc autoconf libtool automake make asciidoc xmlto c-ares-devel libev-devel
## Arch
sudo pacman -S gettext gcc autoconf libtool automake make asciidoc xmlto c-ares libev

# Installation of libsodium
export LIBSODIUM_VER=1.0.16
wget https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUM_VER.tar.gz
tar xvf libsodium-$LIBSODIUM_VER.tar.gz
pushd libsodium-$LIBSODIUM_VER
./configure --prefix=/usr && make
sudo make install
popd
sudo ldconfig

# Installation of MbedTLS
export MBEDTLS_VER=2.6.0
wget https://tls.mbed.org/download/mbedtls-$MBEDTLS_VER-gpl.tgz
tar xvf mbedtls-$MBEDTLS_VER-gpl.tgz
pushd mbedtls-$MBEDTLS_VER
make SHARED=1 CFLAGS=-fPIC
sudo make DESTDIR=/usr install
popd
sudo ldconfig

# Start building
./autogen.sh && ./configure && make
sudo make install

simple-obfs

可使用v2ray-plugin替换。

simple-obfs如果结合shadowsocks-libev使用则执行以下命令即可;如果是shadowsocks(python版)或者其他语言版本则需要独立开启obfs-server。

# Debian / Ubuntu
sudo apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev libpcre3-dev libev-dev asciidoc xmlto automake
# CentOS / Fedora / RHEL
sudo yum install gcc autoconf libtool automake make zlib-devel openssl-devel asciidoc xmlto libev-devel
# Arch
sudo pacman -Syu gcc autoconf libtool automake make zlib openssl asciidoc xmlto
# Alpine
apk add gcc autoconf make libtool automake zlib-dev openssl asciidoc xmlto libpcre32 libev-dev g++ linux-headers

git clone https://github.com/shadowsocks/simple-obfs.git
cd simple-obfs
git submodule update --init --recursive
./autogen.sh
./configure && make
sudo make install

setcap cap_net_bind_service+ep /usr/local/bin/obfs-server

客户端下载shadowsocks-windows
客户端下载obfs-local,放入ss同目录。






>>转载请注明原文链接地址:shadowsocks-libev+simple-obfs+kcptun