Last active
September 24, 2024 13:29
-
-
Save gpchelkin/b84612e270363cbe63b6330b5bf910f1 to your computer and use it in GitHub Desktop.
How to Setup shadowsocks-rust Server with xray-plugin (or v2ray-plugin) on Any Linux Host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://github.com/shadowsocks/shadowsocks-rust/releases | |
export SSVERSION=v1.21.0 | |
export SSPORT=443 | |
export SSPASSWORD="CHANGEME" | |
export SSARCHIVE="shadowsocks-${SSVERSION}.x86_64-unknown-linux-gnu.tar.xz" | |
#export SSARCHIVE="shadowsocks-${SSVERSION}.aarch64-unknown-linux-gnu.tar.xz" | |
export PREFIX=/usr/local/bin | |
#export PREFIX=${HOME}/.local/bin | |
#TODO Сhange to /etc/shadowsocks-rust: | |
export CONFIGDIR=/etc | |
#export CONFIGDIR=${HOME}/.config/sslocal | |
wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/${SSVERSION}/${SSARCHIVE} -O ${SSARCHIVE} | |
tar -xvf ${SSARCHIVE} -C ${PREFIX} | |
# https://github.com/shadowsocks/v2ray-plugin/releases | |
# export V2RAY_VERSION=v1.3.2 | |
# export V2RAY_ARCHIVE="v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz" | |
# wget "https://github.com/shadowsocks/v2ray-plugin/releases/download/${V2RAY_VERSION}/${V2RAY_ARCHIVE}" -O ${V2RAY_ARCHIVE} | |
# tar -xvf ${V2RAY_ARCHIVE} -C ${PREFIX} | |
# mv ${PREFIX}/v2ray-plugin_linux_amd64 ${PREFIX}/v2ray-plugin | |
# https://github.com/teddysun/xray-plugin/releases | |
export XRAY_VERSION=v1.8.24 | |
export XRAY_ARCHIVE="xray-plugin-linux-amd64-${XRAY_VERSION}.tar.gz" | |
wget "https://github.com/teddysun/xray-plugin/releases/download/${XRAY_VERSION}/${XRAY_ARCHIVE}" -O ${XRAY_ARCHIVE} | |
tar -xvf ${XRAY_ARCHIVE} -C ${PREFIX} | |
mv ${PREFIX}/xray-plugin_linux_amd64 ${PREFIX}/xray-plugin | |
### server: | |
cat <<EOF > ${CONFIGDIR}/ssserver.json | |
{ | |
"server": "0.0.0.0", | |
"server_port": ${SSPORT}, | |
"password": "${SSPASSWORD}", | |
"method": "chacha20-ietf-poly1305", | |
"fast_open": true, | |
"timeout": 300, | |
"reuse_port": true | |
// If you want to use Xray plugin as WebSocket TLS transport, so that you will get Shadowsocks over websocket with TLS (HTTPS): | |
// - find free domain name (https://freemyip.com), or buy one, for example, at https://porkbun.com; | |
// - add DNS record for that domain pointing to your server IP; | |
// - obtain Let's Encrypt TLS certificate+key with https://certbot.eff.org or https://github.com/acmesh-official/acme.sh; | |
// - https://github.com/teddysun/xray-plugin?tab=readme-ov-file#issue-a-cert-for-tls-and-quic | |
// - uncomment the following part; | |
// - replace "my.host" in three places with your hostname used in certificate (adapt paths if needed). | |
// ,"plugin": "xray-plugin" | |
// ,"plugin_opts": "server;tls;host=my.host;path=/wss;cert=/etc/letsencrypt/live/my.host/fullchain.pem;key=/etc/letsencrypt/live/my.host/privkey.pem" | |
} | |
EOF | |
cat <<EOF > /etc/systemd/system/ssserver.service | |
[Unit] | |
Description=shadowsocks-rust server | |
After=network-online.target | |
[Service] | |
Type=simple | |
LimitNOFILE=32768 | |
ExecStart=${PREFIX}/ssserver -c ${CONFIGDIR}/ssserver.json | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
systemctl daemon-reload | |
systemctl enable ssserver | |
systemctl restart ssserver | |
systemctl status ssserver | |
# OPTIONAL: | |
# apt install xz-utils | |
# systemctl disable --now ufw | |
# systemctl disable --now firewalld | |
# systemctl mask --now firewalld |
Thank you. Will I be able to connect to the server using the
sslocal
client?
@netrolite yep you will 🙂
Thank you. Will I be able to connect to the server using the
sslocal
client?@netrolite yep you will 🙂
Ok thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to issue certificate:
https://github.com/teddysun/xray-plugin#issue-a-cert-for-tls-and-quic
Alternative (TODO later):
Xray/XTLS and all info:
https://old.reddit.com/r/dumbclub/comments/1coe11g/selfhosted_vpn_2024_megathread/
https://github.com/XTLS/Xray-core
https://github.com/XTLS/Xray-install
https://github.com/XTLS/Xray-examples
https://xtls.github.io/en/document/
Xray/XTLS VLESS+REALITY
https://github.com/XTLS/REALITY
https://cscot.pages.dev/2023/03/02/Xray-REALITY-tutorial/
https://xtls.github.io/en/config/outbounds/vless.html
Android Client for VLESS+REALITY:
v2rayNG
iOS Client for VLESS+REALITY - FoXray (WingsX):
https://apps.apple.com/us/app/foxray/id6448898396
https://foxray.org
https://yiguo.dev/docs/apple/
More:
https://discourse.shadowsocks.org/c/implementations/12
https://www.v2ray.com/ru/ui_client/ios.html