clj-commons/clj-ssh

ssh local port forwarding

AndreaCrotti opened this issue · 1 comments

I'm just trying to convert this:

"ssh -L 3306:remote-mysql-host:3306 bastion"

to the equivalent ssh-clj code, so I was trying something like this:

(def agent (ssh/ssh-agent {}))

(def session (ssh/session agent
                          "bastion-host"
                          {:user "bastion-user"
                           :private-key-path "key-path"
                           :strict-host-key-checking :no}))

(ssh/forward-local-port session
                        3306
                        3306
                        "remote-mysql-host")

but even though I see no errors anywhere (and the port 3306 is open checking with nmap), I can't connect to the remote MySQL, while it works perfectly well with the ssh -L command. Any idea what I'm doing wrong or how to get more debugging information?

Actually, I managed in the end, it was just me being silly.
It might still be useful maybe in the README to include the equivalent ssh command to use.