Live data from Hacker News

Show HN: Mole – an open source tool to easily create ssh tunnels

davrodpin.github.io

1–10 of 61 posts

Re: Show HN: Mole – an open source tool to easily create ssh tunnels

#6
post #2

This is a fantastic tool! I've always had to reference a markdown file with SSH tunnel syntax whenever I wanted to create one. I can see myself using this quite a bit in the future.

Is the syntax difference really that interesting? It's

    mole -local 127.0.0.1:3306 -remote 127.0.0.1:3306 -server example@172.12.0.100
vs

    ssh -L 3306:127.0.0.1:3306 example@172.12.0.100
With the extra installation of mole on top.

Re: Show HN: Mole – an open source tool to easily create ssh tunnels

#7
Here are the example commands, with the SSH equivalent. There's a small syntax difference, but otherwise I don't think this tool adds much.

  $ mole -local 127.0.0.1:3306 -remote 127.0.0.1:3306 -server example@172.12.0.100
  $ ssh -L3306:127.0.0.1:3306 example@172.12.0.100

  $ mole -v -local 127.0.0.1:8080 -remote 172.17.0.100:80 -server user@example.com:22 -key ~/.ssh/id_rsa
  $ ssh -v -L8080:172.17.0.100:80 -p 22 -I ~/.ssh/id_rsa user@example.com

  $ mole -v -local 127.0.0.1:8080 -remote 172.17.0.100:80 -server example1
  $ ssh -v -L8080:172.17.0.100:80 example1

  $ mole -remote 172.17.0.100:80 -server example1
  $ ssh -L2937:172.17.0.100:80 example1
  NB Random port is predefined to be 2937, see https://xkcd.com/221/. Or use $RANDOM.

  $ mole -v -local :8080 -remote 172.17.0.100:80 -server example1
  $ ssh -L8080:172.17.0.100:80 example1
  NB difference with SSH, -L:8080... would bind the local port to 0.0.0.0:8080.

  $ mole -v -local 127.0.0.1:8080 -remote :80 -server example1
  $ ssh -L8080:127.0.0.1:80 example1

  $ mole -alias example1 -v -local :8443 -remote :443 -server user@example.com
  Add to SSH config: "LocalForward 8443 localhost:443"
I don't know if Mole supports it, but SSH also has the option to forward a remote port through the local machine.

  home $ ssh -R8888:example.net:80 work.example.com
  ...
  work $ curl -H "Host: example.net" localhost:8888
But the most useful of all is perhaps:

  work $ ssh -D3128 personal-vm-or-raspberry-pi-whatever.example.net
Then configure Firefox to use a SOCKS proxy on localhost:3128. You now bypass any corporate HTTP proxy.

Re: Show HN: Mole – an open source tool to easily create ssh tunnels

#8
post #7

Here are the example commands, with the SSH equivalent. There's a small syntax difference, but otherwise I don't think this tool adds much. $ mole -local 127.0.0.1:3306 -remote 127.0.0.1:3306 -server example@172.12.0.100 $ ssh -L3306:127.0.0.1:3306 example@172.12.0.100 $ mole -v -local 127.0.0.1:8080 -remote 172.17.0.100:80 -server user@example.com:22 -key ~/.ssh/id_rsa $ ssh -v -L8080:172.17.0.100:80 -p 22 -I ~/.ssh…

mole also doesn't seem to support DynamicForward for creating SOCKS proxies. Mind you, I'm not sure how it could improve on native ssh for concision:

    ssh -D *:1080 work
Combined with a .pac file that proxies my work domain(s) through the tunnel, it's all the forwarding I ever need.

ETA: largely redundant comment now the parent now also mentions this option. :)

Re: Show HN: Mole – an open source tool to easily create ssh tunnels

#9

I'm not sure if I missed something? Normally I use -L syntax for tunneling (-L local_port:remote_addr:remote_port). Does this tool do more?

I don't think i've missed anything, it does the same thing as ssh -L with slightly different syntax.

It's the same with mosh. Normally i use tmux on the destination host, and i simply cannot see any reason to use mosh over ssh/tmux.

Re: Show HN: Mole – an open source tool to easily create ssh tunnels

#10

I'm not sure if I missed something? Normally I use -L syntax for tunneling (-L local_port:remote_addr:remote_port). Does this tool do more?

I don't think i've missed anything, it does the same thing as ssh -L with slightly different syntax. It's the same with mosh. Normally i use tmux on the destination host, and i simply cannot see any reason to use mosh over ssh/tmux.

> i simply cannot see any reason to use mosh over ssh/tmux.

How about automatic session resumption and predictive character insertion to improve typing when under latency?

Post reply on HN