This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.tornade: wrap ssh on darwin, if ssh is run in nested command

+22 -10
+22 -10
tools/tornade/tornade.sh
··· 77 77 exit 1 78 78 fi 79 79 80 - # Check if we're trying to run SSH on macOS 81 - if [[ "$1" == "ssh" ]] && [[ "$(uname)" == "Darwin" ]]; then 82 - # On macOS, use ProxyCommand instead of torsocks due to SIP 83 - shift # remove 'ssh' from arguments 84 - exec ssh -o ProxyCommand="nc -x 127.0.0.1:$SOCKS_PORT %h %p" "$@" 85 - else 86 - # For other commands or non-macOS systems, use torsocks 87 - export TORSOCKS_TOR_PORT=$SOCKS_PORT 88 - exec torsocks "$@" 89 - fi 80 + # Check if we're on Darwin 81 + if [[ "$(uname)" == "Darwin" ]]; then 82 + if [[ "$1" == "ssh" ]]; then 83 + # Direct SSH call - use old behavior 84 + shift # remove 'ssh' from arguments 85 + exec ssh -o ProxyCommand="nc -x 127.0.0.1:$SOCKS_PORT %h %p" "$@" 86 + else 87 + # Other commands - create SSH wrapper and add to PATH 88 + SSH_WRAPPER="$TOR_DIR/ssh" 89 + cat > "$SSH_WRAPPER" <<EOF 90 + #!/usr/bin/env bash 91 + # SSH wrapper that routes through Tor on Darwin 92 + exec /usr/bin/ssh -o ProxyCommand="nc -x 127.0.0.1:$SOCKS_PORT %h %p" "\$@" 93 + EOF 94 + chmod +x "$SSH_WRAPPER" 95 + export PATH="$TOR_DIR:$PATH" 96 + fi 97 + fi 98 + 99 + # Execute the command 100 + export TORSOCKS_TOR_PORT=$SOCKS_PORT 101 + exec torsocks "$@"