gongdear

gongdear的技术博客

欢迎大家参观我的博客
  menu
97 文章
89355 浏览
1 当前访客
ღゝ◡╹)ノ❤️

Ubuntu18.04 Kali2.0 update到最新版本后安装shadowsocks服务报错问题

apt-get install python-pip
pip install shadowsocks
vim /etc/shadowsocks.json
{ "server":"my_server_ip", "server_port":9016, "local_address": "127.0.0.1", "local_port":1080, "password":"mypassword", "timeout":300, "method":"aes-256-cfb", "fast_open": false, "workers": 1 }
sslocal -c /etc/shadowsocks.json 启动服务

sslocal -c /etc/shadowsocks.json -d start 后台启动服务

如果启动报错

  1. INFO: loading config from ss.json
  2. 2016-12-14 22:47:50 INFO loading libcrypto from libcrypto.so.1.1
  3. Traceback (most recent call last):
  4. File “/usr/local/bin/sslocal”, line 11, in
  5. sys.exit(main())
  6. File “/usr/local/lib/python2.7/dist-packages/shadowsocks/local.py”, line 39, in main
  7. config = shell.get_config(True)
  8. File “/usr/local/lib/python2.7/dist-packages/shadowsocks/shell.py”, line 262, in get_config
  9. check_config(config, is_local)
  10. File “/usr/local/lib/python2.7/dist-packages/shadowsocks/shell.py”, line 124, in check_config
  11. encrypt.try_cipher(config[‘password’], config[‘method’])
  12. File “/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py”, line 44, in try_cipher
  13. Encryptor(key, method)
  14. File “/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py”, line 83, in init
  15. random_string(self._method_info[1]))
  16. File “/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py”, line 109, in get_cipher
  17. return m[2](method, key, iv, op)
  18. File “/usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py”, line 76, in init
  19. load_openssl()
  20. File “/usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py”, line 52, in load_openssl
  21. libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
  22. File “/usr/lib/python2.7/ctypes/init.py”, line 375, in getattr
  23. func = self.getitem(name)
  24. File “/usr/lib/python2.7/ctypes/init.py”, line 380, in getitem
  25. func = self._FuncPtr((name_or_ordinal, self))
  26. 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. 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.
  2. EVP_CIPHER_CTX_init() remains as an alias for EVP_CIPHER_CTX_reset().

修改方法:

  1. 用vim打开文件:vim /usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py (该路径请根据自己的系统情况自行修改,如果不知道该文件在哪里的话,可以使用find命令查找文件位置)
  2. 跳转到52行(shadowsocks2.8.2版本,其他版本搜索一下cleanup)
  3. 进入编辑模式
  4. 将第52行libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
    改为libcrypto.EVP_CIPHER_CTX_reset.argtypes = (c_void_p,)
  5. 再次搜索cleanup(全文件共2处,此处位于111行),将libcrypto.EVP_CIPHER_CTX_cleanup(self._ctx)
    改为libcrypto.EVP_CIPHER_CTX_reset(self._ctx)
  6. 保存并退出
  7. 启动shadowsocks服务:service shadowsocks start 或 sslocal -c ss配置文件目录
  8. 问题解决
宝剑锋从磨砺出,梅花香自苦寒来.