Digitalocean + ss 搭建加密通信代理服务器

本文以 DigitalOcean + ss/ssr 配置加密通道科学上网为例,记录了手动搭梯子的过程。
启动一个服务器实例的操作可以参考我的这篇博文,这里主要介绍 ss/ssr 的服务搭建过程。

首先 SSH 登陆到 VPS:

ssh <username>@<server>

这里用户名推荐用 root,因为配置过程中有很多操作需要管理员权限。
登陆成功后,良好的习惯是更新 apt 代码仓库和升级应用:

apt update && apt upgrade

然后就可以开始安装 ShadowSocks 的过程了(以 Python 版为例)

apt install python-pip
pip install [https://github.com/shadowsocks/shadowsocks/archive/master.zip](https://github.com/shadowsocks/shadowsocks/archive/master.zip) -U

注意:这里一定要使用管理员权限安装,不然后面在输入命令 ssserver 的时候会报错:

-bash: ssserver: command not found

ssserver 安装完成后,我们需要几个加密工具:

apt install python-m2crypto

wget https://github.com/jedisct1/libsodium/releases/download/1.0.17/libsodium-1.0.17.tar.gz
tar xvf libsodium-1.0.17.tar.gz && cd libsodium-1.0.17/
./configure
make && make check
make install

安装部分到这里就结束了。接下来是一些 ss 服务的配置操作。
新建一个 json 文件 ss.json

{
  "server": "xxx.xxx.xxx.xxx",
  "server_port": 1234,
  "local_port": 56789,
  "password": "your password",
  "timeout": 600,
  "method": "aes-256-gcm",
  "remarks": "name of this configuration"
}

并将该文件拷贝到 /etc/ss.json
(注意:加密方法应该选择 aes-256-gcm 或 chacha20-ietf-poly1305,其他方法容易被 block)

大功告成!现在我们可以启动 ss 服务了:

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

注:OpenSSL 1.1.0 以上版本环境中会遇到报错

AttributeError: /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup

解决方法参考自这里,简单来说,我们只需要将文件 /usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py 中的 libcrypto.EVP_CIPHER_CTX_cleanup 替换为 libcrypto.EVP_CIPHER_CTX_reset

如果一切正常,ssserver 将显示信息:

INFO: loading config from /etc/ss.json
yyyy-mm-dd h:min:s INFO     loading libcrypto from libcrypto.so.1.1
started

另外两个常用 ssserver 命令:

ssserver -c /etc/ss.json -d stop
ssserver -c /etc/ss.json -d restart

VPS + ssserver 的部署过程到此就完成了,选个喜欢的 ss 客户端开始访问互联网吧~~

Reference


Written with StackEdit.

猜你喜欢

转载自www.cnblogs.com/LexLuc/p/10460859.html
今日推荐