shadowsock 的安装

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/he9282520/article/details/82906422

1、环境:

ubuntu18

2、安装:

切换到root

  sudo su root
  apt install python-pip
  apt install python-setuptools m2crypto
  pip install shadowsocks

3、配置文件

vim /xxx/shadowsocks.json
根据实际情况配置

{
“server”: “*",
“server_port”: 30000,
“local_address”: “127.0.0.1”,
“local_port”:30000,
“password”: "
”,
“method”: “aes-256-cfb”,
“timeout”: 300
}

4、启动

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

5、问题

  • 2018-09-30 10:07:29 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 379, in getattr
    func = self.getitem(name)
    File “/usr/lib/python2.7/ctypes/init.py”, line 384, 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函数,如官网中所说:

  1. copyEVP_CIPHER_CTX was made opaque in OpenSSL 1.1.0. As a result,
    EVP_CIPHER_CTX_reset() appeared and EVP_CIPHER_CTX_cleanup()
    disappeared. [plain] view plain copyEVP_CIPHER_CTX_init() remains
    as an alias for EVP_CIPHER_CTX_reset().

修改方法:

用vim打开文件:

  • vim/usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py
    (该路径请根据自己的系统情况自行修改,如果不知道该文件在哪里的话,可以使用find命令查找文件位置)跳转到52行(shadowsocks2.8.2版本,其他版本搜索一下cleanup)
  • 进入编辑模式将第52行libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
    改为libcrypto.EVP_CIPHER_CTX_reset.argtypes = (c_void_p,)
  • 再次搜索cleanup(全文件共2处,此处位于111行),将libcrypto.EVP_CIPHER_CTX_cleanup(self._ctx)
    改为libcrypto.EVP_CIPHER_CTX_reset(self._ctx)
  • 保存并退出启动shadowsocks服务

猜你喜欢

转载自blog.csdn.net/he9282520/article/details/82906422