Skip to content

Instantly share code, notes, and snippets.

@neontorrent
Created January 20, 2025 04:32
Show Gist options
  • Save neontorrent/0a81525c4b6e3b79c41e0e18da03c443 to your computer and use it in GitHub Desktop.
Save neontorrent/0a81525c4b6e3b79c41e0e18da03c443 to your computer and use it in GitHub Desktop.
Ubuntu Tinyproxy + Shadowsocks
apt update
apt install tinyproxy
echo 'BasicAuth myuser mypassword
Allow 0.0.0.0' >> /etc/tinyproxy/tinyproxy.conf
systemctl enable tinyproxy
systemctl restart tinyproxy
systemctl status tinyproxy
FILELIST=$(curl -sL https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.22.0/shadowsocks-v1.22.0.x86_64-unknown-linux-gnu.tar.xz | tar xvJ -C /tmp)
echo "To uninstall, remove these file under /usr/bin:
$FILELIST"
cp $FILELIST /usr/bin/
mkdir -p /etc/shadowsocks-rust/server/default
cat > /etc/shadowsocks-rust/server/default/ss.json5 <<EOF
{
"server": "0.0.0.0",
"server_port": 8443,
"local_port": 1080,
"local_address": "127.0.0.1",
"password": "password",
"timeout": 300,
"method": "chacha20-ietf-poly1305"
}
EOF
cat > "/etc/systemd/system/[email protected]" <<EOF
[Unit]
Description=Shadowsocks-rust Server Service for %I
Documentation=https://github.com/shadowsocks/shadowsocks-rust
After=network.target
StartLimitIntervalSec=30s
StartLimitBurst=5
[Service]
Type=simple
WorkingDirectory=%E/shadowsocks-rust/server/%i
ExecStart=/usr/bin/ssservice server --log-without-time -c ss.json5
Restart=always
RestartSec=3s
[Install]
WantedBy=default.target
EOF
systemctl enable shadowsocks-rust-server@default
systemctl restart shadowsocks-rust-server@default
systemctl status shadowsocks-rust-server@default
apt install cron
systemctl start cron
systemctl enable cron
apt install socat -y
release=$(curl -s 'https://api.github.com/repos/shadowsocks/v2ray-plugin/releases/latest' | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/')
curl -sL "https://github.com/shadowsocks/v2ray-plugin/releases/download/${release}/v2ray-plugin-linux-amd64-${release}.tar.gz" | tar xvz -C /tmp
mv -f /tmp/v2ray-plugin_linux_amd64 /usr/bin/v2ray-plugin
chmod +x /usr/bin/v2ray-plugin
cat > /etc/shadowsocks-rust/server/default/ss.json5 <<EOF
{
"server": "0.0.0.0",
"server_port": 8443,
"local_port": 1080,
"local_address": "127.0.0.1",
"password": "password",
"timeout": 300,
"method": "chacha20-ietf-poly1305",
"mode": "tcp_and_udp",
"plugin": "/usr/bin/v2ray-plugin",
"plugin_opts": "server",
"plugin_args": [
"loglevel", "debug"
],
"plugin_mode": "tcp_and_udp"
}
EOF
systemctl restart shadowsocks-rust-server@default
systemctl status shadowsocks-rust-server@default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment