Skip to content

Instantly share code, notes, and snippets.

@drmalex07
Last active November 7, 2024 09:40
Show Gist options
  • Select an option

  • Save drmalex07/1b8160f6c1761028dfff6c68d1d38156 to your computer and use it in GitHub Desktop.

Select an option

Save drmalex07/1b8160f6c1761028dfff6c68d1d38156 to your computer and use it in GitHub Desktop.
Tunnel TCP traffic via socat. #socat
#!/bin/bash
LISTEN_ADDRESS=1.2.3.4
LISTEN_PORT=10022
TARGET_HOST=app.localdomain
TARGET_PORT=22
socat -d -d TCP4-LISTEN:${LISTEN_PORT},bind=${LISTEN_ADDRESS},su=nobody,fork,reuseaddr TCP4:${TARGET_HOST}:${TARGET_PORT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment