Shadowsocks toss

The technology itself is also pieced together by one detail

The cause of the incident is that the server network is blocked by a website and needs to be accessed using the http proxy. Because there is no stable and easy to use http proxy address (online free, but also unstable), but there is still a server on the cloud (on the cloud), so I want to build a shadowsocks server on the cloud server, build on the local server The client is used to connect. If you have the idea, let’s do it. It is not difficult to build a shadowsocks service. However, it should take only half an hour to get the job, but it took more than 2 hours (socks to http proxy problem), so here A subtotal, to the effect.

For friends who don’t have a server, the first thing to do is to buy a cloud server, go to [Amazon] (https://aws.amazon.com), or vultr Wait.

Install shadowsocks Server (server)

Set up the shadowsocks server, and introduce the windows and linux building methods.

Windows

Install python first, then use pip to install shadowsocks.

1
pip install shadowsocks

Then create a file like: config.json

1
2
3
4
5
6
7
8
9
10
{
"server":"", ## Fill in the server's external network ip address
"server_port": 8000, ##proxy port
"local_address":"127.0.0.1",
"local_port": 1080, ##local listening port
"password":"", ##Connection password
"timeout":300,
"method":"aes-256-cfb", ##encryption
"dast_open":false
}

After filling out, run in cmd:

1
ssserver -c config.json

If there is no error, the shadowsocks server has already been set up.

Linux

Install

Similar to windows, install python and pip first, then install shadowsocks via pip.
ubuntu:

1
2
3
apt-get install python-pip
apt-get install python-m2crypto
pip install shadowsocks

centos:

1
2
3
4
yum install epel-release
yum install python-pip
yum install python-setuptools m2crypto supervisor
pip install shadowsocks

Configuring the config file
1
2
mkdir /etc/shadowsocks
Vim /etc/shadowsocks/config.json (must be in this directory)

Write:
Single user configuration:

1
2
3
4
5
6
7
8
9
10
{
"server": "", ## fill in the server's external network ip address, ip can also write the internal network address, as long as it can be forwarded.
"server_port":8000,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"",
"timeout":300,
"method":"aes-256-cfb",
"fast_open":false
}

Multi-user configuration:

1
2
3
4
5
6
7
8
9
10
11
12
{
"server":"",
"local_address":"127.0.0.1",
"local_port":1080,
"port_password":{
"8000":"123456",
"8001":"123456"
},
"timeout":300,
"method":"aes-256-cfb",
"fast_open":false
}

Command line startup off
1
2
Ssserver -c /etc/shadowsocks/config.json -d start Background startup
Ssserver -c /etc/shadowsocks/config.json -d stop background stop
Setting up boot

Add the started command to the end of the /etc/rc.local file.

1
vi /etc/rc.local

Setting up a non-root user to run ss
1
2
Sudo useradd ssuser //Add a ssuser user
Sudo ssserver [other options] --user ssuser //Run the ss with the ssuser user

Change the previous ssserver -c /etc/shadowsocks.json -d start to ssserver -c /etc/shadowsocks.json -d start –user ssuser

Install shadowsocks Client

I installed the shadowsock client. I also divided it into windows and Linux.

Windows

Windows installation shadowsocks client is relatively simple, directly download the installer.
After startup, fill in the corresponding configuration of the server (ip, port, password, encryption)
Setting mode:


The PAC mode is recommended.

Linux

  • The main time spent this time is to build a shadowsocks client on Linux. There are a lot of pits (~ mainly my own brain is a little dizzy~)*
    Install
    Installation is equally simple:
    1
    pip install shadowsocks
Configuring config

The configuration is also very simple, create a shadowsocks.json file:

1
2
3
4
5
6
7
8
{
"server":"",
"server_port":8000,
"local_port":1080,
"password":"",
"timeout":600,
"method":"aes-256-cfb"
}

The content is similar to the above, and then run on the command line: sslocal -c shadowsocks.json The system will now listen on the local 1080 port.

socks to http proxy problem

At this time is not a GUI window, just a command line, how to use the curl and other commands to go to the http proxy (most of the online information is to set up the browser, but not suitable for this article), originally can be solved with other solutions, but at this time, the choice of shadowsocks, I can only go all the way. After everything is installed, after the startup, I found that the http proxy still can’t be used, and then I started the debugging of my heart and mind, and I still can’t use it for a long time. Finally, my colleagues found the problem (the socks proxy needs to be converted to http proxy, windows You can set the browser, linux needs to download the tool to convert).
Found the reason, then the question is how to say that the socks agent is converted to http proxy?

socks to http proxy program
  • proxychains can automatically convert the socks proxy to http proxy.
  • polipo uses this tool to convert the socks proxy to http proxy.
proxychains

installation:

1
2
3
4
git clone https://github.com/haad/proxychains
./configure
make
sudo make install

Configuration:
Modify the configuration file proxychains.conf

1
Change socks4 127.0.0.1 9095 to socks5 127.0.0.1 1080 //1080 to your own port

use:

1
proxychains curl http://thief.one

For details, please refer to: [http://www.tuicool.com/articles/rUNFF3] (http://www.tuicool.com/articles/rUNFF3)

polyp

installation:

1
sudo apt-get install polipo

Configuration:
Stop polipo service sudo service polipo stop
Edit the polipo configuration file /etc/polipo/config and add the following:

1
2
socksParentProxy = localhost:1080
proxyPort = 1081

Start polipo service sudo service polipo start

use:

  • App configuration http_proxy=http://127.0.0.1:1081
  • bash can edit $HOME/.bashrc, add export http_proxy=http://127.0.0.1:1081 to export environment variables. The current bash is to execute source $HOME/.bashrc to make the configuration file take effect.

linux or mac terminal using shadowsocks proxy

Take zsh under mac as an explanation:

1
~ vim ~/.zshrc

Add the following proxy configuration:

1
2
alias proxy='export all_proxy=socks5://127.0.0.1:1080'
alias unproxy='unset all_proxy'

Make the configuration take effect:

1
~ source ~/.zshrc

use:

1
2
3
~ proxy
~ unproxy
~ curl ip.cn # Do not go to the agent

For details, please refer to: [http://blog.csdn.net/zcq8989/article/details/50545078] (http://blog.csdn.net/zcq8989/article/details/50545078)

Client software download

shadowsocks client for windows
shadowsocks client for mac
shadowsocks client for android
shadowsocks client for ios

本文标题:Shadowsocks toss

文章作者:nmask

发布时间:2017年02月22日 - 21:02

最后更新:2019年08月16日 - 14:08

原始链接:https://thief.one/2017/02/22/Shadowsocks toss/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

nmask wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
坚持原创技术分享,您的支持将鼓励我继续创作!

热门文章推荐: