Skip to content

Instantly share code, notes, and snippets.

@ty4z2008
Last active November 18, 2019 08:17
Show Gist options
  • Save ty4z2008/33795be7492d1b844b7a76aa12f57de7 to your computer and use it in GitHub Desktop.
Save ty4z2008/33795be7492d1b844b7a76aa12f57de7 to your computer and use it in GitHub Desktop.
snell server install script for centos . latest version https://github.com/surge-networks/snell/releases/latest
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
CONF="/etc/snell/snell-server.conf"
SYSTEMD="/etc/systemd/system/snell.service"
yum install unzip -y
cd ~/
wget --no-check-certificate -O snell.zip https://github.com/surge-networks/snell/releases/download/v1.1.1/snell-server-v1.1.1-linux-amd64.zip
unzip -o snell.zip
rm -f snell.zip
chmod +x snell-server
mv -f snell-server /usr/local/bin/
if [ -f ${CONF} ]; then
echo "Found existing config..."
else
if [ -z ${PSK} ]; then
PSK=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 16)
echo "Using generated PSK: ${PSK}"
else
echo "Using predefined PSK: ${PSK}"
fi
mkdir /etc/snell/
echo "Generating new config..."
echo "[snell-server]" >>${CONF}
echo "listen = 0.0.0.0:13254" >>${CONF}
echo "psk = ${PSK}" >>${CONF}
echo "obfs = tls" >>${CONF}
fi
if [ -f ${SYSTEMD} ]; then
echo "Found existing service..."
systemctl daemon-reload
systemctl restart snell
else
echo "Generating new service..."
echo "[Unit]" >>${SYSTEMD}
echo "Description=Snell Proxy Service" >>${SYSTEMD}
echo "After=network.target" >>${SYSTEMD}
echo "" >>${SYSTEMD}
echo "[Service]" >>${SYSTEMD}
echo "Type=simple" >>${SYSTEMD}
echo "LimitNOFILE=32768" >>${SYSTEMD}
echo "ExecStart=/usr/local/bin/snell-server -c /etc/snell/snell-server.conf" >>${SYSTEMD}
echo "" >>${SYSTEMD}
echo "[Install]" >>${SYSTEMD}
echo "WantedBy=multi-user.target" >>${SYSTEMD}
systemctl daemon-reload
systemctl enable snell
systemctl start snell
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment