PrintSSHTunnelInstructions detects the IP address and prints SSH tunnel instructions for the user to connect to the local OAuth callback server from a remote machine. Parameters: - port: The local port number for the SSH tunnel
(port int)
| 118 | // Parameters: |
| 119 | // - port: The local port number for the SSH tunnel |
| 120 | func PrintSSHTunnelInstructions(port int) { |
| 121 | ipAddress := GetIPAddress() |
| 122 | border := "================================================================================" |
| 123 | fmt.Println("To authenticate from a remote machine, an SSH tunnel may be required.") |
| 124 | fmt.Println(border) |
| 125 | fmt.Println(" Run one of the following commands on your local machine (NOT the server):") |
| 126 | fmt.Println() |
| 127 | fmt.Printf(" # Standard SSH command (assumes SSH port 22):\n") |
| 128 | fmt.Printf(" ssh -L %d:127.0.0.1:%d root@%s -p 22\n", port, port, ipAddress) |
| 129 | fmt.Println() |
| 130 | fmt.Printf(" # If using an SSH key (assumes SSH port 22):\n") |
| 131 | fmt.Printf(" ssh -i <path_to_your_key> -L %d:127.0.0.1:%d root@%s -p 22\n", port, port, ipAddress) |
| 132 | fmt.Println() |
| 133 | fmt.Println(" NOTE: If your server's SSH port is not 22, please modify the '-p 22' part accordingly.") |
| 134 | fmt.Println(border) |
| 135 | } |
no test coverage detected