ubuntu18.04-ss-client

一、安装 python-pip

sudo apt install python-pip

二、安装 shadowsocks

sudo pip install shadowsocks

看到 Successfully installed shadowsocks-2.8.2 则代表安装成功

三、配置 shadowsocks

运行:$ sudo gedit /etc/shadowsocks.json

在 shadowsocks.json 文件中写入:

"server":"代理服务器ip”,

"server_port":代理服务器端口,

"password":"代理服务器访问密码”,  

"local_address":"127.0.0.1”, 

"local_port":1080, 

"timeout":600, 

"method":"aes-256-cfb" // 代理服务器访问数据加密方式,根据自己配置ss 服务端时的配置自行填写

}

四、启动 shadowsocks

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

然后并不是一路顺利,在这里报错了,代码如下

INFO: loading config from ss.json 
2018-10-14 22:47:50 INFO loading libcrypto from libcrypto.so.1.1 
Traceback (most recent call last): 
File “/usr/local/bin/sslocal”, line 11, in 
sys.exit(main()) 
File “/usr/local/lib/python2.7/dist-packages/shadowsocks/local.py”, line 39, in main 
config = shell.get_config(True) 
File “/usr/local/lib/python2.7/dist-packages/shadowsocks/shell.py”, line 262, in get_config 
check_config(config, is_local) 
File “/usr/local/lib/python2.7/dist-packages/shadowsocks/shell.py”, line 124, in check_config 
encrypt.try_cipher(config[‘password’], config[‘method’]) 
File “/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py”, line 44, in try_cipher 
Encryptor(key, method) 
File “/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py”, line 83, in init 
random_string(self._method_info[1])) 
File “/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py”, line 109, in get_cipher 
return m[2](method, key, iv, op) 
File “/usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py”, line 76, in init 
load_openssl() 
File “/usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py”, line 52, in load_openssl 
libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,) 
File “/usr/lib/python2.7/ctypes/init.py”, line 375, in getattr 
func = self.getitem(name) 
File “/usr/lib/python2.7/ctypes/init.py”, line 380, in getitem 
func = self._FuncPtr((name_or_ordinal, self)) 
AttributeError: /usr/lib/x86_64-Linux-gnu/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup

这个问题是由于在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().

解决方法:

找到 /usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py 文件进行修改,

用vim 或 gedit 命令行都行:

此处以 shadowsocks-2.8.2的版本为例,其他版本自行在文件中搜索

1、将第52行

libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)

改为

libcrypto.EVP_CIPHER_CTX_reset.argtypes = (c_void_p,)

2、将第111行

libcrypto.EVP_CIPHER_CTX_cleanup(self._ctx)

改为

libcrypto.EVP_CIPHER_CTX_reset(self._ctx)

修改完之后保存退出即可,然后再次执行:

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

这次应该就能启动成功了!

参考文献:https://ywnz.com/linuxjc/2687.html

Dear ==>本文纯属个人学习经验分享交流,出错再所难免,仅供参考!如果发现错误的地方,可以的话麻烦指点下,特别感谢!<==

猜你喜欢

转载自www.cnblogs.com/dupake/p/9900465.html