解決shadowsocks2.8.2報錯問題
阿新 • • 發佈:2018-12-25
最近lantern無法使用了,朋友給了個shadowsocks先用這,在公司的時候使用正常,但是到了家裡的電腦上就不行了,執行
sslocal -c shadowsocks.json
時報了下面的錯誤
INFO: loading config from /home/shooke/.shadowsocks.json
2017-10-28 21:40:48 INFO loading libcrypto from libcrypto.so.1.1
Traceback (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)
然後儲存退出就可以正常啟動了