This repository has no description
0

Configure Feed

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

tornade: fix cleanup trap and Darwin SSH wrapper

- Remove exec so cleanup trap runs and kills tor on exit
- Fix SSH wrapper heredoc to use env var instead of unexpanded $SOCKS_PORT
- Add missing else branch for non-Darwin torsocks execution

+14 -14
+14 -14
tools/tornade/tornade.sh
··· 60 60 exit 1 61 61 fi 62 62 63 - # Check if we're on Darwin 63 + # Execute the command (don't use exec - need cleanup trap to run) 64 + export TORSOCKS_TOR_PORT=$SOCKS_PORT 65 + export TOR_CONTROL_PORT=$CONTROL_PORT 66 + 64 67 if [[ "$(uname)" == "Darwin" ]]; then 65 68 if [[ "$1" == "ssh" ]]; then 66 - # Direct SSH call - use old behavior 67 - shift # remove 'ssh' from arguments 68 - exec ssh -o ProxyCommand="nc -x 127.0.0.1:$SOCKS_PORT %h %p" "$@" 69 + # Direct SSH call via nc SOCKS proxy 70 + shift 71 + ssh -o ProxyCommand="nc -x 127.0.0.1:$SOCKS_PORT %h %p" "$@" 69 72 else 70 73 # Other commands - create SSH wrapper and add to PATH 71 74 SSH_WRAPPER="$TOR_DIR/ssh" 72 - cat > "$SSH_WRAPPER" <<EOF 75 + cat > "$SSH_WRAPPER" <<'SSHEOF' 73 76 #!/usr/bin/env bash 74 - # SSH wrapper that routes through Tor on Darwin 75 - exec /usr/bin/ssh -o ProxyCommand="nc -x 127.0.0.1:$SOCKS_PORT %h %p" "\$@" 76 - EOF 77 + exec /usr/bin/ssh -o ProxyCommand="nc -x 127.0.0.1:$TORSOCKS_TOR_PORT %h %p" "$@" 78 + SSHEOF 77 79 chmod +x "$SSH_WRAPPER" 78 - export PATH="$TOR_DIR:$PATH" 80 + PATH="$TOR_DIR:$PATH" torsocks "$@" 79 81 fi 82 + else 83 + torsocks "$@" 80 84 fi 81 - 82 - # Execute the command 83 - export TORSOCKS_TOR_PORT=$SOCKS_PORT 84 - export TOR_CONTROL_PORT=$CONTROL_PORT 85 - exec torsocks "$@" 85 + # cleanup trap runs on exit