Skip to content

Instantly share code, notes, and snippets.

@Epivalent
Created July 11, 2024 19:39
Show Gist options
  • Save Epivalent/00f5b660e0324e953c4247f27780e0cd to your computer and use it in GitHub Desktop.
Save Epivalent/00f5b660e0324e953c4247f27780e0cd to your computer and use it in GitHub Desktop.

The following socat command can be used to listen on a local interface on a specific TCP port and tunnel the traffic via SSL to another host:port pair with forking:

socat TCP-LISTEN:<local_port>,bind=<local_interface>,fork SSL:<remote_host>:<remote_port>

Replace <local_port> with the desired local TCP port number, <local_interface> with the local interface IP address or hostname you want to bind to, <remote_host> with the destination host IP address or hostname, and <remote_port> with the destination port number.

For example, if you want to listen on localhost (127.0.0.1) on port 8080 and tunnel the traffic via SSL to example.com on port 443, you can use the following command:

socat TCP-LISTEN:8080,bind=127.0.0.1,fork SSL:example.com:443

Thu Jul 11 07:39:41 PM UTC 2024 - socat invocation to listen on local interface on some tcp port and tunnel via ssl to another host:port pair with forking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment