(proxy_command: &str)
| 140 | } |
| 141 | |
| 142 | fn ssh_base_command(proxy_command: &str) -> Command { |
| 143 | // SSH log level follows the program's verbosity. main() maps the `-v` |
| 144 | // count to OPENSHELL_SSH_LOG_LEVEL; an explicit env-var override wins. |
| 145 | let ssh_log_level = |
| 146 | std::env::var("OPENSHELL_SSH_LOG_LEVEL").unwrap_or_else(|_| "ERROR".to_string()); |
| 147 | |
| 148 | let mut command = Command::new("ssh"); |
| 149 | command |
| 150 | .arg("-o") |
| 151 | .arg(format!("ProxyCommand={proxy_command}")) |
| 152 | .arg("-o") |
| 153 | .arg("StrictHostKeyChecking=no") |
| 154 | .arg("-o") |
| 155 | .arg("UserKnownHostsFile=/dev/null") |
| 156 | .arg("-o") |
| 157 | .arg("GlobalKnownHostsFile=/dev/null") |
| 158 | .arg("-o") |
| 159 | .arg(format!("LogLevel={ssh_log_level}")) |
| 160 | // Detect a dead relay within ~45s. The relay rides on a TCP connection |
| 161 | // that the client has no way to observe silently dropping (gateway |
| 162 | // restart, supervisor restart, cluster failover), so fall back to |
| 163 | // SSH-level keepalives instead of hanging forever. |
| 164 | .arg("-o") |
| 165 | .arg("ServerAliveInterval=15") |
| 166 | .arg("-o") |
| 167 | .arg("ServerAliveCountMax=3"); |
| 168 | command |
| 169 | } |
| 170 | |
| 171 | #[cfg(unix)] |
| 172 | const TRANSIENT_TTY_SIGNALS: &[Signal] = &[Signal::SIGINT, Signal::SIGQUIT, Signal::SIGTERM]; |
no outgoing calls
no test coverage detected