A universal SysVinit init script for GOST (GO Simple Tunnel) that works on systems without systemd.
- Compatible with legacy SysVinit systems
- No dependency on LSB functions
- Automatic process management with PID file
- Logging support
- Works on Debian, Ubuntu, CentOS, Alpine, and other Linux distributions
Download and install GOST binary:
# Download latest GOST (adjust version as needed)
wget https://github.com/ginuerzh/gost/releases/download/v2.11.5/gost-linux-amd64-2.11.5.gz
gunzip gost-linux-amd64-2.11.5.gz
chmod +x gost-linux-amd64-2.11.5
sudo mv gost-linux-amd64-2.11.5 /usr/local/bin/gost# Download the script
sudo curl -o /etc/init.d/gost https://gist.githubusercontent.com/YOUR_USERNAME/YOUR_GIST_ID/raw/gost
# Make it executable
sudo chmod +x /etc/init.d/gostEdit the script to set your GOST configuration:
sudo nano /etc/init.d/gostModify the DAEMON_ARGS line:
# Example: Local SOCKS5 proxy
DAEMON_ARGS="-L :1080"
# Example: With forwarding chain
DAEMON_ARGS="-L :1080 -F socks5://proxy.example.com:1080"
# Example: Use config file
DAEMON_ARGS="-C /etc/gost/gost.yaml"
# Example: Empty (will use default or config file)
DAEMON_ARGS=""Debian/Ubuntu:
sudo update-rc.d gost defaultsCentOS/RHEL:
sudo chkconfig --add gost
sudo chkconfig gost onAlpine Linux:
sudo rc-update add gost defaultUniversal method (rc.local):
echo '/etc/init.d/gost start' | sudo tee -a /etc/rc.local
sudo chmod +x /etc/rc.localsudo service gost start # Start GOST
sudo service gost stop # Stop GOST
sudo service gost restart # Restart GOST
sudo service gost status # Check statustail -f /var/log/gost.log# Test SOCKS5 proxy
curl -x socks5://127.0.0.1:1080 https://www.google.com
# Test HTTP proxy
curl -x http://127.0.0.1:8080 https://www.google.com
# Check listening ports
netstat -tlnp | grep gost
# or
ss -tlnp | grep gostDAEMON_ARGS="-L :1080"DAEMON_ARGS="-L admin:password@:8080"DAEMON_ARGS="-L :1080 -F ss://chacha20-ietf-poly1305:password@server:port"Create /etc/gost/gost.yaml:
services:
- name: service-0
addr: :1080
handler:
type: auto
listener:
type: tcpThen set:
DAEMON_ARGS="-C /etc/gost/gost.yaml"Check if GOST is really running:
ps aux | grep gost
netstat -tlnp | grep 1080If it's running, the script's detection might need adjustment for your system.
tail -20 /var/log/gost.log/usr/local/bin/gost -L :1080Ensure the script has proper permissions:
sudo chmod +x /etc/init.d/gostDebian/Ubuntu:
sudo update-rc.d -f gost removeCentOS/RHEL:
sudo chkconfig gost off
sudo chkconfig --del gostAlpine Linux:
sudo rc-update del gost defaultsudo service gost stop
sudo rm /etc/init.d/gost
sudo rm /var/run/gost.pid
sudo rm /var/log/gost.logThis script is provided as-is under the MIT License.
Feel free to submit issues or pull requests to improve this script.