点滴记录
自古成功在尝试。

解决Openssl升级到1.1.0使用shadowsocks服务报错问题

本文记录ss无法在linux系统中openssl版本为1.1.0及以上,无法使用的解决方法。

运行服务报错如下:

INFO: loading config from /ss/ss.json
2018-03-08 15:29:53 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

错误原因:

openssl升级到1.1.0以上版本,导致shadowsocks启动报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().

解决方法如下:

#编辑shadowsocks运行文件中openssl.py文件,目录在/usr/local/lib/python2.7/后有所不同
vim /usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py

#查找所有的cleanup函数,改为reset函数
#小编共找到两个cleanup函数,一个在52行,一个在111行。

重启服务,一切正常。。。

未经允许不得转载:日常笔记 » 解决Openssl升级到1.1.0使用shadowsocks服务报错问题

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址