Go-Shadowsocks2的进阶搭建 作者: Hogwarts 发布于: 2020-07-31 更新于: 2021-12-10 分类: 红杏出墙 接上一篇,面向小白的简单部署Go-Shadowsocks2中说到,裸的SS搭建完毕后容易被墙,那好啦,咱给它加一个伪装吧。 因为官方的版本更新较慢,推荐秋水逸冰重新编译的v2-plugin 服务端和客户端下载地址:https://github.com/teddysun/v2ray-plugin/releases 安卓客户端:https://github.com/teddysun/v2ray-plugin-android # 一、http伪装 上一篇讲到执行`./shadowsocks2-linux -s 'ss://aes-128-gcm:password@:port' -verbose`命令就能够运行ss了,按Ctrl+C终止执行。 ##1.1 下载 v2ray-plugin wget https://github.com/teddysun/v2ray-plugin/releases/download/v1.3.4/v2ray-plugin-linux-amd64-v1.3.4.tar.gz 注意下载版本,目前此版本是最新版。如果有新版本下载 linux-amd64的。 tar -zxvf v2ray-plugin-linux-amd64-v1.3.4.tar.gz //解压缩 ##1.2 运行带v2ray-plugin伪装的shadowsocks ./go-shadowsocks2 -s 'ss://aes-128-gcm:password@:port' -verbose -plugin v2ray-plugin_linux_amd64 -plugin-opts "server" #二、https伪装 此类型需要一个域名和证书,域名建议申请xyz的,一年一刀。申请证书建议用acme.sh申请。 ## 2.1 证书申请 安装工具 apt-get install cron socat curl -y 获取 acme.sh curl https://get.acme.sh | sh -s email=youremail@example.com #把youremail@example.com改为你的邮箱 重启终端 source ~/.bashrc 如安装过一段时间需升级到最新版 acme.sh --upgrade 申请命令 acme.sh --issue -d 你的域名 --keylength ec-256 --standalone --server letsencrypt #不支持泛域名 安装到指定位置 mkdir /etc/你的域名 //建立文件夹存放申请的域名文件 acme.sh --ecc --installcert -d 你的域名 --key-file /etc/你的域名 /private.key --fullchain-file /etc/你的域名/fullchain.cer 此法申请证书三个月后需重新申请。 申请证书学习参考: `https://shiping.date/18.html` `https://winamp.top/93.html` ## 2.2 运行命令 ./go-shadowsocks2 -s 'ss://aes-128-gcm:password@:port' -verbose -plugin v2ray-plugin_linux_amd64 -plugin-opts "server;tls;host=你的域名;cert=/etc/你的域名/fullchain.cer;key=/etc/你的域名/private.key" 如果顺利运行再加nohup命令后台运行。 #三、给https模式增加systemctl命令 用nohup后台运行的缺点就是重启服务器后需重新运行,不能开机启动。以下是进阶模式。 cp v2ray-plugin_linux_amd64 v2ray-plugin //重新命名 mkdir /etc/go-shadowsocks2 //建立 go-shadowsocks2文件夹 cp go-shadowsocks2 v2ray-plugin /usr/bin/ `vim /etc/go-shadowsocks2/go-shadowsocks2.env` //建立文件 将下面命令拷贝到 go-shadowsocks2.env文件中 REMOTE_ADDR=ss://aes-128-gcm:password@0.0.0.0:port -verbose -plugin v2ray-plugin -plugin-opts "server;tls;host=你的域名;cert=/etc/你的域名/fullchain.cer;key=/etc/你的域名/private.key" `vim /etc/systemd/system/go-shadowsocks2.service `//建立开机启动文件 将下列命令拷贝到 go-shadowsocks2.service文件中 [Unit] Description=Shadowsocks2 Wants=network-online.target After=network-online.target [Service] EnvironmentFile=/etc/go-shadowsocks2/go-shadowsocks2.env ExecStart=/usr/bin/go-shadowsocks2 -s $REMOTE_ADDR Restart=always [Install] WantedBy=multi-user.target 运行以下命令重载、启动、查看状态 systemctl daemon-reload //重载 systemctl start go-shadowsocks2 //启动 systemctl status go-shadowsocks2 //状态 systemctl enable go-shadowsocks2 //加入开机启动 #四、客户端的用法 参考:(在文章末端) `https://teddysun.com/569.html` `https://shiping.date/6.html` 标签: shadowsocks, go-shadowsocks2