美文网首页
Ubuntu 使用 shadowsocks 配置 VPN 代理

Ubuntu 使用 shadowsocks 配置 VPN 代理

作者: czins | 来源:发表于2017-10-16 17:15 被阅读843次

1、安装 shadowsocks:

apt install python-pip
pip install shadowsocks

2、编写配置文件

vim /etc/shadowsocks.json

内容如下格式:

{
    "server": "s9.y77u.com",
    "server_port": 15054,
    "local_address": "127.0.0.1",
    "local_port": 1087,
    "password": "794987885",
    "timeout": 300,
    "method": "rc4-md5"
}

3、运行

sslocal -c /etc/shadowsocks.json -d start

如果发生类似如下错误,请看步骤 4,否则看步骤 5:

AttributeError: .../bin/lib/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup

4、由于在openssl1.1.0版本中,废弃了EVP_CIPHER_CTX_cleanup函数,如官网中所说:

EVP_CIPHER_CTX was made opaque in OpenSSL 1.1.0. As a result, EVP_CIPHER_CTX_reset() appeared and EVP_CIPHER_CTX_cleanup() disappeared.   
EVP_CIPHER_CTX_init() remains as an alias for EVP_CIPHER_CTX_reset().  

对 openssl.py 做如下修改:

vim /usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py

将如下代码:

#libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)

修改为:

libcrypto.EVP_CIPHER_CTX_reset.argtypes = (c_void_p,)

将如下代码:

#libcrypto.EVP_CIPHER_CTX_cleanup(self._ctx)

修改为:

libcrypto.EVP_CIPHER_CTX_reset(self._ctx)

5、设置开机启动

mkdir .bash
cd /root/.bash

编写运行脚本 shadowsocks.sh

#!bin/bash
sslocal -c /etc/shadowsocks.json -d start

将 shadowsocks.sh 加入 rc.local 中:

vim /etc/rc.local

在 exit 0 前,输入下内容:

nohup bash /root/.bash/shadowsocks.sh>/root/.bash/ss.txt &

相关文章

网友评论

      本文标题:Ubuntu 使用 shadowsocks 配置 VPN 代理

      本文链接:https://www.haomeiwen.com/subject/gfxluxtx.html