更新OpenSSL库至最新版本导致sss服务无法启动

作者:matrix 发布时间:2017-04-16 分类:零零星星

ubuntu升级openssl库到OpenssL 1.1.0e版本,过程倒还好,到底还是成功了。但是reboot重启系统之后发现ss服务无法打开,这可是目前我唯一的科学电梯啊。
不过还好找到报错信息有解决办法。

>ssserver --version
shadowsocks 2.8.2 版本

报错:
root@root-VM:/usr/local/bin# ./ssserver  -c /etc/shadowsocks.json -d start
INFO: loading config from /etc/shadowsocks.json
2017-04-16 19:05:10 INFO     loading libcrypto from libcrypto.so.1.1
Traceback (most recent call last):
  File "./ssserver", line 9, in <module>
    load_entry_point('shadowsocks==2.8.2', 'console_scripts', 'ssserver')()
  File "/usr/local/lib/python2.7/dist-packages/shadowsocks/server.py", line 34, in main
    config = shell.get_config(False)
  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 378, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/ssl/lib/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup

说到底都是升级openssl导致无法使用,旧版EVP_CIPHER_CTX_cleanup函数被弃用改为EVP_CIPHER_CTX_reset

办法

定位到/usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py文件:
修改52,111行处的EVP_CIPHER_CTX_cleanupEVP_CIPHER_CTX_reset 重启服务,解决。

实际情况根据自己的ss版本查找修改相关文件

参考:http://blog.csdn.net/blackfrog_unique/article/details/60320737

PEACE

ububntu 搭建sss服务无法开机自启动

作者:matrix 发布时间:2016-12-29 分类:零零星星

搭建方法:http://www.jianshu.com/p/b5c4fbadbfae

apt-get update
apt-get install python-pip
pip install shadowsocks

添加:/etc/shadowsocks.json

{
"server":"my_server_ip",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"mypassword",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}

ssserver -c /etc/shadowsocks.json -d start

我用ubuntu按照上面链接的方法来搭建的服务,安装运行到是ok,但是reboot重启ubuntu的时候就发现出现问题。

编辑/etc/rc.local

添加开机自启动的命令失败:

ssserver -c /etc/shadowsocks.json -d start

Ubuntu下/etc/rc.local  文件修改之后没有成功。
实际上系统是执行了/etc/rc.local里面的命令,只是没有设置好ssserver命令的环境变量,系统当然无法执行。
我们需要做的就是给运行/etc/rc.local 的脚本里面添加环境变量就可以。

修改/etc/init.d/rc.local文件

vi /etc/init.d/rc.local
然后按i键执行vi编辑器的插入口令
将原本的PATH=/sbin:/usr/sbin:/bin:/usr/bin 修改为 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
按esc键输入:wq!保存退出
重启Ubuntu
reboot
然后系统就会成功执行 ssserver -c /etc/shadowsocks.json -d start 命令启动服务
重启:ssserver -c /etc/shadowsocks.json -d restart

加速

vps是kvm虚拟技术,可提升扶墙效率

https://github.com/ToyoDAdoubi/doubi

  • 安装锐速hack版
    https://github.com/91yun/serverspeeder

  • 安装Google BBR

$ bash -c "$(curl -sSL https://github.com/teddysun/across/raw/master/bbr.sh)" #安装bbr
$ bash -c "$(curl -sSL https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh)" #bbr plus

$ lsmod | grep bbr #检测
  • 腾讯TCPA(仅限centOS)
 bash <(curl -L -s http://down.08mb.com/tcp_opz/tcpa/tcpa.sh) #安装

参考:
http://www.jianshu.com/p/f88424fd4ab3

http://blog.csdn.net/zhe_d/article/details/50312967
http://www.jianshu.com/p/b5c4fbadbfae
http://www.jianshu.com/p/94445ee49df0

小众化工具 brook
https://github.com/txthinking/brook