├── README.md └── installer.sh /README.md: -------------------------------------------------------------------------------- 1 | # PingTunnel Server Installer 2 | 3 | This script installs [PingTunnel](https://github.com/esrrhs/pingtunnel) on your server and configures it to run as a background service in **server mode** using `systemd`. 4 | 5 | ## 📱 Client App 6 | 7 | iOS app : [Ping Tunnel – VPN over ICMP](https://apps.apple.com/app/ping-tunnel-vpn-over-icmp/id6748279683) 8 | 9 | Android app : [Ping Tunnel – VPN over ICMP](https://play.google.com/store/apps/details?id=dev.hexasoftware.PingTunnel) 10 | 11 | --- 12 | 13 | ## ✅ Features 14 | 15 | - Detects OS and architecture automatically 16 | - Downloads the **latest version** of PingTunnel 17 | - Installs it into `/opt/pingtunnel` 18 | - Creates a `systemd` service (`pingtunnel.service`) 19 | - Starts and enables the service on boot 20 | 21 | --- 22 | 23 | ## 📥 Installation 24 | 25 | Run this command to install PingTunnel server: 26 | 27 | ```bash 28 | curl -fsSL https://raw.githubusercontent.com/HexaSoftwareDev/PingTunnel-Server/main/installer.sh | sudo bash 29 | ``` 30 | if install command not working use this instead: 31 | ```bash 32 | curl -fsSL https://raw.githubusercontent.com/HexaSoftwareDev/PingTunnel-Server/main/installer.sh -o installer.sh 33 | 34 | sudo bash installer.sh 35 | ``` 36 | 37 | ## ▶️ Service Check 38 | ```bash 39 | systemctl status pingtunnel 40 | ``` 41 | ## 🙏 Thanks 42 | 43 | Thanks to [esrrhs](https://github.com/esrrhs) for creating [PingTunnel](https://github.com/esrrhs/pingtunnel). 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Detect OS 6 | get_os() { 7 | os=$(uname | tr '[:upper:]' '[:lower:]') 8 | case "$os" in 9 | linux|darwin|freebsd|dragonfly|illumos|aix) echo "$os" ;; 10 | *) echo "Unsupported OS: $os"; exit 1 ;; 11 | esac 12 | } 13 | 14 | # Detect architecture 15 | get_arch() { 16 | arch=$(uname -m) 17 | case "$arch" in 18 | x86_64) echo "amd64" ;; 19 | i386|i686) echo "386" ;; 20 | armv7l|armv6l) echo "arm" ;; 21 | aarch64|arm64) echo "arm64" ;; 22 | riscv64) echo "riscv64" ;; 23 | ppc64) echo "ppc64" ;; 24 | *) echo "Unsupported architecture: $arch"; exit 1 ;; 25 | esac 26 | } 27 | 28 | # Get latest version from GitHub 29 | get_latest_version() { 30 | curl -s https://api.github.com/repos/esrrhs/pingtunnel/releases/latest \ 31 | | grep '"tag_name":' | sed -E 's/.*"v?([^"]+)".*/\1/' 32 | } 33 | 34 | # Ensure unzip is available 35 | ensure_unzip() { 36 | if ! command -v unzip >/dev/null 2>&1; then 37 | echo "Installing unzip..." 38 | if command -v apt >/dev/null 2>&1; then 39 | apt update && apt install -y unzip 40 | elif command -v yum >/dev/null 2>&1; then 41 | yum install -y unzip 42 | else 43 | echo "Please install unzip manually."; exit 1 44 | fi 45 | fi 46 | } 47 | 48 | install_pingtunnel() { 49 | OS=$(get_os) 50 | ARCH=$(get_arch) 51 | VERSION=$(get_latest_version) 52 | FILE="pingtunnel_${OS}_${ARCH}.zip" 53 | URL="https://github.com/esrrhs/pingtunnel/releases/download/${VERSION}/${FILE}" 54 | 55 | echo "Detected: OS=$OS ARCH=$ARCH" 56 | echo "Downloading: $URL" 57 | 58 | mkdir -p /opt/pingtunnel 59 | cd /opt/pingtunnel 60 | 61 | curl -fLO "$URL" || { echo "❌ Failed to download $FILE"; exit 1; } 62 | 63 | ensure_unzip 64 | unzip -o "$FILE" || { echo "❌ Failed to unzip $FILE"; exit 1; } 65 | 66 | chmod +x pingtunnel 67 | rm -f "$FILE" 68 | } 69 | 70 | create_service() { 71 | echo "Creating systemd service..." 72 | 73 | cat < /etc/systemd/system/pingtunnel.service 74 | [Unit] 75 | Description=PingTunnel Server 76 | After=network.target 77 | 78 | [Service] 79 | Type=simple 80 | WorkingDirectory=/opt/pingtunnel 81 | ExecStart=/opt/pingtunnel/pingtunnel -type server -key ${PINGTUNNEL_KEY} 82 | Restart=on-failure 83 | 84 | [Install] 85 | WantedBy=multi-user.target 86 | EOF 87 | 88 | systemctl daemon-reload 89 | systemctl enable pingtunnel 90 | systemctl restart pingtunnel 91 | 92 | echo "✅ pingtunnel service is running." 93 | } 94 | 95 | show_final_info() { 96 | SERVER_IP=$(curl -s https://api.ipify.org) 97 | echo "" 98 | echo "✅ Installation complete." 99 | echo "---------------------------" 100 | echo "Server IP : $SERVER_IP" 101 | echo "Password : $PINGTUNNEL_KEY" 102 | echo "---------------------------" 103 | } 104 | 105 | main() { 106 | if [ "$(id -u)" -ne 0 ]; then 107 | echo "❌ Please run this script as root (use sudo)" 108 | exit 1 109 | fi 110 | 111 | # Prompt user for PingTunnel key 112 | while true; do 113 | read -p "Enter a Password (Key) for PingTunnel (-key, numbers only): " PINGTUNNEL_KEY 114 | if [[ "$PINGTUNNEL_KEY" =~ ^[0-9]+$ ]]; then 115 | break 116 | else 117 | echo "❌ Please enter numbers only." 118 | fi 119 | done 120 | 121 | install_pingtunnel 122 | create_service 123 | show_final_info 124 | } 125 | 126 | main 127 | --------------------------------------------------------------------------------