解决shadowsocks2.8.2报错问题

来源:互联网 发布:手机解锁密码软件 编辑:程序博客网 时间:2024/06/07 00:18

最近lantern无法使用了,朋友给了个shadowsocks先用这,在公司的时候使用正常,但是到了家里的电脑上就不行了,执行

sslocal -c shadowsocks.json

时报了下面的错误

INFO: loading config from /home/shooke/.shadowsocks.json2017-10-28 21:40:48 INFO     loading libcrypto from libcrypto.so.1.1Traceback (most recent call last):  File "/usr/local/bin/sslocal", line 11, in <module>    sys.exit(main())  File "/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/local.py", line 39, in main    config = shell.get_config(True)  File "/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/shell.py", line 262, in get_config    check_config(config, is_local)  File "/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/shell.py", line 124, in check_config    encrypt.try_cipher(config['password'], config['method'])  File "/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/encrypt.py", line 44, in try_cipher    Encryptor(key, method)  File "/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/encrypt.py", line 83, in __init__    random_string(self._method_info[1]))  File "/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/encrypt.py", line 109, in get_cipher    return m[2](method, key, iv, op)  File "/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/crypto/rc4_md5.py", line 33, in create_cipher    return openssl.OpenSSLCrypto(b'rc4', rc4_key, b'', op)  File "/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/crypto/openssl.py", line 76, in __init__    load_openssl()  File "/home/shooke/.local/lib/python2.7/site-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

在网上找了下原因,发现是openssl版本导致的。看来是因为我本地和公司电脑上openssl版本不一样。
解决方法是修改/home/shooke/.local/lib/python2.7/site-packages/shadowsocks/crypto/openssl.py文件,这个路径在不同电脑上可能不一样,看报错信息根据报错内容找到对应的openssl.py文件。
修改两个地方
将第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)
然后保存退出就可以正常启动了

参考资料https://blog.lyz810.com/article/2016/09/shadowsocks-with-openssl-greater-than-110/

原创粉丝点击