人生理想,技术交流加Q:411239339

Ubuntu 18.04 下解决 shadowsocks 服务报错问题

浏览:808次阅读
没有评论

共计 1913 个字符,预计需要花费 5 分钟才能阅读完成。

文章目录[隐藏]

1. 报错内容

启动时报错如下:

Traceback (most recent call last):
File “/usr/local/bin/sslocal”, line 11, in
sys.exit(main())
File “/usr/local/lib/python3.6/dist-packages/shadowsocks/local.py”, line 39, in main
config = shell.get_config(True)
File “/usr/local/lib/python3.6/dist-packages/shadowsocks/shell.py”, line 262, in get_config
check_config(config, is_local)
File “/usr/local/lib/python3.6/dist-packages/shadowsocks/shell.py”, line 124, in check_config
encrypt.try_cipher(config[‘password’], config[‘method’])
File “/usr/local/lib/python3.6/dist-packages/shadowsocks/encrypt.py”, line 44, in try_cipher
Encryptor(key, method)
File “/usr/local/lib/python3.6/dist-packages/shadowsocks/encrypt.py”, line 83, in init
random_string(self._method_info[1]))
File “/usr/local/lib/python3.6/dist-packages/shadowsocks/encrypt.py”, line 109, in get_cipher
return m[2](method, key, iv, op)
File “/usr/local/lib/python3.6/dist-packages/shadowsocks/crypto/openssl.py”, line 76, in init
load_openssl()
File “/usr/local/lib/python3.6/dist-packages/shadowsocks/crypto/openssl.py”, line 52, in load_openssl
libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
File “/usr/lib/python3.6/ctypes/init.py”, line 361, in getattr
func = self.getitem(name)
File “/usr/lib/python3.6/ctypes/init.py”, line 366, 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

2、原因

由于 Ubuntu 18 中由于升级 openssl 至 1.1.0 以上版本导致的 shadowsocks 服务出现 undefined symbol: EVP_CIPHER_CTX_cleanup 错误而无法启动的问题。

官网 中所描述,这是由于在 openssl 1.1.0 中废弃了 EVP_CIPHER_CTX_cleanup() 函数而引入了 EVE_CIPHER_CTX_reset() 函数所导致的:

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().

因此,可以通过将 EVP_CIPHER_CTX_cleanup() 函数替换为 EVP_CIPHER_CTX_reset() 函数来解决该问题。具体解决方法如下:

  • 根据错误信息定位到文件 /home/feng/.local/lib/python3.6/site-packages/shadowsocks/crypto/openssl.py。

  • 搜索 cleanup 并将其替换为 reset。

  • 重新启动 shadowsocks, 该问题解决。

正文完
创作不易,扫码加点动力
post-qrcode
 0
果较瘦
版权声明:本站原创文章,由 果较瘦 于2020-08-08发表,共计1913字。
转载说明:除特殊说明外本站文章皆由果较瘦原创发布,转载请注明出处。