Shadowsock - jyasonx/note GitHub Wiki
- OS: Ubuntu 14.04 LTS
- Cloud: AWS
- User: root
这里推荐使用14.04,其他版本多少会存在问题
apt install build-essential python-pip
pip install shadowsockspip install setuptools
pip install wheel
#if Ubuntu 16.04 and above.
pip install --upgrade setuptools
pip install --upgrade wheel配置文件/etc/shadowsocks.json
{
"server": "0.0.0.0",
"server_port": 8388,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "<your_password>",
"timeout": 300,
"method": "aes-256-cfb"
}
替换下密码
ufw disableiptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -Fssserver -c /etc/shadowsocks.json -d start
ssserver -c /etc/shadowsocks.json -d stop修改/etc/rc.local,在'exit 0'之前添加启动服务脚本
- 需要安装.NET Framework 4.6.2 和 Microsoft Visual C++ 2015 Redistributable
- 下载Shadowsocks客户端
- 启动shadowsocks.exe后,右键配置服务器IP,端口,密码等
- 右键选择启动代理(可以在右键菜单中选择代理模式,默认是PAC代理)
sudo su -
apt install build-essential python-pip
pip install setuptools wheel
pip install --upgrade setuptools wheel
pip install shadowsocks上述安装方式也可以通过apt直接安装
sudo apt install shadowsocks编辑配置文件/etc/shadowsocks.json(apt直接安装的有默认配置文件/etc/shadowsocks/config)
{
"server": "<server_ip>",
"server_port": 8388,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "<your_password>",
"timeout": 300,
"method": "aes-256-cfb"
}
启动shadowsocks客户端
这里也需要root或sudo执行,否则会有权限问题
sudo sslocal -c /etc/shadowsocks.json -d start停止服务
sudo sslocal -c /etc/shadowsocks.json -d stop这时会发现还是无法翻墙,这里就需要代理服务客户端来配合,这里使用privoxy
这里没有用 polipo,主要安装是会与原生的软件抢占53端口
apt install privoxy修改配置文件/etc/privoxy/config,在第1337行打开注解,修改为:
forward-socks5t / 127.0.0.1:1080 .
重启privoxy服务
sudo service prixovy restart设置 http_proxy 和https_proxy 或直接设置浏览器或系统的代理即可
export http_proxy=http://localhost:8118
export https_proxy=http://localhost:8118安装GenPAC
sudo pip install genpac
sudo pip install --upgrade genpac生成pac文件
mkdir -p ~/config
cd ~/config
sudo genpac --proxy="SOCKS5 127.0.0.1:1080" -o autoproxy.pac --gfwlist-url="https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt"设置系统代理
进入设置:系统设置 -> 网络 -> 网络代理,选择automatic,配置url:file:///home/xxx/config/autoproxy.pac
完成
注:PAC的模式不太稳定,在部分网络环境下,无法翻墙
apt install polipo修改配置文件/etc/polipo/config
# This file only needs to list configuration variables that deviate
# from the default values. See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.
logSyslog = false
logFile = "/var/log/polipo/polipo.log"
socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
chunkHighMark = 50331648
objectHighMark = 16384
serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32
proxyAddress = "0.0.0.0"
proxyPort = 8123
重启服务并设置代理环境变量
sudo /etc/init.d/polipo restart
export http_proxy=http://127.0.0.1:8123/ 主要原因是libcrypto.so的版本升级造成
解决方法
修改'~/.local/lib/python2.7/site-packages/shadowsocks/crypto/openssl.py'文件,替换cleanup方法为reset
:%s/cleanup/reset/